Class: Multicity::Spot

Inherits:
Object
  • Object
show all
Defined in:
lib/multicity/multicity_spot.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#addressObject

Returns the value of attribute address.



3
4
5
# File 'lib/multicity/multicity_spot.rb', line 3

def address
  @address
end

#capacityObject

Returns the value of attribute capacity.



3
4
5
# File 'lib/multicity/multicity_spot.rb', line 3

def capacity
  @capacity
end

#cityObject

Returns the value of attribute city.



3
4
5
# File 'lib/multicity/multicity_spot.rb', line 3

def city
  @city
end

#freeObject

Returns the value of attribute free.



3
4
5
# File 'lib/multicity/multicity_spot.rb', line 3

def free
  @free
end

#latObject

Returns the value of attribute lat.



3
4
5
# File 'lib/multicity/multicity_spot.rb', line 3

def lat
  @lat
end

#lonObject

Returns the value of attribute lon.



3
4
5
# File 'lib/multicity/multicity_spot.rb', line 3

def lon
  @lon
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/multicity/multicity_spot.rb', line 3

def name
  @name
end