Class: TqlOtrFactoringDataExchange::Payment
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- TqlOtrFactoringDataExchange::Payment
- Defined in:
- lib/tql_otr_factoring_data_exchange/models/payment.rb
Overview
Payment and billing details for this invoice.
Instance Attribute Summary collapse
-
#currency ⇒ String
[ISO 4217](www.iso.org/iso-4217-currency-codes.html) currency code.
-
#due_date ⇒ Date
Payment due date.
-
#invoice_amount ⇒ Float
Total invoiced amount.
-
#paid_amount ⇒ Float
Amount paid against this invoice so far.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(invoice_amount: SKIP, paid_amount: SKIP, currency: SKIP, due_date: SKIP, additional_properties: nil) ⇒ Payment
constructor
A new instance of Payment.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(invoice_amount: SKIP, paid_amount: SKIP, currency: SKIP, due_date: SKIP, additional_properties: nil) ⇒ Payment
Returns a new instance of Payment.
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/tql_otr_factoring_data_exchange/models/payment.rb', line 56 def initialize(invoice_amount: SKIP, paid_amount: SKIP, currency: SKIP, due_date: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @invoice_amount = invoice_amount unless invoice_amount == SKIP @paid_amount = paid_amount unless paid_amount == SKIP @currency = currency unless currency == SKIP @due_date = due_date unless due_date == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#currency ⇒ String
[ISO 4217](www.iso.org/iso-4217-currency-codes.html) currency code.
23 24 25 |
# File 'lib/tql_otr_factoring_data_exchange/models/payment.rb', line 23 def currency @currency end |
#due_date ⇒ Date
Payment due date.
27 28 29 |
# File 'lib/tql_otr_factoring_data_exchange/models/payment.rb', line 27 def due_date @due_date end |
#invoice_amount ⇒ Float
Total invoiced amount.
14 15 16 |
# File 'lib/tql_otr_factoring_data_exchange/models/payment.rb', line 14 def invoice_amount @invoice_amount end |
#paid_amount ⇒ Float
Amount paid against this invoice so far.
18 19 20 |
# File 'lib/tql_otr_factoring_data_exchange/models/payment.rb', line 18 def paid_amount @paid_amount end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/tql_otr_factoring_data_exchange/models/payment.rb', line 69 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. invoice_amount = hash.key?('invoiceAmount') ? hash['invoiceAmount'] : SKIP paid_amount = hash.key?('paidAmount') ? hash['paidAmount'] : SKIP currency = hash.key?('currency') ? hash['currency'] : SKIP due_date = hash.key?('dueDate') ? hash['dueDate'] : SKIP # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. Payment.new(invoice_amount: invoice_amount, paid_amount: paid_amount, currency: currency, due_date: due_date, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
30 31 32 33 34 35 36 37 |
# File 'lib/tql_otr_factoring_data_exchange/models/payment.rb', line 30 def self.names @_hash = {} if @_hash.nil? @_hash['invoice_amount'] = 'invoiceAmount' @_hash['paid_amount'] = 'paidAmount' @_hash['currency'] = 'currency' @_hash['due_date'] = 'dueDate' @_hash end |
.nullables ⇒ Object
An array for nullable fields
50 51 52 53 54 |
# File 'lib/tql_otr_factoring_data_exchange/models/payment.rb', line 50 def self.nullables %w[ due_date ] end |
.optionals ⇒ Object
An array for optional fields
40 41 42 43 44 45 46 47 |
# File 'lib/tql_otr_factoring_data_exchange/models/payment.rb', line 40 def self.optionals %w[ invoice_amount paid_amount currency due_date ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
101 102 103 104 105 106 |
# File 'lib/tql_otr_factoring_data_exchange/models/payment.rb', line 101 def inspect class_name = self.class.name.split('::').last "<#{class_name} invoice_amount: #{@invoice_amount.inspect}, paid_amount:"\ " #{@paid_amount.inspect}, currency: #{@currency.inspect}, due_date: #{@due_date.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
94 95 96 97 98 |
# File 'lib/tql_otr_factoring_data_exchange/models/payment.rb', line 94 def to_s class_name = self.class.name.split('::').last "<#{class_name} invoice_amount: #{@invoice_amount}, paid_amount: #{@paid_amount}, currency:"\ " #{@currency}, due_date: #{@due_date}, additional_properties: #{@additional_properties}>" end |