Class: CitibikeTrips::Station
- Inherits:
-
Object
- Object
- CitibikeTrips::Station
- Defined in:
- lib/citibike_trips/station.rb
Instance Attribute Summary collapse
-
#altitude ⇒ Object
readonly
Returns the value of attribute altitude.
-
#available_bikes ⇒ Object
readonly
Returns the value of attribute available_bikes.
-
#available_docks ⇒ Object
readonly
Returns the value of attribute available_docks.
-
#city ⇒ Object
readonly
Returns the value of attribute city.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#landmark ⇒ Object
readonly
Returns the value of attribute landmark.
-
#last_communication_time ⇒ Object
readonly
Returns the value of attribute last_communication_time.
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#postal_code ⇒ Object
readonly
Returns the value of attribute postal_code.
-
#status_key ⇒ Object
readonly
Returns the value of attribute status_key.
-
#status_value ⇒ Object
readonly
Returns the value of attribute status_value.
-
#street_address ⇒ Object
readonly
Returns the value of attribute street_address.
-
#street_address_array ⇒ Object
readonly
Returns the value of attribute street_address_array.
-
#test_station ⇒ Object
readonly
Returns the value of attribute test_station.
-
#total_docks ⇒ Object
readonly
Returns the value of attribute total_docks.
Instance Method Summary collapse
-
#initialize(data) ⇒ Station
constructor
A new instance of Station.
Constructor Details
#initialize(data) ⇒ Station
Returns a new instance of Station.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/citibike_trips/station.rb', line 9 def initialize(data) data.each do |k,v| if v == '' data[k] = nil end end @id = data['id'] @name = data['stationName'] @available_docks = data['availableDocks'] @total_docks = data['totalDocks'] @available_bikes = data['availableBikes'] @latitude = data['latitude'] @longitude = data['longitude'] @location = data['location'] @altitude = data['altitude'] @street_address_array = [data['stAddress1']] if data['stAddress2'] @street_address_array << data['stAddress2'] end @street_address = @street_address_array.join(', ') @city = data['city'] || 'New York' @postal_code = data['postalCode'] @status_value = data['statusValue'] @status_key = data['statusKey'] @test_station = data['testStation'] @last_communication_time = data['lastCommunicationTime'] @landmark = data['landMark'] end |
Instance Attribute Details
#altitude ⇒ Object (readonly)
Returns the value of attribute altitude.
2 3 4 |
# File 'lib/citibike_trips/station.rb', line 2 def altitude @altitude end |
#available_bikes ⇒ Object (readonly)
Returns the value of attribute available_bikes.
2 3 4 |
# File 'lib/citibike_trips/station.rb', line 2 def available_bikes @available_bikes end |
#available_docks ⇒ Object (readonly)
Returns the value of attribute available_docks.
2 3 4 |
# File 'lib/citibike_trips/station.rb', line 2 def available_docks @available_docks end |
#city ⇒ Object (readonly)
Returns the value of attribute city.
2 3 4 |
# File 'lib/citibike_trips/station.rb', line 2 def city @city end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
2 3 4 |
# File 'lib/citibike_trips/station.rb', line 2 def id @id end |
#landmark ⇒ Object (readonly)
Returns the value of attribute landmark.
2 3 4 |
# File 'lib/citibike_trips/station.rb', line 2 def landmark @landmark end |
#last_communication_time ⇒ Object (readonly)
Returns the value of attribute last_communication_time.
2 3 4 |
# File 'lib/citibike_trips/station.rb', line 2 def last_communication_time @last_communication_time end |
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
2 3 4 |
# File 'lib/citibike_trips/station.rb', line 2 def latitude @latitude end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
2 3 4 |
# File 'lib/citibike_trips/station.rb', line 2 def location @location end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
2 3 4 |
# File 'lib/citibike_trips/station.rb', line 2 def longitude @longitude end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/citibike_trips/station.rb', line 2 def name @name end |
#postal_code ⇒ Object (readonly)
Returns the value of attribute postal_code.
2 3 4 |
# File 'lib/citibike_trips/station.rb', line 2 def postal_code @postal_code end |
#status_key ⇒ Object (readonly)
Returns the value of attribute status_key.
2 3 4 |
# File 'lib/citibike_trips/station.rb', line 2 def status_key @status_key end |
#status_value ⇒ Object (readonly)
Returns the value of attribute status_value.
2 3 4 |
# File 'lib/citibike_trips/station.rb', line 2 def status_value @status_value end |
#street_address ⇒ Object (readonly)
Returns the value of attribute street_address.
2 3 4 |
# File 'lib/citibike_trips/station.rb', line 2 def street_address @street_address end |
#street_address_array ⇒ Object (readonly)
Returns the value of attribute street_address_array.
2 3 4 |
# File 'lib/citibike_trips/station.rb', line 2 def street_address_array @street_address_array end |
#test_station ⇒ Object (readonly)
Returns the value of attribute test_station.
2 3 4 |
# File 'lib/citibike_trips/station.rb', line 2 def test_station @test_station end |
#total_docks ⇒ Object (readonly)
Returns the value of attribute total_docks.
2 3 4 |
# File 'lib/citibike_trips/station.rb', line 2 def total_docks @total_docks end |