Class: PinterestSdkClient::LocalStore

Inherits:
ApiModelBase show all
Defined in:
lib/pinterest_sdk/models/local_store.rb

Overview

Local store entity

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
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
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
# File 'lib/pinterest_sdk/models/local_store.rb', line 136

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#address_primaryObject

Primary address line of the store.



20
21
22
# File 'lib/pinterest_sdk/models/local_store.rb', line 20

def address_primary
  @address_primary
end

#address_secondaryObject

Secondary address line of the store.



23
24
25
# File 'lib/pinterest_sdk/models/local_store.rb', line 23

def address_secondary
  @address_secondary
end

#cityObject

City where the store is located.



26
27
28
# File 'lib/pinterest_sdk/models/local_store.rb', line 26

def city
  @city
end

#countryObject

Country code where the store is located.



29
30
31
# File 'lib/pinterest_sdk/models/local_store.rb', line 29

def country
  @country
end

#created_atObject

Creation timestamp



32
33
34
# File 'lib/pinterest_sdk/models/local_store.rb', line 32

def created_at
  @created_at
end

#idObject

The ID of the local store.



35
36
37
# File 'lib/pinterest_sdk/models/local_store.rb', line 35

def id
  @id
end

#latitudeObject

Geographic latitude coordinate of the store.



38
39
40
# File 'lib/pinterest_sdk/models/local_store.rb', line 38

def latitude
  @latitude
end

#longitudeObject

Geographic longitude coordinate of the store.



41
42
43
# File 'lib/pinterest_sdk/models/local_store.rb', line 41

def longitude
  @longitude
end

#nameObject

The name of the local store.



44
45
46
# File 'lib/pinterest_sdk/models/local_store.rb', line 44

def name
  @name
end

#postal_codeObject

Postal or ZIP code of the store.



47
48
49
# File 'lib/pinterest_sdk/models/local_store.rb', line 47

def postal_code
  @postal_code
end

#regionObject

State or region code where the store is located.



50
51
52
# File 'lib/pinterest_sdk/models/local_store.rb', line 50

def region
  @region
end

#store_codeObject

Merchant provided code for the local store. Unique within the merchant's catalog.



53
54
55
# File 'lib/pinterest_sdk/models/local_store.rb', line 53

def store_code
  @store_code
end

#updated_atObject

Last update timestamp



56
57
58
# File 'lib/pinterest_sdk/models/local_store.rb', line 56

def updated_at
  @updated_at
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



100
101
102
# File 'lib/pinterest_sdk/models/local_store.rb', line 100

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



105
106
107
# File 'lib/pinterest_sdk/models/local_store.rb', line 105

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/pinterest_sdk/models/local_store.rb', line 81

def self.attribute_map
  {
    :'address_primary' => :'address_primary',
    :'address_secondary' => :'address_secondary',
    :'city' => :'city',
    :'country' => :'country',
    :'created_at' => :'created_at',
    :'id' => :'id',
    :'latitude' => :'latitude',
    :'longitude' => :'longitude',
    :'name' => :'name',
    :'postal_code' => :'postal_code',
    :'region' => :'region',
    :'store_code' => :'store_code',
    :'updated_at' => :'updated_at'
  }
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



366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
# File 'lib/pinterest_sdk/models/local_store.rb', line 366

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



129
130
131
132
# File 'lib/pinterest_sdk/models/local_store.rb', line 129

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

.openapi_typesObject

Attribute type mapping.



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/pinterest_sdk/models/local_store.rb', line 110

def self.openapi_types
  {
    :'address_primary' => :'String',
    :'address_secondary' => :'String',
    :'city' => :'String',
    :'country' => :'Country',
    :'created_at' => :'Time',
    :'id' => :'String',
    :'latitude' => :'Float',
    :'longitude' => :'Float',
    :'name' => :'String',
    :'postal_code' => :'String',
    :'region' => :'String',
    :'store_code' => :'String',
    :'updated_at' => :'Time'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      address_primary == o.address_primary &&
      address_secondary == o.address_secondary &&
      city == o.city &&
      country == o.country &&
      created_at == o.created_at &&
      id == o.id &&
      latitude == o.latitude &&
      longitude == o.longitude &&
      name == o.name &&
      postal_code == o.postal_code &&
      region == o.region &&
      store_code == o.store_code &&
      updated_at == o.updated_at
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


353
354
355
# File 'lib/pinterest_sdk/models/local_store.rb', line 353

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



359
360
361
# File 'lib/pinterest_sdk/models/local_store.rb', line 359

def hash
  [address_primary, address_secondary, city, country, created_at, id, latitude, longitude, name, postal_code, region, store_code, 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



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/pinterest_sdk/models/local_store.rb', line 217

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

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

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

  pattern = Regexp.new(/^\d+$/)
  if @id !~ pattern
    invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
  end

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

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



388
389
390
391
392
393
394
395
396
397
398
399
400
# File 'lib/pinterest_sdk/models/local_store.rb', line 388

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



254
255
256
257
258
259
260
261
262
263
264
# File 'lib/pinterest_sdk/models/local_store.rb', line 254

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @country.nil?
  return false if @created_at.nil?
  return false if @id.nil?
  return false if @id !~ Regexp.new(/^\d+$/)
  return false if @name.nil?
  return false if @store_code.nil?
  return false if @updated_at.nil?
  true
end