Class: AdvancedBilling::InvoiceDebit
- Defined in:
- lib/advanced_billing/models/invoice_debit.rb
Overview
InvoiceDebit Model.
Instance Attribute Summary collapse
-
#applied_amount ⇒ String
The role of the debit note.
-
#debit_note_number ⇒ String
TODO: Write general description for this method.
-
#debit_note_uid ⇒ String
TODO: Write general description for this method.
-
#memo ⇒ String
The role of the debit note.
-
#original_amount ⇒ String
The role of the debit note.
-
#role ⇒ DebitNoteRole
The role of the debit note.
-
#transaction_time ⇒ DateTime
The role of the debit note.
-
#uid ⇒ String
TODO: Write general description for this method.
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(uid: SKIP, debit_note_number: SKIP, debit_note_uid: SKIP, role: SKIP, transaction_time: SKIP, memo: SKIP, original_amount: SKIP, applied_amount: SKIP, additional_properties: {}) ⇒ InvoiceDebit
constructor
A new instance of InvoiceDebit.
- #to_custom_transaction_time ⇒ 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(uid: SKIP, debit_note_number: SKIP, debit_note_uid: SKIP, role: SKIP, transaction_time: SKIP, memo: SKIP, original_amount: SKIP, applied_amount: SKIP, additional_properties: {}) ⇒ InvoiceDebit
Returns a new instance of InvoiceDebit.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/advanced_billing/models/invoice_debit.rb', line 78 def initialize(uid: SKIP, debit_note_number: SKIP, debit_note_uid: SKIP, role: SKIP, transaction_time: SKIP, memo: SKIP, original_amount: SKIP, applied_amount: SKIP, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @uid = uid unless uid == SKIP @debit_note_number = debit_note_number unless debit_note_number == SKIP @debit_note_uid = debit_note_uid unless debit_note_uid == SKIP @role = role unless role == SKIP @transaction_time = transaction_time unless transaction_time == SKIP @memo = memo unless memo == SKIP @original_amount = original_amount unless original_amount == SKIP @applied_amount = applied_amount unless applied_amount == SKIP end |
Instance Attribute Details
#applied_amount ⇒ String
The role of the debit note.
43 44 45 |
# File 'lib/advanced_billing/models/invoice_debit.rb', line 43 def applied_amount @applied_amount end |
#debit_note_number ⇒ String
TODO: Write general description for this method
19 20 21 |
# File 'lib/advanced_billing/models/invoice_debit.rb', line 19 def debit_note_number @debit_note_number end |
#debit_note_uid ⇒ String
TODO: Write general description for this method
23 24 25 |
# File 'lib/advanced_billing/models/invoice_debit.rb', line 23 def debit_note_uid @debit_note_uid end |
#memo ⇒ String
The role of the debit note.
35 36 37 |
# File 'lib/advanced_billing/models/invoice_debit.rb', line 35 def memo @memo end |
#original_amount ⇒ String
The role of the debit note.
39 40 41 |
# File 'lib/advanced_billing/models/invoice_debit.rb', line 39 def original_amount @original_amount end |
#role ⇒ DebitNoteRole
The role of the debit note.
27 28 29 |
# File 'lib/advanced_billing/models/invoice_debit.rb', line 27 def role @role end |
#transaction_time ⇒ DateTime
The role of the debit note.
31 32 33 |
# File 'lib/advanced_billing/models/invoice_debit.rb', line 31 def transaction_time @transaction_time end |
#uid ⇒ String
TODO: Write general description for this method
15 16 17 |
# File 'lib/advanced_billing/models/invoice_debit.rb', line 15 def uid @uid end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/advanced_billing/models/invoice_debit.rb', line 98 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. uid = hash.key?('uid') ? hash['uid'] : SKIP debit_note_number = hash.key?('debit_note_number') ? hash['debit_note_number'] : SKIP debit_note_uid = hash.key?('debit_note_uid') ? hash['debit_note_uid'] : SKIP role = hash.key?('role') ? hash['role'] : SKIP transaction_time = if hash.key?('transaction_time') (DateTimeHelper.from_rfc3339(hash['transaction_time']) if hash['transaction_time']) else SKIP end memo = hash.key?('memo') ? hash['memo'] : SKIP original_amount = hash.key?('original_amount') ? hash['original_amount'] : SKIP applied_amount = hash.key?('applied_amount') ? hash['applied_amount'] : SKIP # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. InvoiceDebit.new(uid: uid, debit_note_number: debit_note_number, debit_note_uid: debit_note_uid, role: role, transaction_time: transaction_time, memo: memo, original_amount: original_amount, applied_amount: applied_amount, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/advanced_billing/models/invoice_debit.rb', line 46 def self.names @_hash = {} if @_hash.nil? @_hash['uid'] = 'uid' @_hash['debit_note_number'] = 'debit_note_number' @_hash['debit_note_uid'] = 'debit_note_uid' @_hash['role'] = 'role' @_hash['transaction_time'] = 'transaction_time' @_hash['memo'] = 'memo' @_hash['original_amount'] = 'original_amount' @_hash['applied_amount'] = 'applied_amount' @_hash end |
.nullables ⇒ Object
An array for nullable fields
74 75 76 |
# File 'lib/advanced_billing/models/invoice_debit.rb', line 74 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/advanced_billing/models/invoice_debit.rb', line 60 def self.optionals %w[ uid debit_note_number debit_note_uid role transaction_time memo original_amount applied_amount ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
140 141 142 143 144 145 146 |
# File 'lib/advanced_billing/models/invoice_debit.rb', line 140 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#to_custom_transaction_time ⇒ Object
134 135 136 |
# File 'lib/advanced_billing/models/invoice_debit.rb', line 134 def to_custom_transaction_time DateTimeHelper.to_rfc3339(transaction_time) end |