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 ⇒ DateTime
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, additional_properties: {}) ⇒ MRR
constructor
A new instance of MRR.
- #to_custom_at_time ⇒ Object
Methods inherited from BaseModel
Constructor Details
#initialize(amount_in_cents: SKIP, amount_formatted: SKIP, currency: SKIP, currency_symbol: SKIP, breakouts: SKIP, at_time: SKIP, additional_properties: {}) ⇒ MRR
Returns a new instance of MRR.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/advanced_billing/models/mrr.rb', line 66 def initialize(amount_in_cents: SKIP, amount_formatted: SKIP, currency: SKIP, currency_symbol: SKIP, breakouts: SKIP, at_time: SKIP, additional_properties: {}) @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 # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end end |
Instance Attribute Details
#amount_formatted ⇒ String
TODO: Write general description for this method
19 20 21 |
# File 'lib/advanced_billing/models/mrr.rb', line 19 def amount_formatted @amount_formatted end |
#amount_in_cents ⇒ Integer
TODO: Write general description for this method
15 16 17 |
# File 'lib/advanced_billing/models/mrr.rb', line 15 def amount_in_cents @amount_in_cents end |
#at_time ⇒ DateTime
ISO8601 timestamp
35 36 37 |
# File 'lib/advanced_billing/models/mrr.rb', line 35 def at_time @at_time end |
#breakouts ⇒ Breakouts
TODO: Write general description for this method
31 32 33 |
# File 'lib/advanced_billing/models/mrr.rb', line 31 def breakouts @breakouts end |
#currency ⇒ String
TODO: Write general description for this method
23 24 25 |
# File 'lib/advanced_billing/models/mrr.rb', line 23 def currency @currency end |
#currency_symbol ⇒ String
TODO: Write general description for this method
27 28 29 |
# File 'lib/advanced_billing/models/mrr.rb', line 27 def currency_symbol @currency_symbol end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/advanced_billing/models/mrr.rb', line 83 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 = if hash.key?('at_time') (DateTimeHelper.from_rfc3339(hash['at_time']) if hash['at_time']) else SKIP end # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. MRR.new(amount_in_cents: amount_in_cents, amount_formatted: amount_formatted, currency: currency, currency_symbol: currency_symbol, breakouts: breakouts, at_time: at_time, additional_properties: hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/advanced_billing/models/mrr.rb', line 38 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
62 63 64 |
# File 'lib/advanced_billing/models/mrr.rb', line 62 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/advanced_billing/models/mrr.rb', line 50 def self.optionals %w[ amount_in_cents amount_formatted currency currency_symbol breakouts at_time ] end |
Instance Method Details
#to_custom_at_time ⇒ Object
114 115 116 |
# File 'lib/advanced_billing/models/mrr.rb', line 114 def to_custom_at_time DateTimeHelper.to_rfc3339(at_time) end |