Class: Zippendo::ListOrgBrands200ResponseDataInner

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

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 = {}) ⇒ ListOrgBrands200ResponseDataInner

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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_org_brands200_response_data_inner.rb', line 155

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Zippendo::ListOrgBrands200ResponseDataInner` 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::ListOrgBrands200ResponseDataInner`. 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?(:'company_name')
    self.company_name = attributes[:'company_name']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  if attributes.key?(:'archived_at')
    self.archived_at = attributes[:'archived_at']
  else
    self.archived_at = 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

#address_line1Object

Street address line 1



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

def address_line1
  @address_line1
end

#address_line2Object

Street address line 2



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

def address_line2
  @address_line2
end

#archived_atObject

When the brand was archived; null when active



67
68
69
# File 'lib/zippendo/models/list_org_brands200_response_data_inner.rb', line 67

def archived_at
  @archived_at
end

#cityObject

City



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

def city
  @city
end

#company_nameObject

Legal entity name printed on this brand's documents



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

def company_name
  @company_name
end

#countryObject

Country (ISO 3166-1 alpha-2)



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

def country
  @country
end

#created_atObject

Creation timestamp (ISO 8601)



70
71
72
# File 'lib/zippendo/models/list_org_brands200_response_data_inner.rb', line 70

def created_at
  @created_at
end

#customsObject

Customs identifiers keyed by type



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

def customs
  @customs
end

#idObject

Unique brand identifier



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

def id
  @id
end

#logo_urlObject

Authenticated URL for the brand logo, or null when none is set



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

def logo_url
  @logo_url
end

#nameObject

Brand display name



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

def name
  @name
end

#org_idObject

Owning organization



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

def org_id
  @org_id
end

#postal_codeObject

Postal code



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

def postal_code
  @postal_code
end

#primary_colorObject

Primary brand colour — document title and table headers



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

def primary_color
  @primary_color
end

#secondary_colorObject

Secondary brand colour — subtitle, section headings, totals accent



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

def secondary_color
  @secondary_color
end

#slugObject

URL-safe identifier, unique within the organization



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

def slug
  @slug
end

#updated_atObject

Last update timestamp (ISO 8601)



73
74
75
# File 'lib/zippendo/models/list_org_brands200_response_data_inner.rb', line 73

def updated_at
  @updated_at
end

#use_org_customsObject

Whether this brand ships under the organization's fiscal identity. True (the default) declares the organization's VAT number and customs identifiers and ignores the brand's own. False makes the brand's own values the sole source — nothing falls back to the organization, so an identifier the brand has not set is not declared at all.



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

def use_org_customs
  @use_org_customs
end

#vat_numberObject

VAT/tax ID for this brand's shipments and documents



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

def vat_number
  @vat_number
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



101
102
103
# File 'lib/zippendo/models/list_org_brands200_response_data_inner.rb', line 101

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



106
107
108
# File 'lib/zippendo/models/list_org_brands200_response_data_inner.rb', line 106

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/zippendo/models/list_org_brands200_response_data_inner.rb', line 76

def self.attribute_map
  {
    :'company_name' => :'companyName',
    :'vat_number' => :'vatNumber',
    :'customs' => :'customs',
    :'address_line1' => :'addressLine1',
    :'address_line2' => :'addressLine2',
    :'city' => :'city',
    :'postal_code' => :'postalCode',
    :'country' => :'country',
    :'primary_color' => :'primaryColor',
    :'secondary_color' => :'secondaryColor',
    :'id' => :'id',
    :'org_id' => :'orgId',
    :'name' => :'name',
    :'slug' => :'slug',
    :'use_org_customs' => :'useOrgCustoms',
    :'logo_url' => :'logoUrl',
    :'archived_at' => :'archivedAt',
    :'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



575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
# File 'lib/zippendo/models/list_org_brands200_response_data_inner.rb', line 575

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



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/zippendo/models/list_org_brands200_response_data_inner.rb', line 136

def self.openapi_nullable
  Set.new([
    :'company_name',
    :'vat_number',
    :'customs',
    :'address_line1',
    :'address_line2',
    :'city',
    :'postal_code',
    :'country',
    :'primary_color',
    :'secondary_color',
    :'logo_url',
    :'archived_at',
  ])
end

.openapi_typesObject

Attribute type mapping.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/zippendo/models/list_org_brands200_response_data_inner.rb', line 111

def self.openapi_types
  {
    :'company_name' => :'String',
    :'vat_number' => :'String',
    :'customs' => :'Hash<String, String>',
    :'address_line1' => :'String',
    :'address_line2' => :'String',
    :'city' => :'String',
    :'postal_code' => :'String',
    :'country' => :'String',
    :'primary_color' => :'String',
    :'secondary_color' => :'String',
    :'id' => :'String',
    :'org_id' => :'String',
    :'name' => :'String',
    :'slug' => :'String',
    :'use_org_customs' => :'Boolean',
    :'logo_url' => :'String',
    :'archived_at' => :'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



536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
# File 'lib/zippendo/models/list_org_brands200_response_data_inner.rb', line 536

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      company_name == o.company_name &&
      vat_number == o.vat_number &&
      customs == o.customs &&
      address_line1 == o.address_line1 &&
      address_line2 == o.address_line2 &&
      city == o.city &&
      postal_code == o.postal_code &&
      country == o.country &&
      primary_color == o.primary_color &&
      secondary_color == o.secondary_color &&
      id == o.id &&
      org_id == o.org_id &&
      name == o.name &&
      slug == o.slug &&
      use_org_customs == o.use_org_customs &&
      logo_url == o.logo_url &&
      archived_at == o.archived_at &&
      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


562
563
564
# File 'lib/zippendo/models/list_org_brands200_response_data_inner.rb', line 562

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



568
569
570
# File 'lib/zippendo/models/list_org_brands200_response_data_inner.rb', line 568

def hash
  [company_name, vat_number, customs, address_line1, address_line2, city, postal_code, country, primary_color, secondary_color, id, org_id, name, slug, use_org_customs, logo_url, archived_at, 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
330
331
332
333
334
335
336
337
338
339
340
341
342
# File 'lib/zippendo/models/list_org_brands200_response_data_inner.rb', line 268

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

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

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

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

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

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

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

  if !@country.nil? && @country.to_s.length < 2
    invalid_properties.push('invalid value for "country", the character length must be greater than or equal to 2.')
  end

  pattern = Regexp.new(/^#[0-9a-fA-F]{6}$/)
  if !@primary_color.nil? && @primary_color !~ pattern
    invalid_properties.push("invalid value for \"primary_color\", must conform to the pattern #{pattern}.")
  end

  pattern = Regexp.new(/^#[0-9a-fA-F]{6}$/)
  if !@secondary_color.nil? && @secondary_color !~ pattern
    invalid_properties.push("invalid value for \"secondary_color\", must conform to the pattern #{pattern}.")
  end

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

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

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

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

  if @use_org_customs.nil?
    invalid_properties.push('invalid value for "use_org_customs", use_org_customs 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



597
598
599
600
601
602
603
604
605
606
607
608
609
# File 'lib/zippendo/models/list_org_brands200_response_data_inner.rb', line 597

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



346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
# File 'lib/zippendo/models/list_org_brands200_response_data_inner.rb', line 346

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@company_name.nil? && @company_name.to_s.length > 200
  return false if !@vat_number.nil? && @vat_number.to_s.length > 40
  return false if !@address_line1.nil? && @address_line1.to_s.length > 200
  return false if !@address_line2.nil? && @address_line2.to_s.length > 200
  return false if !@city.nil? && @city.to_s.length > 100
  return false if !@postal_code.nil? && @postal_code.to_s.length > 20
  return false if !@country.nil? && @country.to_s.length > 2
  return false if !@country.nil? && @country.to_s.length < 2
  return false if !@primary_color.nil? && @primary_color !~ Regexp.new(/^#[0-9a-fA-F]{6}$/)
  return false if !@secondary_color.nil? && @secondary_color !~ Regexp.new(/^#[0-9a-fA-F]{6}$/)
  return false if @id.nil?
  return false if @org_id.nil?
  return false if @name.nil?
  return false if @slug.nil?
  return false if @use_org_customs.nil?
  return false if @created_at.nil?
  return false if @updated_at.nil?
  true
end