Class: AdvancedBilling::ChangeInvoiceCollectionMethodEvent
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::ChangeInvoiceCollectionMethodEvent
- Defined in:
- lib/advanced_billing/models/change_invoice_collection_method_event.rb
Overview
ChangeInvoiceCollectionMethodEvent Model.
Instance Attribute Summary collapse
-
#event_data ⇒ ChangeInvoiceCollectionMethodEventData
Example schema for an ‘change_invoice_collection_method` event.
-
#event_type ⇒ InvoiceEventType
TODO: Write general description for this method.
-
#id ⇒ Integer
TODO: Write general description for this method.
-
#invoice ⇒ Invoice
TODO: Write general description for this method.
-
#timestamp ⇒ DateTime
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(id:, timestamp:, invoice:, event_type: InvoiceEventType::CHANGE_INVOICE_COLLECTION_METHOD, event_data:, additional_properties: {}) ⇒ ChangeInvoiceCollectionMethodEvent
constructor
A new instance of ChangeInvoiceCollectionMethodEvent.
- #to_custom_timestamp ⇒ 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(id:, timestamp:, invoice:, event_type: InvoiceEventType::CHANGE_INVOICE_COLLECTION_METHOD, event_data:, additional_properties: {}) ⇒ ChangeInvoiceCollectionMethodEvent
Returns a new instance of ChangeInvoiceCollectionMethodEvent.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/advanced_billing/models/change_invoice_collection_method_event.rb', line 54 def initialize( id:, timestamp:, invoice:, event_type: InvoiceEventType::CHANGE_INVOICE_COLLECTION_METHOD, event_data:, additional_properties: {} ) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @id = id @timestamp = @invoice = invoice @event_type = event_type @event_data = event_data end |
Instance Attribute Details
#event_data ⇒ ChangeInvoiceCollectionMethodEventData
Example schema for an ‘change_invoice_collection_method` event
31 32 33 |
# File 'lib/advanced_billing/models/change_invoice_collection_method_event.rb', line 31 def event_data @event_data end |
#event_type ⇒ InvoiceEventType
TODO: Write general description for this method
27 28 29 |
# File 'lib/advanced_billing/models/change_invoice_collection_method_event.rb', line 27 def event_type @event_type end |
#id ⇒ Integer
TODO: Write general description for this method
15 16 17 |
# File 'lib/advanced_billing/models/change_invoice_collection_method_event.rb', line 15 def id @id end |
#invoice ⇒ Invoice
TODO: Write general description for this method
23 24 25 |
# File 'lib/advanced_billing/models/change_invoice_collection_method_event.rb', line 23 def invoice @invoice end |
#timestamp ⇒ DateTime
TODO: Write general description for this method
19 20 21 |
# File 'lib/advanced_billing/models/change_invoice_collection_method_event.rb', line 19 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 91 92 93 94 95 96 |
# File 'lib/advanced_billing/models/change_invoice_collection_method_event.rb', line 72 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : nil = if hash.key?('timestamp') (DateTimeHelper.from_rfc3339(hash['timestamp']) if hash['timestamp']) end invoice = Invoice.from_hash(hash['invoice']) if hash['invoice'] event_type = hash['event_type'] ||= InvoiceEventType::CHANGE_INVOICE_COLLECTION_METHOD event_data = ChangeInvoiceCollectionMethodEventData.from_hash(hash['event_data']) if hash['event_data'] # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. ChangeInvoiceCollectionMethodEvent.new(id: id, timestamp: , invoice: invoice, event_type: event_type, event_data: event_data, additional_properties: additional_properties) 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/change_invoice_collection_method_event.rb', line 34 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['timestamp'] = 'timestamp' @_hash['invoice'] = 'invoice' @_hash['event_type'] = 'event_type' @_hash['event_data'] = 'event_data' @_hash end |
.nullables ⇒ Object
An array for nullable fields
50 51 52 |
# File 'lib/advanced_billing/models/change_invoice_collection_method_event.rb', line 50 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
45 46 47 |
# File 'lib/advanced_billing/models/change_invoice_collection_method_event.rb', line 45 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
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 133 134 135 136 137 138 |
# File 'lib/advanced_billing/models/change_invoice_collection_method_event.rb', line 104 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.id, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value., ->(val) { val.instance_of? DateTime }) and APIHelper.valid_type?(value.invoice, ->(val) { Invoice.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value.event_type, ->(val) { InvoiceEventType.validate(val) }) and APIHelper.valid_type?(value.event_data, ->(val) { ChangeInvoiceCollectionMethodEventData.validate(val) }, is_model_hash: true) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['id'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['timestamp'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['invoice'], ->(val) { Invoice.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value['event_type'], ->(val) { InvoiceEventType.validate(val) }) and APIHelper.valid_type?(value['event_data'], ->(val) { ChangeInvoiceCollectionMethodEventData.validate(val) }, is_model_hash: true) ) end |
Instance Method Details
#to_custom_timestamp ⇒ Object
98 99 100 |
# File 'lib/advanced_billing/models/change_invoice_collection_method_event.rb', line 98 def DateTimeHelper.to_rfc3339() end |