Class: Multicity::Spot
- Inherits:
-
Object
- Object
- Multicity::Spot
- Defined in:
- lib/multicity/multicity_spot.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#capacity ⇒ Object
Returns the value of attribute capacity.
-
#city ⇒ Object
Returns the value of attribute city.
-
#free ⇒ Object
Returns the value of attribute free.
-
#lat ⇒ Object
Returns the value of attribute lat.
-
#lon ⇒ Object
Returns the value of attribute lon.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(json = {}) ⇒ Spot
constructor
A new instance of Spot.
Constructor Details
#initialize(json = {}) ⇒ Spot
Returns a new instance of Spot.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/multicity/multicity_spot.rb', line 5 def initialize json={} self.lat = json["lat"] self.lon = json["lng"] info = json["hal2option"]["markerInfo"] || {"address" => {}} self.name = info["name"] self.capacity = info["capacity"] self.free = info["free"] addr = info["address"] self.city = addr["city"] self.address = "#{addr['streetName']} #{addr['houseNumber']}, #{addr['postalCode']} #{addr['city']}" self.address += " #{addr['freeText']}" unless addr['freeText'].to_s.empty? end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
3 4 5 |
# File 'lib/multicity/multicity_spot.rb', line 3 def address @address end |
#capacity ⇒ Object
Returns the value of attribute capacity.
3 4 5 |
# File 'lib/multicity/multicity_spot.rb', line 3 def capacity @capacity end |
#city ⇒ Object
Returns the value of attribute city.
3 4 5 |
# File 'lib/multicity/multicity_spot.rb', line 3 def city @city end |
#free ⇒ Object
Returns the value of attribute free.
3 4 5 |
# File 'lib/multicity/multicity_spot.rb', line 3 def free @free end |
#lat ⇒ Object
Returns the value of attribute lat.
3 4 5 |
# File 'lib/multicity/multicity_spot.rb', line 3 def lat @lat end |
#lon ⇒ Object
Returns the value of attribute lon.
3 4 5 |
# File 'lib/multicity/multicity_spot.rb', line 3 def lon @lon end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/multicity/multicity_spot.rb', line 3 def name @name end |