Class: AdvancedBilling::DunnerData
- Defined in:
- lib/advanced_billing/models/dunner_data.rb
Overview
DunnerData Model.
Instance Attribute Summary collapse
-
#attempts ⇒ Integer
TODO: Write general description for this method.
-
#created_at ⇒ String
TODO: Write general description for this method.
-
#last_attempted_at ⇒ String
TODO: Write general description for this method.
-
#revenue_at_risk_in_cents ⇒ Integer
TODO: Write general description for this method.
-
#state ⇒ String
TODO: Write general description for this method.
-
#subscription_id ⇒ Integer
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(state = nil, subscription_id = nil, revenue_at_risk_in_cents = nil, created_at = nil, attempts = nil, last_attempted_at = nil) ⇒ DunnerData
constructor
A new instance of DunnerData.
Methods inherited from BaseModel
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 |
# 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
#attempts ⇒ Integer
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/dunner_data.rb', line 30 def attempts @attempts end |
#created_at ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/dunner_data.rb', line 26 def created_at @created_at end |
#last_attempted_at ⇒ String
TODO: Write general description for this method
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_cents ⇒ Integer
TODO: Write general description for this method
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 |
#state ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/dunner_data.rb', line 14 def state @state end |
#subscription_id ⇒ Integer
TODO: Write general description for this method
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.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/advanced_billing/models/dunner_data.rb', line 70 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 |
.names ⇒ Object
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 |
.nullables ⇒ Object
An array for nullable fields
54 55 56 |
# File 'lib/advanced_billing/models/dunner_data.rb', line 54 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
49 50 51 |
# File 'lib/advanced_billing/models/dunner_data.rb', line 49 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
95 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/dunner_data.rb', line 95 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.state, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.subscription_id, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.revenue_at_risk_in_cents, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.created_at, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.attempts, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.last_attempted_at, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['state'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['subscription_id'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['revenue_at_risk_in_cents'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['created_at'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['attempts'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['last_attempted_at'], ->(val) { val.instance_of? String }) ) end |