Class: AdvancedBilling::ListMRRResponseResult

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

Overview

ListMRRResponseResult Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(page: SKIP, per_page: SKIP, total_pages: SKIP, total_entries: SKIP, currency: SKIP, currency_symbol: SKIP, movements: SKIP, additional_properties: {}) ⇒ ListMRRResponseResult

Returns a new instance of ListMRRResponseResult.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/advanced_billing/models/list_mrr_response_result.rb', line 71

def initialize(page: SKIP, per_page: SKIP, total_pages: SKIP,
               total_entries: SKIP, currency: SKIP, currency_symbol: SKIP,
               movements: SKIP, additional_properties: {})
  # Add additional model properties to the instance.
  additional_properties.each do |_name, _value|
    instance_variable_set("@#{_name}", _value)
  end

  @page = page unless page == SKIP
  @per_page = per_page unless per_page == SKIP
  @total_pages = total_pages unless total_pages == SKIP
  @total_entries = total_entries unless total_entries == SKIP
  @currency = currency unless currency == SKIP
  @currency_symbol = currency_symbol unless currency_symbol == SKIP
  @movements = movements unless movements == SKIP
end

Instance Attribute Details

#currencyString

TODO: Write general description for this method

Returns:

  • (String)


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

def currency
  @currency
end

#currency_symbolString

TODO: Write general description for this method

Returns:

  • (String)


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

def currency_symbol
  @currency_symbol
end

#movementsArray[Movement]

TODO: Write general description for this method

Returns:



38
39
40
# File 'lib/advanced_billing/models/list_mrr_response_result.rb', line 38

def movements
  @movements
end

#pageInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def page
  @page
end

#per_pageInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def per_page
  @per_page
end

#total_entriesInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def total_entries
  @total_entries
end

#total_pagesInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def total_pages
  @total_pages
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



89
90
91
92
93
94
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
# File 'lib/advanced_billing/models/list_mrr_response_result.rb', line 89

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  page = hash.key?('page') ? hash['page'] : SKIP
  per_page = hash.key?('per_page') ? hash['per_page'] : SKIP
  total_pages = hash.key?('total_pages') ? hash['total_pages'] : SKIP
  total_entries = hash.key?('total_entries') ? hash['total_entries'] : SKIP
  currency = hash.key?('currency') ? hash['currency'] : SKIP
  currency_symbol =
    hash.key?('currency_symbol') ? hash['currency_symbol'] : SKIP
  # Parameter is an array, so we need to iterate through it
  movements = nil
  unless hash['movements'].nil?
    movements = []
    hash['movements'].each do |structure|
      movements << (Movement.from_hash(structure) if structure)
    end
  end

  movements = SKIP unless hash.key?('movements')

  # Clean out expected properties from Hash.
  additional_properties = hash.reject { |k, _| names.value?(k) }

  # Create object from extracted values.
  ListMRRResponseResult.new(page: page,
                            per_page: per_page,
                            total_pages: total_pages,
                            total_entries: total_entries,
                            currency: currency,
                            currency_symbol: currency_symbol,
                            movements: movements,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/advanced_billing/models/list_mrr_response_result.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['page'] = 'page'
  @_hash['per_page'] = 'per_page'
  @_hash['total_pages'] = 'total_pages'
  @_hash['total_entries'] = 'total_entries'
  @_hash['currency'] = 'currency'
  @_hash['currency_symbol'] = 'currency_symbol'
  @_hash['movements'] = 'movements'
  @_hash
end

.nullablesObject

An array for nullable fields



67
68
69
# File 'lib/advanced_billing/models/list_mrr_response_result.rb', line 67

def self.nullables
  []
end

.optionalsObject

An array for optional fields



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/advanced_billing/models/list_mrr_response_result.rb', line 54

def self.optionals
  %w[
    page
    per_page
    total_pages
    total_entries
    currency
    currency_symbol
    movements
  ]
end