Class: LinodeOpenapiClient::ChildAccount

Inherits:
Object
  • Object
show all
Defined in:
lib/linode_openapi_client/models/child_account.rb

Overview

Child account object.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ChildAccount

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
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
# File 'lib/linode_openapi_client/models/child_account.rb', line 160

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `LinodeOpenapiClient::ChildAccount` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `LinodeOpenapiClient::ChildAccount`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'zip')
    self.zip = attributes[:'zip']
  end

  if attributes.key?(:'address_2')
    self.address_2 = attributes[:'address_2']
  end

  if attributes.key?(:'capabilities')
    if (value = attributes[:'capabilities']).is_a?(Array)
      self.capabilities = value
    end
  end

  if attributes.key?(:'first_name')
    self.first_name = attributes[:'first_name']
  end

  if attributes.key?(:'active_since')
    self.active_since = attributes[:'active_since']
  end

  if attributes.key?(:'balance')
    self.balance = attributes[:'balance']
  end

  if attributes.key?(:'city')
    self.city = attributes[:'city']
  end

  if attributes.key?(:'state')
    self.state = attributes[:'state']
  end

  if attributes.key?(:'credit_card')
    self.credit_card = attributes[:'credit_card']
  end

  if attributes.key?(:'euuid')
    self.euuid = attributes[:'euuid']
  end

  if attributes.key?(:'address_1')
    self.address_1 = attributes[:'address_1']
  end

  if attributes.key?(:'country')
    self.country = attributes[:'country']
  end

  if attributes.key?(:'last_name')
    self.last_name = attributes[:'last_name']
  end

  if attributes.key?(:'balance_uninvoiced')
    self.balance_uninvoiced = attributes[:'balance_uninvoiced']
  end

  if attributes.key?(:'email')
    self.email = attributes[:'email']
  end

  if attributes.key?(:'billing_source')
    self.billing_source = attributes[:'billing_source']
  end

  if attributes.key?(:'company')
    self.company = attributes[:'company']
  end

  if attributes.key?(:'phone')
    self.phone = attributes[:'phone']
  end

  if attributes.key?(:'tax_id')
    self.tax_id = attributes[:'tax_id']
  end
end

Instance Attribute Details

#active_sinceObject

Read-only The activation date and time for the child account.



32
33
34
# File 'lib/linode_openapi_client/models/child_account.rb', line 32

def active_since
  @active_since
end

#address_1Object

__Filterable__ First line of this child account’s billing address.



49
50
51
# File 'lib/linode_openapi_client/models/child_account.rb', line 49

def address_1
  @address_1
end

#address_2Object

__Filterable__ Second line of this child account’s billing address, if applicable.



23
24
25
# File 'lib/linode_openapi_client/models/child_account.rb', line 23

def address_2
  @address_2
end

#balanceObject

Read-only This child account’s balance, in US dollars.



35
36
37
# File 'lib/linode_openapi_client/models/child_account.rb', line 35

def balance
  @balance
end

#balance_uninvoicedObject

Read-only This child account’s current estimated invoice in US dollars. This is not your final invoice balance. Transfer charges are not included in the estimate.



58
59
60
# File 'lib/linode_openapi_client/models/child_account.rb', line 58

def balance_uninvoiced
  @balance_uninvoiced
end

#billing_sourceObject

Read-only The source of service charges for this account, as determined by its relationship with Akamai. The API returns a value of ‘external` to describe a child account in a parent-child account environment.



64
65
66
# File 'lib/linode_openapi_client/models/child_account.rb', line 64

def billing_source
  @billing_source
end

#capabilitiesObject

Read-only A list of the capabilities the child account supports.



26
27
28
# File 'lib/linode_openapi_client/models/child_account.rb', line 26

def capabilities
  @capabilities
end

#cityObject

__Filterable__ The city for this child account’s billing address.



38
39
40
# File 'lib/linode_openapi_client/models/child_account.rb', line 38

def city
  @city
end

#companyObject

__Filterable__ The company name for the owner of this child account. It can’t include any of these characters: ‘<` `>` `(` `)` `"` `=`. You can’t change this value yourself. We use it to create the proxy users that a parent account uses to access a child account. Talk to your account team if you need to change this value.



67
68
69
# File 'lib/linode_openapi_client/models/child_account.rb', line 67

def company
  @company
end

#countryObject

__Filterable__ The two-letter ISO 3166 country code for this child account’s billing address.



52
53
54
# File 'lib/linode_openapi_client/models/child_account.rb', line 52

def country
  @country
end

#credit_cardObject

Returns the value of attribute credit_card.



43
44
45
# File 'lib/linode_openapi_client/models/child_account.rb', line 43

def credit_card
  @credit_card
end

#emailObject

__Filterable__ The email address of the owner of this child account.



61
62
63
# File 'lib/linode_openapi_client/models/child_account.rb', line 61

def email
  @email
end

#euuidObject

Read-only An external, unique identifier that Akamai assigned to the child account.



46
47
48
# File 'lib/linode_openapi_client/models/child_account.rb', line 46

def euuid
  @euuid
end

#first_nameObject

__Filterable__ The first name of the owner of this child account. It can’t include any of these characters: ‘<` `>` `(` `)` `"` `=`.



29
30
31
# File 'lib/linode_openapi_client/models/child_account.rb', line 29

def first_name
  @first_name
end

#last_nameObject

__Filterable__ The last name of the owner of this child account. It can’t include any of these characters: ‘<` `>` `(` `)` `"` `=`.



55
56
57
# File 'lib/linode_openapi_client/models/child_account.rb', line 55

def last_name
  @last_name
end

#phoneObject

__Filterable__ The phone number for the owner of this child account.



70
71
72
# File 'lib/linode_openapi_client/models/child_account.rb', line 70

def phone
  @phone
end

#stateObject

__Filterable__ The state or province for the billing address (‘address_1` and `address_2, if applicable`). If in the United States (US) or Canada (CA), this is the two-letter ISO 3166 State or Province code. __Note__. If this is a US military address, use state abbreviations (AA, AE, AP).



41
42
43
# File 'lib/linode_openapi_client/models/child_account.rb', line 41

def state
  @state
end

#tax_idObject

The tax identification number for this child account. Use this for tax calculations in some countries. If you live in a country that doesn’t collect taxes, ensure this is an empty string (‘""`).



73
74
75
# File 'lib/linode_openapi_client/models/child_account.rb', line 73

def tax_id
  @tax_id
end

#zipObject

__Filterable__ The zip code of this Account’s billing address. The following restrictions apply: - Can only contain ASCII letters, numbers, and hyphens (‘-`). - Can’t contain more than 9 letter or number characters.



20
21
22
# File 'lib/linode_openapi_client/models/child_account.rb', line 20

def zip
  @zip
end

Class Method Details

._deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
# File 'lib/linode_openapi_client/models/child_account.rb', line 534

def self._deserialize(type, value)
  case type.to_sym
  when :Time
    Time.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 =~ /\A(true|t|yes|y|1)\z/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
    # models (e.g. Pet) or oneOf
    klass = LinodeOpenapiClient.const_get(type)
    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



123
124
125
# File 'lib/linode_openapi_client/models/child_account.rb', line 123

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



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/linode_openapi_client/models/child_account.rb', line 98

def self.attribute_map
  {
    :'zip' => :'zip',
    :'address_2' => :'address_2',
    :'capabilities' => :'capabilities',
    :'first_name' => :'first_name',
    :'active_since' => :'active_since',
    :'balance' => :'balance',
    :'city' => :'city',
    :'state' => :'state',
    :'credit_card' => :'credit_card',
    :'euuid' => :'euuid',
    :'address_1' => :'address_1',
    :'country' => :'country',
    :'last_name' => :'last_name',
    :'balance_uninvoiced' => :'balance_uninvoiced',
    :'email' => :'email',
    :'billing_source' => :'billing_source',
    :'company' => :'company',
    :'phone' => :'phone',
    :'tax_id' => :'tax_id'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
# File 'lib/linode_openapi_client/models/child_account.rb', line 510

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



153
154
155
156
# File 'lib/linode_openapi_client/models/child_account.rb', line 153

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/linode_openapi_client/models/child_account.rb', line 128

def self.openapi_types
  {
    :'zip' => :'String',
    :'address_2' => :'String',
    :'capabilities' => :'Array<String>',
    :'first_name' => :'String',
    :'active_since' => :'Time',
    :'balance' => :'Float',
    :'city' => :'String',
    :'state' => :'String',
    :'credit_card' => :'GetChildAccount200ResponseCreditCard',
    :'euuid' => :'String',
    :'address_1' => :'String',
    :'country' => :'String',
    :'last_name' => :'String',
    :'balance_uninvoiced' => :'Float',
    :'email' => :'String',
    :'billing_source' => :'String',
    :'company' => :'String',
    :'phone' => :'String',
    :'tax_id' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
# File 'lib/linode_openapi_client/models/child_account.rb', line 471

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      zip == o.zip &&
      address_2 == o.address_2 &&
      capabilities == o.capabilities &&
      first_name == o.first_name &&
      active_since == o.active_since &&
      balance == o.balance &&
      city == o.city &&
      state == o.state &&
      credit_card == o.credit_card &&
      euuid == o.euuid &&
      address_1 == o.address_1 &&
      country == o.country &&
      last_name == o.last_name &&
      balance_uninvoiced == o.balance_uninvoiced &&
      email == o.email &&
      billing_source == o.billing_source &&
      company == o.company &&
      phone == o.phone &&
      tax_id == o.tax_id
end

#_to_hash(value) ⇒ Hash

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

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



605
606
607
608
609
610
611
612
613
614
615
616
617
# File 'lib/linode_openapi_client/models/child_account.rb', line 605

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

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


497
498
499
# File 'lib/linode_openapi_client/models/child_account.rb', line 497

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



503
504
505
# File 'lib/linode_openapi_client/models/child_account.rb', line 503

def hash
  [zip, address_2, capabilities, first_name, active_since, balance, city, state, credit_card, euuid, address_1, country, last_name, balance_uninvoiced, email, billing_source, company, phone, tax_id].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/linode_openapi_client/models/child_account.rb', line 254

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@address_2.nil? && @address_2.to_s.length > 64
    invalid_properties.push('invalid value for "address_2", the character length must be smaller than or equal to 64.')
  end

  if !@first_name.nil? && @first_name.to_s.length > 50
    invalid_properties.push('invalid value for "first_name", the character length must be smaller than or equal to 50.')
  end

  if !@city.nil? && @city.to_s.length > 24
    invalid_properties.push('invalid value for "city", the character length must be smaller than or equal to 24.')
  end

  if !@state.nil? && @state.to_s.length > 24
    invalid_properties.push('invalid value for "state", the character length must be smaller than or equal to 24.')
  end

  if !@address_1.nil? && @address_1.to_s.length > 64
    invalid_properties.push('invalid value for "address_1", the character length must be smaller than or equal to 64.')
  end

  if !@last_name.nil? && @last_name.to_s.length > 50
    invalid_properties.push('invalid value for "last_name", the character length must be smaller than or equal to 50.')
  end

  if !@email.nil? && @email.to_s.length > 128
    invalid_properties.push('invalid value for "email", the character length must be smaller than or equal to 128.')
  end

  if !@company.nil? && @company.to_s.length > 128
    invalid_properties.push('invalid value for "company", the character length must be smaller than or equal to 128.')
  end

  if !@phone.nil? && @phone.to_s.length > 32
    invalid_properties.push('invalid value for "phone", the character length must be smaller than or equal to 32.')
  end

  if !@tax_id.nil? && @tax_id.to_s.length > 25
    invalid_properties.push('invalid value for "tax_id", the character length must be smaller than or equal to 25.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



581
582
583
# File 'lib/linode_openapi_client/models/child_account.rb', line 581

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



587
588
589
590
591
592
593
594
595
596
597
598
599
# File 'lib/linode_openapi_client/models/child_account.rb', line 587

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



575
576
577
# File 'lib/linode_openapi_client/models/child_account.rb', line 575

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
# File 'lib/linode_openapi_client/models/child_account.rb', line 302

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@address_2.nil? && @address_2.to_s.length > 64
  return false if !@first_name.nil? && @first_name.to_s.length > 50
  return false if !@city.nil? && @city.to_s.length > 24
  return false if !@state.nil? && @state.to_s.length > 24
  return false if !@address_1.nil? && @address_1.to_s.length > 64
  return false if !@last_name.nil? && @last_name.to_s.length > 50
  return false if !@email.nil? && @email.to_s.length > 128
  billing_source_validator = EnumAttributeValidator.new('String', ["external"])
  return false unless billing_source_validator.valid?(@billing_source)
  return false if !@company.nil? && @company.to_s.length > 128
  return false if !@phone.nil? && @phone.to_s.length > 32
  return false if !@tax_id.nil? && @tax_id.to_s.length > 25
  true
end