lib/ruby_rides/client.rb in ruby_rides-0.0.2 vs lib/ruby_rides/client.rb in ruby_rides-0.0.3

- old
+ new

@@ -2,11 +2,11 @@ require 'pry' module RubyRides class Client include HTTParty - + base_uri "http://hubwaydatachallenge.org/api/v1" attr_accessor :options def initialize(options={}) if options[:client_id].nil? || options[:client_api_key].nil? raise ArgumentError.new ("A client_username and client_api_key must be present in the options hash.") @@ -21,14 +21,14 @@ def client_api_key @options[:client_api_key] end def station_data - JSON.parse HTTParty.get("http://hubwaydatachallenge.org/api/v1/station/?format=json&username=#{@options[:client_id]}&api_key=#{@options[:client_api_key]}").body + JSON.parse self.class.get("/station/?format=json&username=#{@options[:client_id]}&api_key=#{@options[:client_api_key]}").body end def station_geo_locations - json = JSON.parse HTTParty.get("http://hubwaydatachallenge.org/api/v1/station/?format=json&username=#{@options[:client_id]}&api_key=#{@options[:client_api_key]}") + json = JSON.parse self.class.get("/station/?format=json&username=#{@options[:client_id]}&api_key=#{@options[:client_api_key]}").body data = json['objects'] station_coordinates = {} data.each do |d| h = Hash["#{d['name']}", d['point']['coordinates']] \ No newline at end of file