Class: AdvancedBilling::ListSaleRepItem

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

Overview

ListSaleRepItem Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(id: SKIP, full_name: SKIP, subscriptions_count: SKIP, mrr_data: SKIP, test_mode: SKIP, additional_properties: {}) ⇒ ListSaleRepItem

Returns a new instance of ListSaleRepItem.



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/advanced_billing/models/list_sale_rep_item.rb', line 59

def initialize(id: SKIP, full_name: SKIP, subscriptions_count: SKIP,
               mrr_data: SKIP, test_mode: SKIP, additional_properties: {})
  @id = id unless id == SKIP
  @full_name = full_name unless full_name == SKIP
  @subscriptions_count = subscriptions_count unless subscriptions_count == SKIP
  @mrr_data = mrr_data unless mrr_data == SKIP
  @test_mode = test_mode unless test_mode == SKIP

  # Add additional model properties to the instance.
  additional_properties.each do |_name, _value|
    instance_variable_set("@#{_name}", _value)
  end
end

Instance Attribute Details

#full_nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def full_name
  @full_name
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def id
  @id
end

#mrr_dataHash[String, SaleRepItemMrr]

TODO: Write general description for this method

Returns:



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

def mrr_data
  @mrr_data
end

#subscriptions_countInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def subscriptions_count
  @subscriptions_count
end

#test_modeTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def test_mode
  @test_mode
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/advanced_billing/models/list_sale_rep_item.rb', line 74

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  full_name = hash.key?('full_name') ? hash['full_name'] : SKIP
  subscriptions_count =
    hash.key?('subscriptions_count') ? hash['subscriptions_count'] : SKIP
  mrr_data = SaleRepItemMrr.from_hash(hash['mrr_data']) if hash['mrr_data']

  mrr_data = SKIP unless hash.key?('mrr_data')
  test_mode = hash.key?('test_mode') ? hash['test_mode'] : SKIP

  # Clean out expected properties from Hash.
  names.each_value { |k| hash.delete(k) }

  # Create object from extracted values.
  ListSaleRepItem.new(id: id,
                      full_name: full_name,
                      subscriptions_count: subscriptions_count,
                      mrr_data: mrr_data,
                      test_mode: test_mode,
                      additional_properties: hash)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
41
# File 'lib/advanced_billing/models/list_sale_rep_item.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['full_name'] = 'full_name'
  @_hash['subscriptions_count'] = 'subscriptions_count'
  @_hash['mrr_data'] = 'mrr_data'
  @_hash['test_mode'] = 'test_mode'
  @_hash
end

.nullablesObject

An array for nullable fields



55
56
57
# File 'lib/advanced_billing/models/list_sale_rep_item.rb', line 55

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
50
51
52
# File 'lib/advanced_billing/models/list_sale_rep_item.rb', line 44

def self.optionals
  %w[
    id
    full_name
    subscriptions_count
    mrr_data
    test_mode
  ]
end