Class: AdvancedBilling::SaleRepSettings

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

Overview

SaleRepSettings Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(customer_name: SKIP, subscription_id: SKIP, site_link: SKIP, site_name: SKIP, subscription_mrr: SKIP, sales_rep_id: SKIP, sales_rep_name: SKIP, additional_properties: {}) ⇒ SaleRepSettings

Returns a new instance of SaleRepSettings.



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

def initialize(customer_name: SKIP, subscription_id: SKIP, site_link: SKIP,
               site_name: SKIP, subscription_mrr: SKIP, sales_rep_id: SKIP,
               sales_rep_name: SKIP, additional_properties: {})
  @customer_name = customer_name unless customer_name == SKIP
  @subscription_id = subscription_id unless subscription_id == SKIP
  @site_link = site_link unless site_link == SKIP
  @site_name = site_name unless site_name == SKIP
  @subscription_mrr = subscription_mrr unless subscription_mrr == SKIP
  @sales_rep_id = sales_rep_id unless sales_rep_id == SKIP
  @sales_rep_name = sales_rep_name unless sales_rep_name == SKIP

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

Instance Attribute Details

#customer_nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def customer_name
  @customer_name
end

#sales_rep_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def sales_rep_id
  @sales_rep_id
end

#sales_rep_nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def sales_rep_name
  @sales_rep_name
end

TODO: Write general description for this method

Returns:

  • (String)


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

def site_link
  @site_link
end

#site_nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def site_name
  @site_name
end

#subscription_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def subscription_id
  @subscription_id
end

#subscription_mrrString

TODO: Write general description for this method

Returns:

  • (String)


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

def subscription_mrr
  @subscription_mrr
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
# File 'lib/advanced_billing/models/sale_rep_settings.rb', line 89

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  customer_name = hash.key?('customer_name') ? hash['customer_name'] : SKIP
  subscription_id =
    hash.key?('subscription_id') ? hash['subscription_id'] : SKIP
  site_link = hash.key?('site_link') ? hash['site_link'] : SKIP
  site_name = hash.key?('site_name') ? hash['site_name'] : SKIP
  subscription_mrr =
    hash.key?('subscription_mrr') ? hash['subscription_mrr'] : SKIP
  sales_rep_id = hash.key?('sales_rep_id') ? hash['sales_rep_id'] : SKIP
  sales_rep_name =
    hash.key?('sales_rep_name') ? hash['sales_rep_name'] : SKIP

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

  # Create object from extracted values.
  SaleRepSettings.new(customer_name: customer_name,
                      subscription_id: subscription_id,
                      site_link: site_link,
                      site_name: site_name,
                      subscription_mrr: subscription_mrr,
                      sales_rep_id: sales_rep_id,
                      sales_rep_name: sales_rep_name,
                      additional_properties: hash)
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/sale_rep_settings.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['customer_name'] = 'customer_name'
  @_hash['subscription_id'] = 'subscription_id'
  @_hash['site_link'] = 'site_link'
  @_hash['site_name'] = 'site_name'
  @_hash['subscription_mrr'] = 'subscription_mrr'
  @_hash['sales_rep_id'] = 'sales_rep_id'
  @_hash['sales_rep_name'] = 'sales_rep_name'
  @_hash
end

.nullablesObject

An array for nullable fields



67
68
69
# File 'lib/advanced_billing/models/sale_rep_settings.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/sale_rep_settings.rb', line 54

def self.optionals
  %w[
    customer_name
    subscription_id
    site_link
    site_name
    subscription_mrr
    sales_rep_id
    sales_rep_name
  ]
end