Class: AdvancedBilling::MRR
- Defined in:
- lib/advanced_billing/models/mrr.rb
Overview
MRR Model.
Instance Attribute Summary collapse
-
#amount_formatted ⇒ String
TODO: Write general description for this method.
-
#amount_in_cents ⇒ Integer
TODO: Write general description for this method.
-
#at_time ⇒ String
ISO8601 timestamp.
-
#breakouts ⇒ Breakouts
TODO: Write general description for this method.
-
#currency ⇒ String
TODO: Write general description for this method.
-
#currency_symbol ⇒ String
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.
Instance Method Summary collapse
-
#initialize(amount_in_cents = SKIP, amount_formatted = SKIP, currency = SKIP, currency_symbol = SKIP, breakouts = SKIP, at_time = SKIP) ⇒ MRR
constructor
A new instance of MRR.
Methods inherited from BaseModel
Constructor Details
#initialize(amount_in_cents = SKIP, amount_formatted = SKIP, currency = SKIP, currency_symbol = SKIP, breakouts = SKIP, at_time = SKIP) ⇒ MRR
Returns a new instance of MRR.
65 66 67 68 69 70 71 72 73 74 |
# File 'lib/advanced_billing/models/mrr.rb', line 65 def initialize(amount_in_cents = SKIP, amount_formatted = SKIP, currency = SKIP, currency_symbol = SKIP, breakouts = SKIP, at_time = SKIP) @amount_in_cents = amount_in_cents unless amount_in_cents == SKIP @amount_formatted = amount_formatted unless amount_formatted == SKIP @currency = currency unless currency == SKIP @currency_symbol = currency_symbol unless currency_symbol == SKIP @breakouts = breakouts unless breakouts == SKIP @at_time = at_time unless at_time == SKIP end |
Instance Attribute Details
#amount_formatted ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/mrr.rb', line 18 def amount_formatted @amount_formatted end |
#amount_in_cents ⇒ Integer
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/mrr.rb', line 14 def amount_in_cents @amount_in_cents end |
#at_time ⇒ String
ISO8601 timestamp
34 35 36 |
# File 'lib/advanced_billing/models/mrr.rb', line 34 def at_time @at_time end |
#breakouts ⇒ Breakouts
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/mrr.rb', line 30 def breakouts @breakouts end |
#currency ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/mrr.rb', line 22 def currency @currency end |
#currency_symbol ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/mrr.rb', line 26 def currency_symbol @currency_symbol end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/advanced_billing/models/mrr.rb', line 77 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. amount_in_cents = hash.key?('amount_in_cents') ? hash['amount_in_cents'] : SKIP amount_formatted = hash.key?('amount_formatted') ? hash['amount_formatted'] : SKIP currency = hash.key?('currency') ? hash['currency'] : SKIP currency_symbol = hash.key?('currency_symbol') ? hash['currency_symbol'] : SKIP breakouts = Breakouts.from_hash(hash['breakouts']) if hash['breakouts'] at_time = hash.key?('at_time') ? hash['at_time'] : SKIP # Create object from extracted values. MRR.new(amount_in_cents, amount_formatted, currency, currency_symbol, breakouts, at_time) 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/mrr.rb', line 37 def self.names @_hash = {} if @_hash.nil? @_hash['amount_in_cents'] = 'amount_in_cents' @_hash['amount_formatted'] = 'amount_formatted' @_hash['currency'] = 'currency' @_hash['currency_symbol'] = 'currency_symbol' @_hash['breakouts'] = 'breakouts' @_hash['at_time'] = 'at_time' @_hash end |
.nullables ⇒ Object
An array for nullable fields
61 62 63 |
# File 'lib/advanced_billing/models/mrr.rb', line 61 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/advanced_billing/models/mrr.rb', line 49 def self.optionals %w[ amount_in_cents amount_formatted currency currency_symbol breakouts at_time ] end |