Class: AdvancedBilling::Site

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

Overview

Site Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

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

Constructor Details

#initialize(id: SKIP, name: SKIP, subdomain: SKIP, currency: SKIP, seller_id: SKIP, non_primary_currencies: SKIP, relationship_invoicing_enabled: SKIP, schedule_subscription_cancellation_enabled: SKIP, customer_hierarchy_enabled: SKIP, whopays_enabled: SKIP, whopays_default_payer: SKIP, allocation_settings: SKIP, default_payment_collection_method: SKIP, organization_address: SKIP, tax_configuration: SKIP, net_terms: SKIP, multi_frequency_enabled: SKIP, auto_renewals_enabled: SKIP, portal_enabled: SKIP, test: SKIP, additional_properties: {}) ⇒ Site

Returns a new instance of Site.



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/advanced_billing/models/site.rb', line 153

def initialize(id: SKIP, name: SKIP, subdomain: SKIP, currency: SKIP,
               seller_id: SKIP, non_primary_currencies: SKIP,
               relationship_invoicing_enabled: SKIP,
               schedule_subscription_cancellation_enabled: SKIP,
               customer_hierarchy_enabled: SKIP, whopays_enabled: SKIP,
               whopays_default_payer: SKIP, allocation_settings: SKIP,
               default_payment_collection_method: SKIP,
               organization_address: SKIP, tax_configuration: SKIP,
               net_terms: SKIP, multi_frequency_enabled: SKIP,
               auto_renewals_enabled: SKIP, portal_enabled: SKIP,
               test: SKIP, additional_properties: {})
  # Add additional model properties to the instance.
  additional_properties.each do |_name, _value|
    instance_variable_set("@#{_name}", _value)
  end

  @id = id unless id == SKIP
  @name = name unless name == SKIP
  @subdomain = subdomain unless subdomain == SKIP
  @currency = currency unless currency == SKIP
  @seller_id = seller_id unless seller_id == SKIP
  @non_primary_currencies = non_primary_currencies unless non_primary_currencies == SKIP
  unless relationship_invoicing_enabled == SKIP
    @relationship_invoicing_enabled =
      relationship_invoicing_enabled
  end
  unless schedule_subscription_cancellation_enabled == SKIP
    @schedule_subscription_cancellation_enabled =
      schedule_subscription_cancellation_enabled
  end
  unless customer_hierarchy_enabled == SKIP
    @customer_hierarchy_enabled =
      customer_hierarchy_enabled
  end
  @whopays_enabled = whopays_enabled unless whopays_enabled == SKIP
  @whopays_default_payer = whopays_default_payer unless whopays_default_payer == SKIP
  @allocation_settings = allocation_settings unless allocation_settings == SKIP
  unless default_payment_collection_method == SKIP
    @default_payment_collection_method =
      default_payment_collection_method
  end
  @organization_address = organization_address unless organization_address == SKIP
  @tax_configuration = tax_configuration unless tax_configuration == SKIP
  @net_terms = net_terms unless net_terms == SKIP
  @multi_frequency_enabled = multi_frequency_enabled unless multi_frequency_enabled == SKIP
  @auto_renewals_enabled = auto_renewals_enabled unless auto_renewals_enabled == SKIP
  @portal_enabled = portal_enabled unless portal_enabled == SKIP
  @test = test unless test == SKIP
end

Instance Attribute Details

#allocation_settingsAllocationSettings

TODO: Write general description for this method

Returns:



58
59
60
# File 'lib/advanced_billing/models/site.rb', line 58

def allocation_settings
  @allocation_settings
end

#auto_renewals_enabledTrueClass | FalseClass

Whether the auto-renewals feature is enabled for this site.

Returns:

  • (TrueClass | FalseClass)


83
84
85
# File 'lib/advanced_billing/models/site.rb', line 83

def auto_renewals_enabled
  @auto_renewals_enabled
end

#currencyString

TODO: Write general description for this method

Returns:

  • (String)


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

def currency
  @currency
end

#customer_hierarchy_enabledTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


46
47
48
# File 'lib/advanced_billing/models/site.rb', line 46

def customer_hierarchy_enabled
  @customer_hierarchy_enabled
end

#default_payment_collection_methodString

TODO: Write general description for this method

Returns:

  • (String)


62
63
64
# File 'lib/advanced_billing/models/site.rb', line 62

def default_payment_collection_method
  @default_payment_collection_method
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def id
  @id
end

#multi_frequency_enabledTrueClass | FalseClass

Whether the site has the multi-frequency billing feature enabled. Only present when relationship invoicing is active.

Returns:

  • (TrueClass | FalseClass)


79
80
81
# File 'lib/advanced_billing/models/site.rb', line 79

def multi_frequency_enabled
  @multi_frequency_enabled
end

#nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def name
  @name
end

#net_termsNetTerms

TODO: Write general description for this method

Returns:



74
75
76
# File 'lib/advanced_billing/models/site.rb', line 74

def net_terms
  @net_terms
end

#non_primary_currenciesArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def non_primary_currencies
  @non_primary_currencies
end

#organization_addressOrganizationAddress

TODO: Write general description for this method

Returns:



66
67
68
# File 'lib/advanced_billing/models/site.rb', line 66

def organization_address
  @organization_address
end

#portal_enabledTrueClass | FalseClass

Whether the Billing Portal is enabled for this site.

Returns:

  • (TrueClass | FalseClass)


87
88
89
# File 'lib/advanced_billing/models/site.rb', line 87

def portal_enabled
  @portal_enabled
end

#relationship_invoicing_enabledTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def relationship_invoicing_enabled
  @relationship_invoicing_enabled
end

#schedule_subscription_cancellation_enabledTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


42
43
44
# File 'lib/advanced_billing/models/site.rb', line 42

def schedule_subscription_cancellation_enabled
  @schedule_subscription_cancellation_enabled
end

#seller_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def seller_id
  @seller_id
end

#subdomainString

TODO: Write general description for this method

Returns:

  • (String)


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

def subdomain
  @subdomain
end

#tax_configurationTaxConfiguration

TODO: Write general description for this method

Returns:



70
71
72
# File 'lib/advanced_billing/models/site.rb', line 70

def tax_configuration
  @tax_configuration
end

#testTrueClass | FalseClass

Whether the Billing Portal is enabled for this site.

Returns:

  • (TrueClass | FalseClass)


91
92
93
# File 'lib/advanced_billing/models/site.rb', line 91

def test
  @test
end

#whopays_default_payerString

TODO: Write general description for this method

Returns:

  • (String)


54
55
56
# File 'lib/advanced_billing/models/site.rb', line 54

def whopays_default_payer
  @whopays_default_payer
end

#whopays_enabledTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


50
51
52
# File 'lib/advanced_billing/models/site.rb', line 50

def whopays_enabled
  @whopays_enabled
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/advanced_billing/models/site.rb', line 204

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  subdomain = hash.key?('subdomain') ? hash['subdomain'] : SKIP
  currency = hash.key?('currency') ? hash['currency'] : SKIP
  seller_id = hash.key?('seller_id') ? hash['seller_id'] : SKIP
  non_primary_currencies =
    hash.key?('non_primary_currencies') ? hash['non_primary_currencies'] : SKIP
  relationship_invoicing_enabled =
    hash.key?('relationship_invoicing_enabled') ? hash['relationship_invoicing_enabled'] : SKIP
  schedule_subscription_cancellation_enabled =
    hash.key?('schedule_subscription_cancellation_enabled') ? hash['schedule_subscription_cancellation_enabled'] : SKIP
  customer_hierarchy_enabled =
    hash.key?('customer_hierarchy_enabled') ? hash['customer_hierarchy_enabled'] : SKIP
  whopays_enabled =
    hash.key?('whopays_enabled') ? hash['whopays_enabled'] : SKIP
  whopays_default_payer =
    hash.key?('whopays_default_payer') ? hash['whopays_default_payer'] : SKIP
  allocation_settings = AllocationSettings.from_hash(hash['allocation_settings']) if
    hash['allocation_settings']
  default_payment_collection_method =
    hash.key?('default_payment_collection_method') ? hash['default_payment_collection_method'] : SKIP
  organization_address = OrganizationAddress.from_hash(hash['organization_address']) if
    hash['organization_address']
  tax_configuration = TaxConfiguration.from_hash(hash['tax_configuration']) if
    hash['tax_configuration']
  net_terms = NetTerms.from_hash(hash['net_terms']) if hash['net_terms']
  multi_frequency_enabled =
    hash.key?('multi_frequency_enabled') ? hash['multi_frequency_enabled'] : SKIP
  auto_renewals_enabled =
    hash.key?('auto_renewals_enabled') ? hash['auto_renewals_enabled'] : SKIP
  portal_enabled =
    hash.key?('portal_enabled') ? hash['portal_enabled'] : SKIP
  test = hash.key?('test') ? hash['test'] : SKIP

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

  # Create object from extracted values.
  Site.new(id: id,
           name: name,
           subdomain: subdomain,
           currency: currency,
           seller_id: seller_id,
           non_primary_currencies: non_primary_currencies,
           relationship_invoicing_enabled: relationship_invoicing_enabled,
           schedule_subscription_cancellation_enabled: schedule_subscription_cancellation_enabled,
           customer_hierarchy_enabled: customer_hierarchy_enabled,
           whopays_enabled: whopays_enabled,
           whopays_default_payer: whopays_default_payer,
           allocation_settings: allocation_settings,
           default_payment_collection_method: default_payment_collection_method,
           organization_address: organization_address,
           tax_configuration: tax_configuration,
           net_terms: net_terms,
           multi_frequency_enabled: multi_frequency_enabled,
           auto_renewals_enabled: auto_renewals_enabled,
           portal_enabled: portal_enabled,
           test: test,
           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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
# File 'lib/advanced_billing/models/site.rb', line 94

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['name'] = 'name'
  @_hash['subdomain'] = 'subdomain'
  @_hash['currency'] = 'currency'
  @_hash['seller_id'] = 'seller_id'
  @_hash['non_primary_currencies'] = 'non_primary_currencies'
  @_hash['relationship_invoicing_enabled'] =
    'relationship_invoicing_enabled'
  @_hash['schedule_subscription_cancellation_enabled'] =
    'schedule_subscription_cancellation_enabled'
  @_hash['customer_hierarchy_enabled'] = 'customer_hierarchy_enabled'
  @_hash['whopays_enabled'] = 'whopays_enabled'
  @_hash['whopays_default_payer'] = 'whopays_default_payer'
  @_hash['allocation_settings'] = 'allocation_settings'
  @_hash['default_payment_collection_method'] =
    'default_payment_collection_method'
  @_hash['organization_address'] = 'organization_address'
  @_hash['tax_configuration'] = 'tax_configuration'
  @_hash['net_terms'] = 'net_terms'
  @_hash['multi_frequency_enabled'] = 'multi_frequency_enabled'
  @_hash['auto_renewals_enabled'] = 'auto_renewals_enabled'
  @_hash['portal_enabled'] = 'portal_enabled'
  @_hash['test'] = 'test'
  @_hash
end

.nullablesObject

An array for nullable fields



149
150
151
# File 'lib/advanced_billing/models/site.rb', line 149

def self.nullables
  []
end

.optionalsObject

An array for optional fields



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/advanced_billing/models/site.rb', line 123

def self.optionals
  %w[
    id
    name
    subdomain
    currency
    seller_id
    non_primary_currencies
    relationship_invoicing_enabled
    schedule_subscription_cancellation_enabled
    customer_hierarchy_enabled
    whopays_enabled
    whopays_default_payer
    allocation_settings
    default_payment_collection_method
    organization_address
    tax_configuration
    net_terms
    multi_frequency_enabled
    auto_renewals_enabled
    portal_enabled
    test
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/advanced_billing/models/site.rb', line 288

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}, subdomain:"\
  " #{@subdomain.inspect}, currency: #{@currency.inspect}, seller_id: #{@seller_id.inspect},"\
  " non_primary_currencies: #{@non_primary_currencies.inspect},"\
  " relationship_invoicing_enabled: #{@relationship_invoicing_enabled.inspect},"\
  ' schedule_subscription_cancellation_enabled:'\
  " #{@schedule_subscription_cancellation_enabled.inspect}, customer_hierarchy_enabled:"\
  " #{@customer_hierarchy_enabled.inspect}, whopays_enabled: #{@whopays_enabled.inspect},"\
  " whopays_default_payer: #{@whopays_default_payer.inspect}, allocation_settings:"\
  " #{@allocation_settings.inspect}, default_payment_collection_method:"\
  " #{@default_payment_collection_method.inspect}, organization_address:"\
  " #{@organization_address.inspect}, tax_configuration: #{@tax_configuration.inspect},"\
  " net_terms: #{@net_terms.inspect}, multi_frequency_enabled:"\
  " #{@multi_frequency_enabled.inspect}, auto_renewals_enabled:"\
  " #{@auto_renewals_enabled.inspect}, portal_enabled: #{@portal_enabled.inspect}, test:"\
  " #{@test.inspect}, additional_properties: #{get_additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/advanced_billing/models/site.rb', line 270

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, name: #{@name}, subdomain: #{@subdomain}, currency:"\
  " #{@currency}, seller_id: #{@seller_id}, non_primary_currencies:"\
  " #{@non_primary_currencies}, relationship_invoicing_enabled:"\
  " #{@relationship_invoicing_enabled}, schedule_subscription_cancellation_enabled:"\
  " #{@schedule_subscription_cancellation_enabled}, customer_hierarchy_enabled:"\
  " #{@customer_hierarchy_enabled}, whopays_enabled: #{@whopays_enabled},"\
  " whopays_default_payer: #{@whopays_default_payer}, allocation_settings:"\
  " #{@allocation_settings}, default_payment_collection_method:"\
  " #{@default_payment_collection_method}, organization_address: #{@organization_address},"\
  " tax_configuration: #{@tax_configuration}, net_terms: #{@net_terms},"\
  " multi_frequency_enabled: #{@multi_frequency_enabled}, auto_renewals_enabled:"\
  " #{@auto_renewals_enabled}, portal_enabled: #{@portal_enabled}, test: #{@test},"\
  " additional_properties: #{get_additional_properties}>"
end