class CapitalBikeshare::Client
Constants
- XML_FEED_URL
Public Class Methods
new(xml_feed_url = XML_FEED_URL)
click to toggle source
# File lib/capital-bikeshare/client.rb, line 9 def initialize(xml_feed_url = XML_FEED_URL) @xml_feed_url = xml_feed_url @station_data = nil @station_set = nil end
Public Instance Methods
fetch()
click to toggle source
# File lib/capital-bikeshare/client.rb, line 15 def fetch @station_data = Net::HTTP.get(URI(@xml_feed_url)) @station_set = StationSet.new(parsed_stations) end
find(searchable)
click to toggle source
# File lib/capital-bikeshare/client.rb, line 33 def find(searchable) @station_set.find(searchable) end
parsed_stations()
click to toggle source
# File lib/capital-bikeshare/client.rb, line 24 def parsed_stations station_elements = station_xml_document.elements.first.elements station_elements.map { |station| Station.new(station) } end
station_xml_document()
click to toggle source
# File lib/capital-bikeshare/client.rb, line 20 def station_xml_document REXML::Document.new(@station_data) end
stations()
click to toggle source
# File lib/capital-bikeshare/client.rb, line 29 def stations @station_set.to_a end