Class: AdvancedBilling::VoidInvoiceEventData1
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::VoidInvoiceEventData1
- Defined in:
- lib/advanced_billing/models/void_invoice_event_data1.rb
Overview
Example schema for an ‘void_invoice` event
Instance Attribute Summary collapse
-
#applied_amount ⇒ String
The amount of the void.
-
#credit_note_attributes ⇒ CreditNote
TODO: Write general description for this method.
-
#memo ⇒ String
The memo provided during invoice remainder voiding.
-
#transaction_time ⇒ DateTime
The time the refund was applied, in ISO 8601 format, i.e.
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(credit_note_attributes = SKIP, memo = SKIP, applied_amount = SKIP, transaction_time = SKIP) ⇒ VoidInvoiceEventData1
constructor
A new instance of VoidInvoiceEventData1.
- #to_custom_transaction_time ⇒ Object
Methods inherited from BaseModel
Constructor Details
#initialize(credit_note_attributes = SKIP, memo = SKIP, applied_amount = SKIP, transaction_time = SKIP) ⇒ VoidInvoiceEventData1
Returns a new instance of VoidInvoiceEventData1.
55 56 57 58 59 60 61 |
# File 'lib/advanced_billing/models/void_invoice_event_data1.rb', line 55 def initialize(credit_note_attributes = SKIP, memo = SKIP, applied_amount = SKIP, transaction_time = SKIP) @credit_note_attributes = credit_note_attributes unless credit_note_attributes == SKIP @memo = memo unless memo == SKIP @applied_amount = applied_amount unless applied_amount == SKIP @transaction_time = transaction_time unless transaction_time == SKIP end |
Instance Attribute Details
#applied_amount ⇒ String
The amount of the void.
23 24 25 |
# File 'lib/advanced_billing/models/void_invoice_event_data1.rb', line 23 def applied_amount @applied_amount end |
#credit_note_attributes ⇒ CreditNote
TODO: Write general description for this method
15 16 17 |
# File 'lib/advanced_billing/models/void_invoice_event_data1.rb', line 15 def credit_note_attributes @credit_note_attributes end |
#memo ⇒ String
The memo provided during invoice remainder voiding.
19 20 21 |
# File 'lib/advanced_billing/models/void_invoice_event_data1.rb', line 19 def memo @memo end |
#transaction_time ⇒ DateTime
The time the refund was applied, in ISO 8601 format, i.e. “2019-06-07T17:20:06Z”
28 29 30 |
# File 'lib/advanced_billing/models/void_invoice_event_data1.rb', line 28 def transaction_time @transaction_time end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/advanced_billing/models/void_invoice_event_data1.rb', line 64 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. credit_note_attributes = CreditNote.from_hash(hash['credit_note_attributes']) if hash['credit_note_attributes'] memo = hash.key?('memo') ? hash['memo'] : SKIP applied_amount = hash.key?('applied_amount') ? hash['applied_amount'] : SKIP transaction_time = if hash.key?('transaction_time') (DateTimeHelper.from_rfc3339(hash['transaction_time']) if hash['transaction_time']) else SKIP end # Create object from extracted values. VoidInvoiceEventData1.new(credit_note_attributes, memo, applied_amount, transaction_time) end |
.names ⇒ Object
A mapping from model property names to API property names.
31 32 33 34 35 36 37 38 |
# File 'lib/advanced_billing/models/void_invoice_event_data1.rb', line 31 def self.names @_hash = {} if @_hash.nil? @_hash['credit_note_attributes'] = 'credit_note_attributes' @_hash['memo'] = 'memo' @_hash['applied_amount'] = 'applied_amount' @_hash['transaction_time'] = 'transaction_time' @_hash end |
.nullables ⇒ Object
An array for nullable fields
51 52 53 |
# File 'lib/advanced_billing/models/void_invoice_event_data1.rb', line 51 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
41 42 43 44 45 46 47 48 |
# File 'lib/advanced_billing/models/void_invoice_event_data1.rb', line 41 def self.optionals %w[ credit_note_attributes memo applied_amount transaction_time ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
92 93 94 95 96 97 98 |
# File 'lib/advanced_billing/models/void_invoice_event_data1.rb', line 92 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
86 87 88 |
# File 'lib/advanced_billing/models/void_invoice_event_data1.rb', line 86 def to_custom_transaction_time DateTimeHelper.to_rfc3339(transaction_time) end |