Class: PinterestSdkClient::LocalStoreCreate

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

Overview

Resource create operation model.

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

Initializes the object

Parameters:

  • (defaults to: {})

    Model attributes in the form of hash



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
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
# File 'lib/pinterest_sdk/models/local_store_create.rb', line 121

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

Instance Attribute Details

#address_primaryObject

Primary address line of the store.



20
21
22
# File 'lib/pinterest_sdk/models/local_store_create.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_create.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_create.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_create.rb', line 29

def country
  @country
end

#latitudeObject

Geographic latitude coordinate of the store.



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

def latitude
  @latitude
end

#longitudeObject

Geographic longitude coordinate of the store.



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

def longitude
  @longitude
end

#nameObject

The name of the local store.



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

def name
  @name
end

#postal_codeObject

Postal or ZIP code of the store.



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

def postal_code
  @postal_code
end

#regionObject

State or region code where the store is located.



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

def region
  @region
end

#store_codeObject

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



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

def store_code
  @store_code
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



88
89
90
# File 'lib/pinterest_sdk/models/local_store_create.rb', line 88

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



93
94
95
# File 'lib/pinterest_sdk/models/local_store_create.rb', line 93

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/pinterest_sdk/models/local_store_create.rb', line 72

def self.attribute_map
  {
    :'address_primary' => :'address_primary',
    :'address_secondary' => :'address_secondary',
    :'city' => :'city',
    :'country' => :'country',
    :'latitude' => :'latitude',
    :'longitude' => :'longitude',
    :'name' => :'name',
    :'postal_code' => :'postal_code',
    :'region' => :'region',
    :'store_code' => :'store_code'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • Model attributes in the form of hash

Returns:

  • Returns the model itself



274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/pinterest_sdk/models/local_store_create.rb', line 274

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



114
115
116
117
# File 'lib/pinterest_sdk/models/local_store_create.rb', line 114

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

.openapi_typesObject

Attribute type mapping.



98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/pinterest_sdk/models/local_store_create.rb', line 98

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

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • to be compared



244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'lib/pinterest_sdk/models/local_store_create.rb', line 244

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 &&
      latitude == o.latitude &&
      longitude == o.longitude &&
      name == o.name &&
      postal_code == o.postal_code &&
      region == o.region &&
      store_code == o.store_code
end

#eql?(o) ⇒ Boolean

Parameters:

  • to be compared

Returns:

See Also:

  • `==` method


261
262
263
# File 'lib/pinterest_sdk/models/local_store_create.rb', line 261

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • Hash code



267
268
269
# File 'lib/pinterest_sdk/models/local_store_create.rb', line 267

def hash
  [address_primary, address_secondary, city, country, latitude, longitude, name, postal_code, region, store_code].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/pinterest_sdk/models/local_store_create.rb', line 184

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 @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

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • Returns the object in the form of hash



296
297
298
299
300
301
302
303
304
305
306
307
308
# File 'lib/pinterest_sdk/models/local_store_create.rb', line 296

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:

  • true if the model is valid



204
205
206
207
208
209
210
# File 'lib/pinterest_sdk/models/local_store_create.rb', line 204

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @country.nil?
  return false if @name.nil?
  return false if @store_code.nil?
  true
end