Class: CitibikeTrips::Station

Inherits:
Object
  • Object
show all
Defined in:
lib/citibike_trips/station.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#altitudeObject (readonly)

Returns the value of attribute altitude.



2
3
4
# File 'lib/citibike_trips/station.rb', line 2

def altitude
  @altitude
end

#available_bikesObject (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_docksObject (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

#cityObject (readonly)

Returns the value of attribute city.



2
3
4
# File 'lib/citibike_trips/station.rb', line 2

def city
  @city
end

#idObject (readonly)

Returns the value of attribute id.



2
3
4
# File 'lib/citibike_trips/station.rb', line 2

def id
  @id
end

#landmarkObject (readonly)

Returns the value of attribute landmark.



2
3
4
# File 'lib/citibike_trips/station.rb', line 2

def landmark
  @landmark
end

#last_communication_timeObject (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

#latitudeObject (readonly)

Returns the value of attribute latitude.



2
3
4
# File 'lib/citibike_trips/station.rb', line 2

def latitude
  @latitude
end

#locationObject (readonly)

Returns the value of attribute location.



2
3
4
# File 'lib/citibike_trips/station.rb', line 2

def location
  @location
end

#longitudeObject (readonly)

Returns the value of attribute longitude.



2
3
4
# File 'lib/citibike_trips/station.rb', line 2

def longitude
  @longitude
end

#nameObject (readonly)

Returns the value of attribute name.



2
3
4
# File 'lib/citibike_trips/station.rb', line 2

def name
  @name
end

#postal_codeObject (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_keyObject (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_valueObject (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_addressObject (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_arrayObject (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_stationObject (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_docksObject (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