Class: Zippendo::ListShipments200ResponseDataInnerAddress

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/zippendo/models/list_shipments200_response_data_inner_address.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ ListShipments200ResponseDataInnerAddress

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 153

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

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

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  else
    self.id = nil
  end

  if attributes.key?(:'name')
    self.name = attributes[:'name']
  else
    self.name = nil
  end

  if attributes.key?(:'att_contact')
    self.att_contact = attributes[:'att_contact']
  else
    self.att_contact = nil
  end

  if attributes.key?(:'address1')
    self.address1 = attributes[:'address1']
  else
    self.address1 = nil
  end

  if attributes.key?(:'address2')
    self.address2 = attributes[:'address2']
  else
    self.address2 = nil
  end

  if attributes.key?(:'zipcode')
    self.zipcode = attributes[:'zipcode']
  else
    self.zipcode = nil
  end

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

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

  if attributes.key?(:'country_code')
    self.country_code = attributes[:'country_code']
  else
    self.country_code = nil
  end

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

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

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

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

  if attributes.key?(:'org_id')
    self.org_id = attributes[:'org_id']
  else
    self.org_id = nil
  end

  if attributes.key?(:'created_at')
    self.created_at = attributes[:'created_at']
  else
    self.created_at = nil
  end

  if attributes.key?(:'updated_at')
    self.updated_at = attributes[:'updated_at']
  else
    self.updated_at = nil
  end
end

Instance Attribute Details

#address1Object

Address line 1



28
29
30
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 28

def address1
  @address1
end

#address2Object

Address line 2



31
32
33
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 31

def address2
  @address2
end

#address_typesObject

Address types (sender, pickup, return)



55
56
57
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 55

def address_types
  @address_types
end

#att_contactObject

Attention contact person



25
26
27
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 25

def att_contact
  @att_contact
end

#cityObject

City



37
38
39
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 37

def city
  @city
end

#country_codeObject

ISO country code



43
44
45
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 43

def country_code
  @country_code
end

#created_atObject

Creation timestamp (ISO 8601)



61
62
63
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 61

def created_at
  @created_at
end

#customsObject

Customs identifiers keyed by type



52
53
54
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 52

def customs
  @customs
end

#emailObject

Email address



49
50
51
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 49

def email
  @email
end

#idObject

Unique address identifier



19
20
21
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 19

def id
  @id
end

#nameObject

Name of the address



22
23
24
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 22

def name
  @name
end

#org_idObject

Owning organization ID



58
59
60
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 58

def org_id
  @org_id
end

#phoneObject

Phone number



40
41
42
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 40

def phone
  @phone
end

#stateObject

State/Province



46
47
48
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 46

def state
  @state
end

#updated_atObject

Last update timestamp (ISO 8601)



64
65
66
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 64

def updated_at
  @updated_at
end

#zipcodeObject

Postal/ZIP code



34
35
36
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 34

def zipcode
  @zipcode
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



111
112
113
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 111

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



116
117
118
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 116

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 89

def self.attribute_map
  {
    :'id' => :'id',
    :'name' => :'name',
    :'att_contact' => :'attContact',
    :'address1' => :'address1',
    :'address2' => :'address2',
    :'zipcode' => :'zipcode',
    :'city' => :'city',
    :'phone' => :'phone',
    :'country_code' => :'countryCode',
    :'state' => :'state',
    :'email' => :'email',
    :'customs' => :'customs',
    :'address_types' => :'addressTypes',
    :'org_id' => :'orgId',
    :'created_at' => :'createdAt',
    :'updated_at' => :'updatedAt'
  }
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



515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 515

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



143
144
145
146
147
148
149
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 143

def self.openapi_nullable
  Set.new([
    :'address2',
    :'state',
    :'customs',
  ])
end

.openapi_typesObject

Attribute type mapping.



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 121

def self.openapi_types
  {
    :'id' => :'String',
    :'name' => :'String',
    :'att_contact' => :'String',
    :'address1' => :'String',
    :'address2' => :'String',
    :'zipcode' => :'String',
    :'city' => :'String',
    :'phone' => :'String',
    :'country_code' => :'String',
    :'state' => :'String',
    :'email' => :'String',
    :'customs' => :'Hash<String, String>',
    :'address_types' => :'Array<String>',
    :'org_id' => :'String',
    :'created_at' => :'String',
    :'updated_at' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 479

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      name == o.name &&
      att_contact == o.att_contact &&
      address1 == o.address1 &&
      address2 == o.address2 &&
      zipcode == o.zipcode &&
      city == o.city &&
      phone == o.phone &&
      country_code == o.country_code &&
      state == o.state &&
      email == o.email &&
      customs == o.customs &&
      address_types == o.address_types &&
      org_id == o.org_id &&
      created_at == o.created_at &&
      updated_at == o.updated_at
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


502
503
504
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 502

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



508
509
510
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 508

def hash
  [id, name, att_contact, address1, address2, zipcode, city, phone, country_code, state, email, customs, address_types, org_id, created_at, updated_at].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
327
328
329
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 268

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @id.nil?
    invalid_properties.push('invalid value for "id", id cannot be nil.')
  end

  if @name.nil?
    invalid_properties.push('invalid value for "name", name cannot be nil.')
  end

  if @att_contact.nil?
    invalid_properties.push('invalid value for "att_contact", att_contact cannot be nil.')
  end

  if @address1.nil?
    invalid_properties.push('invalid value for "address1", address1 cannot be nil.')
  end

  if @zipcode.nil?
    invalid_properties.push('invalid value for "zipcode", zipcode cannot be nil.')
  end

  if @city.nil?
    invalid_properties.push('invalid value for "city", city cannot be nil.')
  end

  if @phone.nil?
    invalid_properties.push('invalid value for "phone", phone cannot be nil.')
  end

  if @country_code.nil?
    invalid_properties.push('invalid value for "country_code", country_code cannot be nil.')
  end

  if @email.nil?
    invalid_properties.push('invalid value for "email", email cannot be nil.')
  end

  pattern = Regexp.new(/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/)
  if @email !~ pattern
    invalid_properties.push("invalid value for \"email\", must conform to the pattern #{pattern}.")
  end

  if @address_types.nil?
    invalid_properties.push('invalid value for "address_types", address_types cannot be nil.')
  end

  if @org_id.nil?
    invalid_properties.push('invalid value for "org_id", org_id cannot be nil.')
  end

  if @created_at.nil?
    invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
  end

  if @updated_at.nil?
    invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



537
538
539
540
541
542
543
544
545
546
547
548
549
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 537

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

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# File 'lib/zippendo/models/list_shipments200_response_data_inner_address.rb', line 333

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @id.nil?
  return false if @name.nil?
  return false if @att_contact.nil?
  return false if @address1.nil?
  return false if @zipcode.nil?
  return false if @city.nil?
  return false if @phone.nil?
  return false if @country_code.nil?
  return false if @email.nil?
  return false if @email !~ Regexp.new(/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/)
  return false if @address_types.nil?
  return false if @org_id.nil?
  return false if @created_at.nil?
  return false if @updated_at.nil?
  true
end