Class: AdvancedBilling::Event
- Defined in:
- lib/advanced_billing/models/event.rb
Overview
Event Model.
Instance Attribute Summary collapse
-
#created_at ⇒ String
TODO: Write general description for this method.
-
#customer_id ⇒ Float
TODO: Write general description for this method.
-
#event_specific_data ⇒ Object
TODO: Write general description for this method.
-
#id ⇒ Float
TODO: Write general description for this method.
-
#key ⇒ String
TODO: Write general description for this method.
-
#message ⇒ String
TODO: Write general description for this method.
-
#subscription_id ⇒ Float
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 = nil, key = nil, message = nil, subscription_id = nil, customer_id = nil, created_at = nil, event_specific_data = nil) ⇒ Event
constructor
A new instance of Event.
Methods inherited from BaseModel
Constructor Details
#initialize(id = nil, key = nil, message = nil, subscription_id = nil, customer_id = nil, created_at = nil, event_specific_data = nil) ⇒ Event
65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/advanced_billing/models/event.rb', line 65 def initialize(id = nil, key = nil, = nil, subscription_id = nil, customer_id = nil, created_at = nil, event_specific_data = nil) @id = id @key = key = @subscription_id = subscription_id @customer_id = customer_id @created_at = created_at @event_specific_data = event_specific_data end |
Instance Attribute Details
#created_at ⇒ String
TODO: Write general description for this method
34 35 36 |
# File 'lib/advanced_billing/models/event.rb', line 34 def created_at @created_at end |
#customer_id ⇒ Float
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/event.rb', line 30 def customer_id @customer_id end |
#event_specific_data ⇒ Object
TODO: Write general description for this method
38 39 40 |
# File 'lib/advanced_billing/models/event.rb', line 38 def event_specific_data @event_specific_data end |
#id ⇒ Float
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/event.rb', line 14 def id @id end |
#key ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/event.rb', line 18 def key @key end |
#message ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/event.rb', line 22 def end |
#subscription_id ⇒ Float
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/event.rb', line 26 def subscription_id @subscription_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/advanced_billing/models/event.rb', line 78 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : nil key = hash.key?('key') ? hash['key'] : nil = hash.key?('message') ? hash['message'] : nil subscription_id = hash.key?('subscription_id') ? hash['subscription_id'] : nil customer_id = hash.key?('customer_id') ? hash['customer_id'] : nil created_at = hash.key?('created_at') ? hash['created_at'] : nil event_specific_data = hash.key?('event_specific_data') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:EventEventSpecificData), hash['event_specific_data'] ) : nil # Create object from extracted values. Event.new(id, key, , subscription_id, customer_id, created_at, event_specific_data) 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/event.rb', line 41 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['key'] = 'key' @_hash['message'] = 'message' @_hash['subscription_id'] = 'subscription_id' @_hash['customer_id'] = 'customer_id' @_hash['created_at'] = 'created_at' @_hash['event_specific_data'] = 'event_specific_data' @_hash end |
.nullables ⇒ Object
An array for nullable fields
59 60 61 62 63 |
# File 'lib/advanced_billing/models/event.rb', line 59 def self.nullables %w[ event_specific_data ] end |
.optionals ⇒ Object
An array for optional fields
54 55 56 |
# File 'lib/advanced_billing/models/event.rb', line 54 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
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 139 140 141 142 143 |
# File 'lib/advanced_billing/models/event.rb', line 105 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.id, ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value.key, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value., ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.subscription_id, ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value.customer_id, ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value.created_at, ->(val) { val.instance_of? String }) and UnionTypeLookUp.get(:EventEventSpecificData) .validate(value.event_specific_data) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['id'], ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value['key'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['message'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['subscription_id'], ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value['customer_id'], ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value['created_at'], ->(val) { val.instance_of? String }) and UnionTypeLookUp.get(:EventEventSpecificData) .validate(value['event_specific_data']) ) end |