Class: AdvancedBilling::InvoiceCredit
- Defined in:
- lib/advanced_billing/models/invoice_credit.rb
Overview
InvoiceCredit Model.
Instance Attribute Summary collapse
-
#applied_amount ⇒ String
TODO: Write general description for this method.
-
#credit_note_number ⇒ String
TODO: Write general description for this method.
-
#credit_note_uid ⇒ String
TODO: Write general description for this method.
-
#memo ⇒ String
TODO: Write general description for this method.
-
#original_amount ⇒ String
TODO: Write general description for this method.
-
#transaction_time ⇒ String
TODO: Write general description for this method.
-
#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, credit_note_number = SKIP, credit_note_uid = SKIP, transaction_time = SKIP, memo = SKIP, original_amount = SKIP, applied_amount = SKIP) ⇒ InvoiceCredit
constructor
A new instance of InvoiceCredit.
Methods inherited from BaseModel
Constructor Details
#initialize(uid = SKIP, credit_note_number = SKIP, credit_note_uid = SKIP, transaction_time = SKIP, memo = SKIP, original_amount = SKIP, applied_amount = SKIP) ⇒ InvoiceCredit
Returns a new instance of InvoiceCredit.
71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/advanced_billing/models/invoice_credit.rb', line 71 def initialize(uid = SKIP, credit_note_number = SKIP, credit_note_uid = SKIP, transaction_time = SKIP, memo = SKIP, original_amount = SKIP, applied_amount = SKIP) @uid = uid unless uid == SKIP @credit_note_number = credit_note_number unless credit_note_number == SKIP @credit_note_uid = credit_note_uid unless credit_note_uid == 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
TODO: Write general description for this method
38 39 40 |
# File 'lib/advanced_billing/models/invoice_credit.rb', line 38 def applied_amount @applied_amount end |
#credit_note_number ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/invoice_credit.rb', line 18 def credit_note_number @credit_note_number end |
#credit_note_uid ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/invoice_credit.rb', line 22 def credit_note_uid @credit_note_uid end |
#memo ⇒ String
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/invoice_credit.rb', line 30 def memo @memo end |
#original_amount ⇒ String
TODO: Write general description for this method
34 35 36 |
# File 'lib/advanced_billing/models/invoice_credit.rb', line 34 def original_amount @original_amount end |
#transaction_time ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/invoice_credit.rb', line 26 def transaction_time @transaction_time end |
#uid ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/invoice_credit.rb', line 14 def uid @uid end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/advanced_billing/models/invoice_credit.rb', line 84 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. uid = hash.key?('uid') ? hash['uid'] : SKIP credit_note_number = hash.key?('credit_note_number') ? hash['credit_note_number'] : SKIP credit_note_uid = hash.key?('credit_note_uid') ? hash['credit_note_uid'] : SKIP transaction_time = hash.key?('transaction_time') ? hash['transaction_time'] : SKIP 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 # Create object from extracted values. InvoiceCredit.new(uid, credit_note_number, credit_note_uid, transaction_time, memo, original_amount, applied_amount) end |
.names ⇒ Object
A mapping from model property names to API property names.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/advanced_billing/models/invoice_credit.rb', line 41 def self.names @_hash = {} if @_hash.nil? @_hash['uid'] = 'uid' @_hash['credit_note_number'] = 'credit_note_number' @_hash['credit_note_uid'] = 'credit_note_uid' @_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
67 68 69 |
# File 'lib/advanced_billing/models/invoice_credit.rb', line 67 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/advanced_billing/models/invoice_credit.rb', line 54 def self.optionals %w[ uid credit_note_number credit_note_uid transaction_time memo original_amount applied_amount ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
113 114 115 116 117 118 119 |
# File 'lib/advanced_billing/models/invoice_credit.rb', line 113 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |