Class: SwaggerClient::Location

Inherits:
Object
  • Object
show all
Defined in:
lib/swagger_client/models/location.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Location

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
265
# File 'lib/swagger_client/models/location.rb', line 156

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  if attributes.has_key?(:'AdditionalImageURLs')
    if (value = attributes[:'AdditionalImageURLs']).is_a?(Array)
      self.additional_image_ur_ls = value
    end
  end

  if attributes.has_key?(:'Address')
    self.address = attributes[:'Address']
  end

  if attributes.has_key?(:'Address2')
    self.address2 = attributes[:'Address2']
  end

  if attributes.has_key?(:'Amenities')
    if (value = attributes[:'Amenities']).is_a?(Array)
      self.amenities = value
    end
  end

  if attributes.has_key?(:'BusinessDescription')
    self.business_description = attributes[:'BusinessDescription']
  end

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

  if attributes.has_key?(:'Description')
    self.description = attributes[:'Description']
  end

  if attributes.has_key?(:'HasClasses')
    self.has_classes = attributes[:'HasClasses']
  end

  if attributes.has_key?(:'Id')
    self.id = attributes[:'Id']
  end

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

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

  if attributes.has_key?(:'Name')
    self.name = attributes[:'Name']
  end

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

  if attributes.has_key?(:'PhoneExtension')
    self.phone_extension = attributes[:'PhoneExtension']
  end

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

  if attributes.has_key?(:'SiteID')
    self.site_id = attributes[:'SiteID']
  end

  if attributes.has_key?(:'StateProvCode')
    self.state_prov_code = attributes[:'StateProvCode']
  end

  if attributes.has_key?(:'Tax1')
    self.tax1 = attributes[:'Tax1']
  end

  if attributes.has_key?(:'Tax2')
    self.tax2 = attributes[:'Tax2']
  end

  if attributes.has_key?(:'Tax3')
    self.tax3 = attributes[:'Tax3']
  end

  if attributes.has_key?(:'Tax4')
    self.tax4 = attributes[:'Tax4']
  end

  if attributes.has_key?(:'Tax5')
    self.tax5 = attributes[:'Tax5']
  end

  if attributes.has_key?(:'TotalNumberOfRatings')
    self.total_number_of_ratings = attributes[:'TotalNumberOfRatings']
  end

  if attributes.has_key?(:'AverageRating')
    self.average_rating = attributes[:'AverageRating']
  end

  if attributes.has_key?(:'TotalNumberOfDeals')
    self.total_number_of_deals = attributes[:'TotalNumberOfDeals']
  end
end

Instance Attribute Details

#additional_image_ur_lsObject

A list of URLs of any images associated with this location.



18
19
20
# File 'lib/swagger_client/models/location.rb', line 18

def additional_image_ur_ls
  @additional_image_ur_ls
end

#addressObject

The first line of the location’s street address.



21
22
23
# File 'lib/swagger_client/models/location.rb', line 21

def address
  @address
end

#address2Object

A second address line for the location’s street address, if needed.



24
25
26
# File 'lib/swagger_client/models/location.rb', line 24

def address2
  @address2
end

#amenitiesObject

A list of strings representing amenities available at the location.



27
28
29
# File 'lib/swagger_client/models/location.rb', line 27

def amenities
  @amenities
end

#average_ratingObject

The average rating for the location, out of five stars.



87
88
89
# File 'lib/swagger_client/models/location.rb', line 87

def average_rating
  @average_rating
end

#business_descriptionObject

The business description for the location, as configured by the business owner.



30
31
32
# File 'lib/swagger_client/models/location.rb', line 30

def business_description
  @business_description
end

#cityObject

The location’s city.



33
34
35
# File 'lib/swagger_client/models/location.rb', line 33

def city
  @city
end

#descriptionObject

A description of the location.



36
37
38
# File 'lib/swagger_client/models/location.rb', line 36

def description
  @description
end

#has_classesObject

When ‘true`, indicates that classes are held at this location.<br /> When `false`, Indicates that classes are not held at this location.



39
40
41
# File 'lib/swagger_client/models/location.rb', line 39

def has_classes
  @has_classes
end

#idObject

The ID assigned to this location.



42
43
44
# File 'lib/swagger_client/models/location.rb', line 42

def id
  @id
end

#latitudeObject

The location’s latitude.



45
46
47
# File 'lib/swagger_client/models/location.rb', line 45

def latitude
  @latitude
end

#longitudeObject

The location’s longitude.



48
49
50
# File 'lib/swagger_client/models/location.rb', line 48

def longitude
  @longitude
end

#nameObject

The name of this location.



51
52
53
# File 'lib/swagger_client/models/location.rb', line 51

def name
  @name
end

#phoneObject

The location’s phone number.



54
55
56
# File 'lib/swagger_client/models/location.rb', line 54

def phone
  @phone
end

#phone_extensionObject

The location’s phone extension.



57
58
59
# File 'lib/swagger_client/models/location.rb', line 57

def phone_extension
  @phone_extension
end

#postal_codeObject

The location’s postal code.



60
61
62
# File 'lib/swagger_client/models/location.rb', line 60

def postal_code
  @postal_code
end

#site_idObject

The ID number assigned to this location.



63
64
65
# File 'lib/swagger_client/models/location.rb', line 63

def site_id
  @site_id
end

#state_prov_codeObject

The location’s state or province code.



66
67
68
# File 'lib/swagger_client/models/location.rb', line 66

def state_prov_code
  @state_prov_code
end

#tax1Object

A decimal representation of the location’s first tax rate. Tax properties are provided to apply all taxes to the purchase price that the purchase is subject to. Use as many tax properties as needed to represent all the taxes that apply in the location. Enter a decimal number that represents the appropriate tax rate. For example, for an 8% sales tax, enter 0.08.



69
70
71
# File 'lib/swagger_client/models/location.rb', line 69

def tax1
  @tax1
end

#tax2Object

A decimal representation of the location’s second tax rate. See the example in the description of Tax1.



72
73
74
# File 'lib/swagger_client/models/location.rb', line 72

def tax2
  @tax2
end

#tax3Object

A decimal representation of the location’s third tax rate. See the example in the description of Tax1.



75
76
77
# File 'lib/swagger_client/models/location.rb', line 75

def tax3
  @tax3
end

#tax4Object

A decimal representation of the location’s fourth tax rate. See the example in the description of Tax1.



78
79
80
# File 'lib/swagger_client/models/location.rb', line 78

def tax4
  @tax4
end

#tax5Object

A decimal representation of the location’s fifth tax rate. See the example in the description of Tax1.



81
82
83
# File 'lib/swagger_client/models/location.rb', line 81

def tax5
  @tax5
end

#total_number_of_dealsObject

The number of distinct introductory pricing options available for purchase at this location.



90
91
92
# File 'lib/swagger_client/models/location.rb', line 90

def total_number_of_deals
  @total_number_of_deals
end

#total_number_of_ratingsObject

The number of reviews that clients have left for this location.



84
85
86
# File 'lib/swagger_client/models/location.rb', line 84

def total_number_of_ratings
  @total_number_of_ratings
end

Class Method Details

.attribute_mapObject

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



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/swagger_client/models/location.rb', line 93

def self.attribute_map
  {
    :'additional_image_ur_ls' => :'AdditionalImageURLs',
    :'address' => :'Address',
    :'address2' => :'Address2',
    :'amenities' => :'Amenities',
    :'business_description' => :'BusinessDescription',
    :'city' => :'City',
    :'description' => :'Description',
    :'has_classes' => :'HasClasses',
    :'id' => :'Id',
    :'latitude' => :'Latitude',
    :'longitude' => :'Longitude',
    :'name' => :'Name',
    :'phone' => :'Phone',
    :'phone_extension' => :'PhoneExtension',
    :'postal_code' => :'PostalCode',
    :'site_id' => :'SiteID',
    :'state_prov_code' => :'StateProvCode',
    :'tax1' => :'Tax1',
    :'tax2' => :'Tax2',
    :'tax3' => :'Tax3',
    :'tax4' => :'Tax4',
    :'tax5' => :'Tax5',
    :'total_number_of_ratings' => :'TotalNumberOfRatings',
    :'average_rating' => :'AverageRating',
    :'total_number_of_deals' => :'TotalNumberOfDeals'
  }
end

.swagger_typesObject

Attribute type mapping.



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
# File 'lib/swagger_client/models/location.rb', line 124

def self.swagger_types
  {
    :'additional_image_ur_ls' => :'Array<String>',
    :'address' => :'String',
    :'address2' => :'String',
    :'amenities' => :'Array<Amenity>',
    :'business_description' => :'String',
    :'city' => :'String',
    :'description' => :'String',
    :'has_classes' => :'BOOLEAN',
    :'id' => :'Integer',
    :'latitude' => :'Float',
    :'longitude' => :'Float',
    :'name' => :'String',
    :'phone' => :'String',
    :'phone_extension' => :'String',
    :'postal_code' => :'String',
    :'site_id' => :'Integer',
    :'state_prov_code' => :'String',
    :'tax1' => :'Float',
    :'tax2' => :'Float',
    :'tax3' => :'Float',
    :'tax4' => :'Float',
    :'tax5' => :'Float',
    :'total_number_of_ratings' => :'Integer',
    :'average_rating' => :'Float',
    :'total_number_of_deals' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
# File 'lib/swagger_client/models/location.rb', line 282

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      additional_image_ur_ls == o.additional_image_ur_ls &&
      address == o.address &&
      address2 == o.address2 &&
      amenities == o.amenities &&
      business_description == o.business_description &&
      city == o.city &&
      description == o.description &&
      has_classes == o.has_classes &&
      id == o.id &&
      latitude == o.latitude &&
      longitude == o.longitude &&
      name == o.name &&
      phone == o.phone &&
      phone_extension == o.phone_extension &&
      postal_code == o.postal_code &&
      site_id == o.site_id &&
      state_prov_code == o.state_prov_code &&
      tax1 == o.tax1 &&
      tax2 == o.tax2 &&
      tax3 == o.tax3 &&
      tax4 == o.tax4 &&
      tax5 == o.tax5 &&
      total_number_of_ratings == o.total_number_of_ratings &&
      average_rating == o.average_rating &&
      total_number_of_deals == o.total_number_of_deals
end

#_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



348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
# File 'lib/swagger_client/models/location.rb', line 348

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.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
    temp_model = SwaggerClient.const_get(type).new
    temp_model.build_from_hash(value)
  end
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



414
415
416
417
418
419
420
421
422
423
424
425
426
# File 'lib/swagger_client/models/location.rb', line 414

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

#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



327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
# File 'lib/swagger_client/models/location.rb', line 327

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


314
315
316
# File 'lib/swagger_client/models/location.rb', line 314

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



320
321
322
# File 'lib/swagger_client/models/location.rb', line 320

def hash
  [additional_image_ur_ls, address, address2, amenities, business_description, city, description, has_classes, id, latitude, longitude, name, phone, phone_extension, postal_code, site_id, state_prov_code, tax1, tax2, tax3, tax4, tax5, total_number_of_ratings, average_rating, total_number_of_deals].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



269
270
271
272
# File 'lib/swagger_client/models/location.rb', line 269

def list_invalid_properties
  invalid_properties = Array.new
  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



394
395
396
# File 'lib/swagger_client/models/location.rb', line 394

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



400
401
402
403
404
405
406
407
408
# File 'lib/swagger_client/models/location.rb', line 400

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



388
389
390
# File 'lib/swagger_client/models/location.rb', line 388

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



276
277
278
# File 'lib/swagger_client/models/location.rb', line 276

def valid?
  true
end