Class: AdvancedBilling::DunnerData

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

Overview

DunnerData Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(state = nil, subscription_id = nil, revenue_at_risk_in_cents = nil, created_at = nil, attempts = nil, last_attempted_at = nil) ⇒ DunnerData

Returns a new instance of DunnerData.



58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/advanced_billing/models/dunner_data.rb', line 58

def initialize(state = nil,
               subscription_id = nil,
               revenue_at_risk_in_cents = nil,
               created_at = nil,
               attempts = nil,
               last_attempted_at = nil)
  @state = state
  @subscription_id = subscription_id
  @revenue_at_risk_in_cents = revenue_at_risk_in_cents
  @created_at = created_at
  @attempts = attempts
  @last_attempted_at = last_attempted_at
end

Instance Attribute Details

#attemptsInteger

TODO: Write general description for this method

Returns:

  • (Integer)


30
31
32
# File 'lib/advanced_billing/models/dunner_data.rb', line 30

def attempts
  @attempts
end

#created_atString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/advanced_billing/models/dunner_data.rb', line 26

def created_at
  @created_at
end

#last_attempted_atString

TODO: Write general description for this method

Returns:

  • (String)


34
35
36
# File 'lib/advanced_billing/models/dunner_data.rb', line 34

def last_attempted_at
  @last_attempted_at
end

#revenue_at_risk_in_centsInteger

TODO: Write general description for this method

Returns:

  • (Integer)


22
23
24
# File 'lib/advanced_billing/models/dunner_data.rb', line 22

def revenue_at_risk_in_cents
  @revenue_at_risk_in_cents
end

#stateString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/advanced_billing/models/dunner_data.rb', line 14

def state
  @state
end

#subscription_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


18
19
20
# File 'lib/advanced_billing/models/dunner_data.rb', line 18

def subscription_id
  @subscription_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/advanced_billing/models/dunner_data.rb', line 73

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  state = hash.key?('state') ? hash['state'] : nil
  subscription_id =
    hash.key?('subscription_id') ? hash['subscription_id'] : nil
  revenue_at_risk_in_cents =
    hash.key?('revenue_at_risk_in_cents') ? hash['revenue_at_risk_in_cents'] : nil
  created_at = hash.key?('created_at') ? hash['created_at'] : nil
  attempts = hash.key?('attempts') ? hash['attempts'] : nil
  last_attempted_at =
    hash.key?('last_attempted_at') ? hash['last_attempted_at'] : nil

  # Create object from extracted values.
  DunnerData.new(state,
                 subscription_id,
                 revenue_at_risk_in_cents,
                 created_at,
                 attempts,
                 last_attempted_at)
end

.namesObject

A mapping from model property names to API property names.



37
38
39
40
41
42
43
44
45
46
# File 'lib/advanced_billing/models/dunner_data.rb', line 37

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['state'] = 'state'
  @_hash['subscription_id'] = 'subscription_id'
  @_hash['revenue_at_risk_in_cents'] = 'revenue_at_risk_in_cents'
  @_hash['created_at'] = 'created_at'
  @_hash['attempts'] = 'attempts'
  @_hash['last_attempted_at'] = 'last_attempted_at'
  @_hash
end

.nullablesObject

An array for nullable fields



54
55
56
# File 'lib/advanced_billing/models/dunner_data.rb', line 54

def self.nullables
  []
end

.optionalsObject

An array for optional fields



49
50
51
# File 'lib/advanced_billing/models/dunner_data.rb', line 49

def self.optionals
  []
end