Class: Asdawqw::NearbyAmenity

Inherits:
BaseModel show all
Defined in:
lib/asdawqw/models/nearby_amenity.rb

Overview

NearbyAmenity Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(attribute_id = nil, distance = nil) ⇒ NearbyAmenity

Returns a new instance of NearbyAmenity.



26
27
28
29
30
# File 'lib/asdawqw/models/nearby_amenity.rb', line 26

def initialize(attribute_id = nil,
               distance = nil)
  @attribute_id = attribute_id
  @distance = distance
end

Instance Attribute Details

#attribute_idNearbyAmenitiesEnum

Nearby Attributes code. Check all enum types for supported list of amenities.

Returns:



12
13
14
# File 'lib/asdawqw/models/nearby_amenity.rb', line 12

def attribute_id
  @attribute_id
end

#distanceInteger

Will be set to 0 by default

Returns:

  • (Integer)


16
17
18
# File 'lib/asdawqw/models/nearby_amenity.rb', line 16

def distance
  @distance
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/asdawqw/models/nearby_amenity.rb', line 33

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  attribute_id = hash['attributeId']
  distance = hash['distance']

  # Create object from extracted values.
  NearbyAmenity.new(attribute_id,
                    distance)
end

.namesObject

A mapping from model property names to API property names.



19
20
21
22
23
24
# File 'lib/asdawqw/models/nearby_amenity.rb', line 19

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['attribute_id'] = 'attributeId'
  @_hash['distance'] = 'distance'
  @_hash
end