Class: AdvancedBilling::MRR

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

Overview

MRR Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

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_formattedString

TODO: Write general description for this method

Returns:

  • (String)


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

def amount_formatted
  @amount_formatted
end

#amount_in_centsInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def amount_in_cents
  @amount_in_cents
end

#at_timeString

ISO8601 timestamp

Returns:

  • (String)


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

def at_time
  @at_time
end

#breakoutsBreakouts

TODO: Write general description for this method

Returns:



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

def breakouts
  @breakouts
end

#currencyString

TODO: Write general description for this method

Returns:

  • (String)


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

def currency
  @currency
end

#currency_symbolString

TODO: Write general description for this method

Returns:

  • (String)


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

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

.nullablesObject

An array for nullable fields



61
62
63
# File 'lib/advanced_billing/models/mrr.rb', line 61

def self.nullables
  []
end

.optionalsObject

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