Class: SixSaferpay::Invoice

Inherits:
Object
  • Object
show all
Defined in:
lib/six_saferpay/models/invoice.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payee: nil, reason_for_transfer: nil, due_date: nil) ⇒ Invoice

Returns a new instance of Invoice.



6
7
8
9
10
# File 'lib/six_saferpay/models/invoice.rb', line 6

def initialize(payee: nil, reason_for_transfer: nil, due_date: nil)
  @payee = SixSaferpay::Payee.new(**payee.to_h) if payee
  @reason_for_transfer = reason_for_transfer
  @due_date = due_date
end

Instance Attribute Details

#due_dateObject

Returns the value of attribute due_date.



4
5
6
# File 'lib/six_saferpay/models/invoice.rb', line 4

def due_date
  @due_date
end

#payeeObject

Returns the value of attribute payee.



4
5
6
# File 'lib/six_saferpay/models/invoice.rb', line 4

def payee
  @payee
end

#reason_for_transferObject

Returns the value of attribute reason_for_transfer.



4
5
6
# File 'lib/six_saferpay/models/invoice.rb', line 4

def reason_for_transfer
  @reason_for_transfer
end

Instance Method Details

#to_hashObject Also known as: to_h



12
13
14
15
16
17
18
# File 'lib/six_saferpay/models/invoice.rb', line 12

def to_hash
  hash = Hash.new
  hash.merge!(payee: @payee.to_h) if @payee
  hash.merge!(reason_for_transfer: @reason_for_transfer) if @reason_for_transfer
  hash.merge!(due_date: @due_date) if @due_date
  hash
end