Class: AdvancedBilling::CreditNoteApplication
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::CreditNoteApplication
- Defined in:
- lib/advanced_billing/models/credit_note_application.rb
Overview
CreditNoteApplication Model.
Instance Attribute Summary collapse
-
#applied_amount ⇒ String
TODO: Write general description for this method.
-
#invoice_uid ⇒ String
TODO: Write general description for this method.
-
#memo ⇒ String
TODO: Write general description for this method.
-
#transaction_time ⇒ DateTime
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, transaction_time: SKIP, invoice_uid: SKIP, memo: SKIP, applied_amount: SKIP, additional_properties: {}) ⇒ CreditNoteApplication
constructor
A new instance of CreditNoteApplication.
- #to_custom_transaction_time ⇒ Object
Methods inherited from BaseModel
Constructor Details
#initialize(uid: SKIP, transaction_time: SKIP, invoice_uid: SKIP, memo: SKIP, applied_amount: SKIP, additional_properties: {}) ⇒ CreditNoteApplication
Returns a new instance of CreditNoteApplication.
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/advanced_billing/models/credit_note_application.rb', line 60 def initialize(uid: SKIP, transaction_time: SKIP, invoice_uid: SKIP, memo: SKIP, applied_amount: SKIP, additional_properties: {}) @uid = uid unless uid == SKIP @transaction_time = transaction_time unless transaction_time == SKIP @invoice_uid = invoice_uid unless invoice_uid == SKIP @memo = memo unless memo == SKIP @applied_amount = applied_amount unless applied_amount == SKIP # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end end |
Instance Attribute Details
#applied_amount ⇒ String
TODO: Write general description for this method
31 32 33 |
# File 'lib/advanced_billing/models/credit_note_application.rb', line 31 def applied_amount @applied_amount end |
#invoice_uid ⇒ String
TODO: Write general description for this method
23 24 25 |
# File 'lib/advanced_billing/models/credit_note_application.rb', line 23 def invoice_uid @invoice_uid end |
#memo ⇒ String
TODO: Write general description for this method
27 28 29 |
# File 'lib/advanced_billing/models/credit_note_application.rb', line 27 def memo @memo end |
#transaction_time ⇒ DateTime
TODO: Write general description for this method
19 20 21 |
# File 'lib/advanced_billing/models/credit_note_application.rb', line 19 def transaction_time @transaction_time end |
#uid ⇒ String
TODO: Write general description for this method
15 16 17 |
# File 'lib/advanced_billing/models/credit_note_application.rb', line 15 def uid @uid end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/advanced_billing/models/credit_note_application.rb', line 75 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. uid = hash.key?('uid') ? hash['uid'] : SKIP transaction_time = if hash.key?('transaction_time') (DateTimeHelper.from_rfc3339(hash['transaction_time']) if hash['transaction_time']) else SKIP end invoice_uid = hash.key?('invoice_uid') ? hash['invoice_uid'] : SKIP memo = hash.key?('memo') ? hash['memo'] : SKIP applied_amount = hash.key?('applied_amount') ? hash['applied_amount'] : SKIP # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. CreditNoteApplication.new(uid: uid, transaction_time: transaction_time, invoice_uid: invoice_uid, memo: memo, applied_amount: applied_amount, additional_properties: hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
34 35 36 37 38 39 40 41 42 |
# File 'lib/advanced_billing/models/credit_note_application.rb', line 34 def self.names @_hash = {} if @_hash.nil? @_hash['uid'] = 'uid' @_hash['transaction_time'] = 'transaction_time' @_hash['invoice_uid'] = 'invoice_uid' @_hash['memo'] = 'memo' @_hash['applied_amount'] = 'applied_amount' @_hash end |
.nullables ⇒ Object
An array for nullable fields
56 57 58 |
# File 'lib/advanced_billing/models/credit_note_application.rb', line 56 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
45 46 47 48 49 50 51 52 53 |
# File 'lib/advanced_billing/models/credit_note_application.rb', line 45 def self.optionals %w[ uid transaction_time invoice_uid memo applied_amount ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
108 109 110 111 112 113 114 |
# File 'lib/advanced_billing/models/credit_note_application.rb', line 108 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
102 103 104 |
# File 'lib/advanced_billing/models/credit_note_application.rb', line 102 def to_custom_transaction_time DateTimeHelper.to_rfc3339(transaction_time) end |