Class: PureCloud::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/purecloud/models/account.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Account

Returns a new instance of Account.



187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
# File 'lib/purecloud/models/account.rb', line 187

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}

  
  if attributes[:'id']
    self.id = attributes[:'id']
  end
  
  if attributes[:'name']
    self.name = attributes[:'name']
  end
  
  if attributes[:'orgLegalName']
    self.org_legal_name = attributes[:'orgLegalName']
  end
  
  if attributes[:'billingAddressLine1']
    self.billing_address_line1 = attributes[:'billingAddressLine1']
  end
  
  if attributes[:'billingAddressLine2']
    self.billing_address_line2 = attributes[:'billingAddressLine2']
  end
  
  if attributes[:'billingAddressCity']
    self.billing_address_city = attributes[:'billingAddressCity']
  end
  
  if attributes[:'billingAddressState']
    self.billing_address_state = attributes[:'billingAddressState']
  end
  
  if attributes[:'billingAddressZipCode']
    self.billing_address_zip_code = attributes[:'billingAddressZipCode']
  end
  
  if attributes[:'billingAddressCountry']
    self.billing_address_country = attributes[:'billingAddressCountry']
  end
  
  if attributes[:'legalAddressLine1']
    self.legal_address_line1 = attributes[:'legalAddressLine1']
  end
  
  if attributes[:'legalAddressLine2']
    self.legal_address_line2 = attributes[:'legalAddressLine2']
  end
  
  if attributes[:'legalAddressCity']
    self.legal_address_city = attributes[:'legalAddressCity']
  end
  
  if attributes[:'legalAddressState']
    self.legal_address_state = attributes[:'legalAddressState']
  end
  
  if attributes[:'legalAddressZipCode']
    self.legal_address_zip_code = attributes[:'legalAddressZipCode']
  end
  
  if attributes[:'legalAddressCountry']
    self.legal_address_country = attributes[:'legalAddressCountry']
  end
  
  if attributes[:'billingContactFirstName']
    self.billing_contact_first_name = attributes[:'billingContactFirstName']
  end
  
  if attributes[:'billingContactLastName']
    self.billing_contact_last_name = attributes[:'billingContactLastName']
  end
  
  if attributes[:'billingContactEmail']
    self.billing_contact_email = attributes[:'billingContactEmail']
  end
  
  if attributes[:'billingContactPhone']
    self.billing_contact_phone = attributes[:'billingContactPhone']
  end
  
  if attributes[:'purchaseOrderNumber']
    self.purchase_order_number = attributes[:'purchaseOrderNumber']
  end
  
  if attributes[:'isTaxExempt']
    self.is_tax_exempt = attributes[:'isTaxExempt']
  else
    self.is_tax_exempt = false
  end
  
  if attributes[:'currency']
    self.currency = attributes[:'currency']
  end
  
  if attributes[:'paymentTerm']
    self.payment_term = attributes[:'paymentTerm']
  end
  
  if attributes[:'contractTerm']
    self.contract_term = attributes[:'contractTerm']
  end
  
  if attributes[:'autoRenew']
    self.auto_renew = attributes[:'autoRenew']
  else
    self.auto_renew = false
  end
  
  if attributes[:'enabled']
    self.enabled = attributes[:'enabled']
  else
    self.enabled = false
  end
  
  if attributes[:'minCommitQuantities']
    if (value = attributes[:'minCommitQuantities']).is_a?(Array)
      self.min_commit_quantities = value
    end
  end
  
  if attributes[:'estimatedQuantities']
    if (value = attributes[:'estimatedQuantities']).is_a?(Array)
      self.estimated_quantities = value
    end
  end
  
  if attributes[:'oneTimeCharges']
    if (value = attributes[:'oneTimeCharges']).is_a?(Array)
      self.one_time_charges = value
    end
  end
  
  if attributes[:'selfUri']
    self.self_uri = attributes[:'selfUri']
  end
  
end

Instance Attribute Details

#auto_renewObject

Returns the value of attribute auto_renew.



70
71
72
# File 'lib/purecloud/models/account.rb', line 70

def auto_renew
  @auto_renew
end

#billing_address_cityObject

Returns the value of attribute billing_address_city.



32
33
34
# File 'lib/purecloud/models/account.rb', line 32

def billing_address_city
  @billing_address_city
end

#billing_address_countryObject

Returns the value of attribute billing_address_country.



38
39
40
# File 'lib/purecloud/models/account.rb', line 38

def billing_address_country
  @billing_address_country
end

#billing_address_line1Object

Returns the value of attribute billing_address_line1.



28
29
30
# File 'lib/purecloud/models/account.rb', line 28

def billing_address_line1
  @billing_address_line1
end

#billing_address_line2Object

Returns the value of attribute billing_address_line2.



30
31
32
# File 'lib/purecloud/models/account.rb', line 30

def billing_address_line2
  @billing_address_line2
end

#billing_address_stateObject

Returns the value of attribute billing_address_state.



34
35
36
# File 'lib/purecloud/models/account.rb', line 34

def billing_address_state
  @billing_address_state
end

#billing_address_zip_codeObject

Returns the value of attribute billing_address_zip_code.



36
37
38
# File 'lib/purecloud/models/account.rb', line 36

def billing_address_zip_code
  @billing_address_zip_code
end

#billing_contact_emailObject

Returns the value of attribute billing_contact_email.



56
57
58
# File 'lib/purecloud/models/account.rb', line 56

def billing_contact_email
  @billing_contact_email
end

#billing_contact_first_nameObject

Returns the value of attribute billing_contact_first_name.



52
53
54
# File 'lib/purecloud/models/account.rb', line 52

def billing_contact_first_name
  @billing_contact_first_name
end

#billing_contact_last_nameObject

Returns the value of attribute billing_contact_last_name.



54
55
56
# File 'lib/purecloud/models/account.rb', line 54

def billing_contact_last_name
  @billing_contact_last_name
end

#billing_contact_phoneObject

Returns the value of attribute billing_contact_phone.



58
59
60
# File 'lib/purecloud/models/account.rb', line 58

def billing_contact_phone
  @billing_contact_phone
end

#contract_termObject

Returns the value of attribute contract_term.



68
69
70
# File 'lib/purecloud/models/account.rb', line 68

def contract_term
  @contract_term
end

#currencyObject

Returns the value of attribute currency.



64
65
66
# File 'lib/purecloud/models/account.rb', line 64

def currency
  @currency
end

#enabledObject

Returns the value of attribute enabled.



72
73
74
# File 'lib/purecloud/models/account.rb', line 72

def enabled
  @enabled
end

#estimated_quantitiesObject

Returns the value of attribute estimated_quantities.



76
77
78
# File 'lib/purecloud/models/account.rb', line 76

def estimated_quantities
  @estimated_quantities
end

#idObject

The globally unique identifier for the object.



22
23
24
# File 'lib/purecloud/models/account.rb', line 22

def id
  @id
end

#is_tax_exemptObject

Returns the value of attribute is_tax_exempt.



62
63
64
# File 'lib/purecloud/models/account.rb', line 62

def is_tax_exempt
  @is_tax_exempt
end

Returns the value of attribute legal_address_city.



44
45
46
# File 'lib/purecloud/models/account.rb', line 44

def legal_address_city
  @legal_address_city
end

Returns the value of attribute legal_address_country.



50
51
52
# File 'lib/purecloud/models/account.rb', line 50

def legal_address_country
  @legal_address_country
end

Returns the value of attribute legal_address_line1.



40
41
42
# File 'lib/purecloud/models/account.rb', line 40

def legal_address_line1
  @legal_address_line1
end

Returns the value of attribute legal_address_line2.



42
43
44
# File 'lib/purecloud/models/account.rb', line 42

def legal_address_line2
  @legal_address_line2
end

Returns the value of attribute legal_address_state.



46
47
48
# File 'lib/purecloud/models/account.rb', line 46

def legal_address_state
  @legal_address_state
end

Returns the value of attribute legal_address_zip_code.



48
49
50
# File 'lib/purecloud/models/account.rb', line 48

def legal_address_zip_code
  @legal_address_zip_code
end

#min_commit_quantitiesObject

Returns the value of attribute min_commit_quantities.



74
75
76
# File 'lib/purecloud/models/account.rb', line 74

def min_commit_quantities
  @min_commit_quantities
end

#nameObject

Returns the value of attribute name.



24
25
26
# File 'lib/purecloud/models/account.rb', line 24

def name
  @name
end

#one_time_chargesObject

Returns the value of attribute one_time_charges.



78
79
80
# File 'lib/purecloud/models/account.rb', line 78

def one_time_charges
  @one_time_charges
end

Returns the value of attribute org_legal_name.



26
27
28
# File 'lib/purecloud/models/account.rb', line 26

def org_legal_name
  @org_legal_name
end

#payment_termObject

Returns the value of attribute payment_term.



66
67
68
# File 'lib/purecloud/models/account.rb', line 66

def payment_term
  @payment_term
end

#purchase_order_numberObject

Returns the value of attribute purchase_order_number.



60
61
62
# File 'lib/purecloud/models/account.rb', line 60

def purchase_order_number
  @purchase_order_number
end

#self_uriObject

The URI for this object



81
82
83
# File 'lib/purecloud/models/account.rb', line 81

def self_uri
  @self_uri
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



84
85
86
87
88
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/purecloud/models/account.rb', line 84

def self.attribute_map
  {
    
    :'id' => :'id',
    
    :'name' => :'name',
    
    :'org_legal_name' => :'orgLegalName',
    
    :'billing_address_line1' => :'billingAddressLine1',
    
    :'billing_address_line2' => :'billingAddressLine2',
    
    :'billing_address_city' => :'billingAddressCity',
    
    :'billing_address_state' => :'billingAddressState',
    
    :'billing_address_zip_code' => :'billingAddressZipCode',
    
    :'billing_address_country' => :'billingAddressCountry',
    
    :'legal_address_line1' => :'legalAddressLine1',
    
    :'legal_address_line2' => :'legalAddressLine2',
    
    :'legal_address_city' => :'legalAddressCity',
    
    :'legal_address_state' => :'legalAddressState',
    
    :'legal_address_zip_code' => :'legalAddressZipCode',
    
    :'legal_address_country' => :'legalAddressCountry',
    
    :'billing_contact_first_name' => :'billingContactFirstName',
    
    :'billing_contact_last_name' => :'billingContactLastName',
    
    :'billing_contact_email' => :'billingContactEmail',
    
    :'billing_contact_phone' => :'billingContactPhone',
    
    :'purchase_order_number' => :'purchaseOrderNumber',
    
    :'is_tax_exempt' => :'isTaxExempt',
    
    :'currency' => :'currency',
    
    :'payment_term' => :'paymentTerm',
    
    :'contract_term' => :'contractTerm',
    
    :'auto_renew' => :'autoRenew',
    
    :'enabled' => :'enabled',
    
    :'min_commit_quantities' => :'minCommitQuantities',
    
    :'estimated_quantities' => :'estimatedQuantities',
    
    :'one_time_charges' => :'oneTimeCharges',
    
    :'self_uri' => :'selfUri'
    
  }
end

.swagger_typesObject

Attribute type mapping.



151
152
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
# File 'lib/purecloud/models/account.rb', line 151

def self.swagger_types
  {
    :'id' => :'String',
    :'name' => :'String',
    :'org_legal_name' => :'String',
    :'billing_address_line1' => :'String',
    :'billing_address_line2' => :'String',
    :'billing_address_city' => :'String',
    :'billing_address_state' => :'String',
    :'billing_address_zip_code' => :'String',
    :'billing_address_country' => :'String',
    :'legal_address_line1' => :'String',
    :'legal_address_line2' => :'String',
    :'legal_address_city' => :'String',
    :'legal_address_state' => :'String',
    :'legal_address_zip_code' => :'String',
    :'legal_address_country' => :'String',
    :'billing_contact_first_name' => :'String',
    :'billing_contact_last_name' => :'String',
    :'billing_contact_email' => :'String',
    :'billing_contact_phone' => :'String',
    :'purchase_order_number' => :'String',
    :'is_tax_exempt' => :'BOOLEAN',
    :'currency' => :'String',
    :'payment_term' => :'String',
    :'contract_term' => :'Integer',
    :'auto_renew' => :'BOOLEAN',
    :'enabled' => :'BOOLEAN',
    :'min_commit_quantities' => :'Hash<String, Integer>',
    :'estimated_quantities' => :'Hash<String, Integer>',
    :'one_time_charges' => :'Array<String>',
    :'self_uri' => :'String'
    
  }
end

Instance Method Details

#==(o) ⇒ Object

Check equality by comparing each attribute.



329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
# File 'lib/purecloud/models/account.rb', line 329

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      name == o.name &&
      org_legal_name == o.org_legal_name &&
      billing_address_line1 == o.billing_address_line1 &&
      billing_address_line2 == o.billing_address_line2 &&
      billing_address_city == o.billing_address_city &&
      billing_address_state == o.billing_address_state &&
      billing_address_zip_code == o.billing_address_zip_code &&
      billing_address_country == o.billing_address_country &&
      legal_address_line1 == o.legal_address_line1 &&
      legal_address_line2 == o.legal_address_line2 &&
      legal_address_city == o.legal_address_city &&
      legal_address_state == o.legal_address_state &&
      legal_address_zip_code == o.legal_address_zip_code &&
      legal_address_country == o.legal_address_country &&
      billing_contact_first_name == o.billing_contact_first_name &&
      billing_contact_last_name == o.billing_contact_last_name &&
      billing_contact_email == o.billing_contact_email &&
      billing_contact_phone == o.billing_contact_phone &&
      purchase_order_number == o.purchase_order_number &&
      is_tax_exempt == o.is_tax_exempt &&
      currency == o.currency &&
      payment_term == o.payment_term &&
      contract_term == o.contract_term &&
      auto_renew == o.auto_renew &&
      enabled == o.enabled &&
      min_commit_quantities == o.min_commit_quantities &&
      estimated_quantities == o.estimated_quantities &&
      one_time_charges == o.one_time_charges &&
      self_uri == o.self_uri
end

#_deserialize(type, value) ⇒ Object



394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
# File 'lib/purecloud/models/account.rb', line 394

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /^(true|t|yes|y|1)$/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    _model = Object.const_get("PureCloud").const_get(type).new
    _model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Object

Method to output non-array value in the form of hash For object, use to_hash. Otherwise, just return the value



454
455
456
457
458
459
460
461
462
463
464
465
466
# File 'lib/purecloud/models/account.rb', line 454

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map{ |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

build the object from hash



375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
# File 'lib/purecloud/models/account.rb', line 375

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
      else
        #TODO show warning in debug mode
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    else
      # data not found in attributes(hash), not an issue as the data can be optional
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Returns:

  • (Boolean)

See Also:

  • `==` method


365
366
367
# File 'lib/purecloud/models/account.rb', line 365

def eql?(o)
  self == o
end

#hashObject

Calculate hash code according to all attributes.



370
371
372
# File 'lib/purecloud/models/account.rb', line 370

def hash
  [id, name, org_legal_name, billing_address_line1, billing_address_line2, billing_address_city, billing_address_state, billing_address_zip_code, billing_address_country, legal_address_line1, legal_address_line2, legal_address_city, legal_address_state, legal_address_zip_code, legal_address_country, billing_contact_first_name, billing_contact_last_name, billing_contact_email, billing_contact_phone, purchase_order_number, is_tax_exempt, currency, payment_term, contract_term, auto_renew, enabled, min_commit_quantities, estimated_quantities, one_time_charges, self_uri].hash
end

#to_bodyObject

to_body is an alias to to_body (backward compatibility))



437
438
439
# File 'lib/purecloud/models/account.rb', line 437

def to_body
  to_hash
end

#to_hashObject

return the object in the form of hash



442
443
444
445
446
447
448
449
450
# File 'lib/purecloud/models/account.rb', line 442

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sObject



432
433
434
# File 'lib/purecloud/models/account.rb', line 432

def to_s
  to_hash.to_s
end