Class: AdvancedBilling::InvoiceEvent
- Defined in:
- lib/advanced_billing/models/invoice_event.rb
Overview
InvoiceEvent Model.
Instance Attribute Summary collapse
-
#event_data ⇒ InvoiceEvent1
The event data is the data that, when combined with the command, results in the output invoice found in the invoice field.
-
#event_type ⇒ InvoiceEventType
Invoice Event Type.
-
#id ⇒ Integer
TODO: Write general description for this method.
-
#invoice ⇒ Invoice
The event data is the data that, when combined with the command, results in the output invoice found in the invoice field.
-
#timestamp ⇒ String
The event data is the data that, when combined with the command, results in the output invoice found in the invoice field.
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(id = SKIP, event_type = SKIP, event_data = SKIP, timestamp = SKIP, invoice = SKIP) ⇒ InvoiceEvent
constructor
A new instance of InvoiceEvent.
Methods inherited from BaseModel
Constructor Details
#initialize(id = SKIP, event_type = SKIP, event_data = SKIP, timestamp = SKIP, invoice = SKIP) ⇒ InvoiceEvent
Returns a new instance of InvoiceEvent.
62 63 64 65 66 67 68 69 |
# File 'lib/advanced_billing/models/invoice_event.rb', line 62 def initialize(id = SKIP, event_type = SKIP, event_data = SKIP, = SKIP, invoice = SKIP) @id = id unless id == SKIP @event_type = event_type unless event_type == SKIP @event_data = event_data unless event_data == SKIP @timestamp = unless == SKIP @invoice = invoice unless invoice == SKIP end |
Instance Attribute Details
#event_data ⇒ InvoiceEvent1
The event data is the data that, when combined with the command, results in the output invoice found in the invoice field.
23 24 25 |
# File 'lib/advanced_billing/models/invoice_event.rb', line 23 def event_data @event_data end |
#event_type ⇒ InvoiceEventType
Invoice Event Type
18 19 20 |
# File 'lib/advanced_billing/models/invoice_event.rb', line 18 def event_type @event_type end |
#id ⇒ Integer
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/invoice_event.rb', line 14 def id @id end |
#invoice ⇒ Invoice
The event data is the data that, when combined with the command, results in the output invoice found in the invoice field.
33 34 35 |
# File 'lib/advanced_billing/models/invoice_event.rb', line 33 def invoice @invoice end |
#timestamp ⇒ String
The event data is the data that, when combined with the command, results in the output invoice found in the invoice field.
28 29 30 |
# File 'lib/advanced_billing/models/invoice_event.rb', line 28 def @timestamp end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/advanced_billing/models/invoice_event.rb', line 72 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP event_type = hash.key?('event_type') ? hash['event_type'] : SKIP event_data = hash.key?('event_data') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:InvoiceEventEventData), hash['event_data'] ) : SKIP = hash.key?('timestamp') ? hash['timestamp'] : SKIP invoice = Invoice.from_hash(hash['invoice']) if hash['invoice'] # Create object from extracted values. InvoiceEvent.new(id, event_type, event_data, , invoice) end |
.names ⇒ Object
A mapping from model property names to API property names.
36 37 38 39 40 41 42 43 44 |
# File 'lib/advanced_billing/models/invoice_event.rb', line 36 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['event_type'] = 'event_type' @_hash['event_data'] = 'event_data' @_hash['timestamp'] = 'timestamp' @_hash['invoice'] = 'invoice' @_hash end |
.nullables ⇒ Object
An array for nullable fields
58 59 60 |
# File 'lib/advanced_billing/models/invoice_event.rb', line 58 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
47 48 49 50 51 52 53 54 55 |
# File 'lib/advanced_billing/models/invoice_event.rb', line 47 def self.optionals %w[ id event_type event_data timestamp invoice ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
94 95 96 97 98 99 100 |
# File 'lib/advanced_billing/models/invoice_event.rb', line 94 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |