lib/mollie/settlement.rb in mollie-api-ruby-4.0.0 vs lib/mollie/settlement.rb in mollie-api-ruby-4.0.1
- old
+ new
@@ -1,11 +1,11 @@
module Mollie
class Settlement < Base
- STATUS_OPEN = "open"
- STATUS_PENDING = "pending"
- STATUS_PAIDOUT = "paidout"
- STATUS_FAILED = "failed"
+ STATUS_OPEN = 'open'.freeze
+ STATUS_PENDING = 'pending'.freeze
+ STATUS_PAIDOUT = 'paidout'.freeze
+ STATUS_FAILED = 'failed'.freeze
attr_accessor :id,
:reference,
:created_at,
:settled_at,
@@ -13,18 +13,18 @@
:amount,
:periods,
:invoice_id,
:_links
- alias_method :links, :_links
+ alias links _links
def self.open(options = {})
- get("open", options)
+ get('open', options)
end
def self.next(options = {})
- get("next", options)
+ get('next', options)
end
def open?
status == STATUS_OPEN
end
@@ -40,14 +40,22 @@
def failed?
status == STATUS_FAILED
end
def created_at=(created_at)
- @created_at = Time.parse(created_at.to_s) rescue nil
+ @created_at = begin
+ Time.parse(created_at.to_s)
+ rescue StandardError
+ nil
+ end
end
def settled_at=(settled_at)
- @settled_at = Time.parse(settled_at.to_s) rescue nil
+ @settled_at = begin
+ Time.parse(settled_at.to_s)
+ rescue StandardError
+ nil
+ end
end
def amount=(amount)
@amount = Mollie::Amount.new(amount)
end