Class: AdvancedBilling::ChargifyEBB
- Defined in:
- lib/advanced_billing/models/chargify_ebb.rb
Overview
ChargifyEBB Model.
Instance Attribute Summary collapse
-
#created_at ⇒ DateTime
An ISO-8601 timestamp, set by Chargify at the time each event is recorded.
-
#id ⇒ String
A unique ID set by Chargify.
-
#subscription_id ⇒ Integer
Id of Maxio Advanced Billing Subscription which is connected to this event.
-
#subscription_reference ⇒ String
Reference of Maxio Advanced Billing Subscription which is connected to this event.
-
#timestamp ⇒ DateTime
This timestamp determines what billing period the event will be billed in.
-
#uniqueness_token ⇒ String
User-defined string scoped per-stream.
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.
Instance Method Summary collapse
-
#initialize(timestamp: SKIP, id: SKIP, created_at: SKIP, uniqueness_token: SKIP, subscription_id: SKIP, subscription_reference: SKIP, additional_properties: {}) ⇒ ChargifyEBB
constructor
A new instance of ChargifyEBB.
- #to_custom_created_at ⇒ Object
- #to_custom_timestamp ⇒ Object
Methods inherited from BaseModel
Constructor Details
#initialize(timestamp: SKIP, id: SKIP, created_at: SKIP, uniqueness_token: SKIP, subscription_id: SKIP, subscription_reference: SKIP, additional_properties: {}) ⇒ ChargifyEBB
Returns a new instance of ChargifyEBB.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/advanced_billing/models/chargify_ebb.rb', line 79 def initialize(timestamp: SKIP, id: SKIP, created_at: SKIP, uniqueness_token: SKIP, subscription_id: SKIP, subscription_reference: SKIP, additional_properties: {}) @timestamp = unless == SKIP @id = id unless id == SKIP @created_at = created_at unless created_at == SKIP @uniqueness_token = uniqueness_token unless uniqueness_token == SKIP @subscription_id = subscription_id unless subscription_id == SKIP @subscription_reference = subscription_reference unless subscription_reference == SKIP # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end end |
Instance Attribute Details
#created_at ⇒ DateTime
An ISO-8601 timestamp, set by Chargify at the time each event is recorded. Please note that this field is reserved. If ‘chargify.created_at` is present in the request payload, it will be overwritten.
28 29 30 |
# File 'lib/advanced_billing/models/chargify_ebb.rb', line 28 def created_at @created_at end |
#id ⇒ String
A unique ID set by Chargify. Please note that this field is reserved. If ‘chargify.id` is present in the request payload, it will be overwritten.
22 23 24 |
# File 'lib/advanced_billing/models/chargify_ebb.rb', line 22 def id @id end |
#subscription_id ⇒ Integer
Id of Maxio Advanced Billing Subscription which is connected to this event. Provide ‘subscription_id` if you configured `chargify.subscription_id` as Subscription Identifier in your Event Stream.
40 41 42 |
# File 'lib/advanced_billing/models/chargify_ebb.rb', line 40 def subscription_id @subscription_id end |
#subscription_reference ⇒ String
Reference of Maxio Advanced Billing Subscription which is connected to this event. Provide ‘subscription_reference` if you configured `chargify.subscription_reference` as Subscription Identifier in your Event Stream.
48 49 50 |
# File 'lib/advanced_billing/models/chargify_ebb.rb', line 48 def subscription_reference @subscription_reference end |
#timestamp ⇒ DateTime
This timestamp determines what billing period the event will be billed in. If your request payload does not include it, Chargify will add ‘chargify.timestamp` to the event payload and set the value to `now`.
17 18 19 |
# File 'lib/advanced_billing/models/chargify_ebb.rb', line 17 def @timestamp end |
#uniqueness_token ⇒ String
User-defined string scoped per-stream. Duplicate events within a stream will be silently ignored. Tokens expire after 31 days.
33 34 35 |
# File 'lib/advanced_billing/models/chargify_ebb.rb', line 33 def uniqueness_token @uniqueness_token end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
96 97 98 99 100 101 102 103 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 |
# File 'lib/advanced_billing/models/chargify_ebb.rb', line 96 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. = if hash.key?('timestamp') (DateTimeHelper.from_rfc3339(hash['timestamp']) if hash['timestamp']) else SKIP end id = hash.key?('id') ? hash['id'] : SKIP created_at = if hash.key?('created_at') (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at']) else SKIP end uniqueness_token = hash.key?('uniqueness_token') ? hash['uniqueness_token'] : SKIP subscription_id = hash.key?('subscription_id') ? hash['subscription_id'] : SKIP subscription_reference = hash.key?('subscription_reference') ? hash['subscription_reference'] : SKIP # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. ChargifyEBB.new(timestamp: , id: id, created_at: created_at, uniqueness_token: uniqueness_token, subscription_id: subscription_id, subscription_reference: subscription_reference, additional_properties: hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/advanced_billing/models/chargify_ebb.rb', line 51 def self.names @_hash = {} if @_hash.nil? @_hash['timestamp'] = 'timestamp' @_hash['id'] = 'id' @_hash['created_at'] = 'created_at' @_hash['uniqueness_token'] = 'uniqueness_token' @_hash['subscription_id'] = 'subscription_id' @_hash['subscription_reference'] = 'subscription_reference' @_hash end |
.nullables ⇒ Object
An array for nullable fields
75 76 77 |
# File 'lib/advanced_billing/models/chargify_ebb.rb', line 75 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/advanced_billing/models/chargify_ebb.rb', line 63 def self.optionals %w[ timestamp id created_at uniqueness_token subscription_id subscription_reference ] end |
Instance Method Details
#to_custom_created_at ⇒ Object
135 136 137 |
# File 'lib/advanced_billing/models/chargify_ebb.rb', line 135 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |
#to_custom_timestamp ⇒ Object
131 132 133 |
# File 'lib/advanced_billing/models/chargify_ebb.rb', line 131 def DateTimeHelper.to_rfc3339() end |