Class: AdvancedBilling::ChargifyEBB

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/advanced_billing/models/chargify_ebb.rb

Overview

ChargifyEBB Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(timestamp = SKIP, id = SKIP, created_at = SKIP, uniqueness_token = SKIP, subscription_id = SKIP, subscription_reference = SKIP) ⇒ ChargifyEBB

Returns a new instance of ChargifyEBB.



78
79
80
81
82
83
84
85
86
87
# File 'lib/advanced_billing/models/chargify_ebb.rb', line 78

def initialize(timestamp = SKIP, id = SKIP, created_at = SKIP,
               uniqueness_token = SKIP, subscription_id = SKIP,
               subscription_reference = SKIP)
  @timestamp = timestamp unless timestamp == 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
end

Instance Attribute Details

#created_atString

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.

Returns:

  • (String)


27
28
29
# File 'lib/advanced_billing/models/chargify_ebb.rb', line 27

def created_at
  @created_at
end

#idString

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.

Returns:

  • (String)


21
22
23
# File 'lib/advanced_billing/models/chargify_ebb.rb', line 21

def id
  @id
end

#subscription_idInteger

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.

Returns:

  • (Integer)


39
40
41
# File 'lib/advanced_billing/models/chargify_ebb.rb', line 39

def subscription_id
  @subscription_id
end

#subscription_referenceString

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.

Returns:

  • (String)


47
48
49
# File 'lib/advanced_billing/models/chargify_ebb.rb', line 47

def subscription_reference
  @subscription_reference
end

#timestampString

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`.

Returns:

  • (String)


16
17
18
# File 'lib/advanced_billing/models/chargify_ebb.rb', line 16

def timestamp
  @timestamp
end

#uniqueness_tokenString

User-defined string scoped per-stream. Duplicate events within a stream will be silently ignored. Tokens expire after 31 days.

Returns:

  • (String)


32
33
34
# File 'lib/advanced_billing/models/chargify_ebb.rb', line 32

def uniqueness_token
  @uniqueness_token
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/advanced_billing/models/chargify_ebb.rb', line 90

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  created_at = hash.key?('created_at') ? hash['created_at'] : SKIP
  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

  # Create object from extracted values.
  ChargifyEBB.new(timestamp,
                  id,
                  created_at,
                  uniqueness_token,
                  subscription_id,
                  subscription_reference)
end

.namesObject

A mapping from model property names to API property names.



50
51
52
53
54
55
56
57
58
59
# File 'lib/advanced_billing/models/chargify_ebb.rb', line 50

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

.nullablesObject

An array for nullable fields



74
75
76
# File 'lib/advanced_billing/models/chargify_ebb.rb', line 74

def self.nullables
  []
end

.optionalsObject

An array for optional fields



62
63
64
65
66
67
68
69
70
71
# File 'lib/advanced_billing/models/chargify_ebb.rb', line 62

def self.optionals
  %w[
    timestamp
    id
    created_at
    uniqueness_token
    subscription_id
    subscription_reference
  ]
end