ruby_rides 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.rspec +2 -0
- data/Gemfile +8 -0
- data/README.md +31 -13
- data/Rakefile +20 -1
- data/lib/ruby_rides/client.rb +42 -0
- data/lib/ruby_rides/version.rb +1 -1
- data/lib/ruby_rides.rb +5 -2
- data/ruby_rides.gemspec +5 -3
- data/spec/fixtures/.DS_Store +0 -0
- data/spec/fixtures/station_data.json +1 -0
- data/spec/fixtures/station_geo_locations.json +1 -0
- data/spec/ruby_rides/client_spec.rb +63 -0
- data/spec/ruby_rides_spec.rb +4 -0
- data/spec/spec_helper.rb +35 -0
- metadata +36 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ab170a6b32cb4ac40276ed8d07a0372a14af4be
|
4
|
+
data.tar.gz: b7069a0d42ce21b13a2809e88657fd09d2083ef4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a05fefdccfbb39796f92c4eb4b51d0cbf91dbd431ee34147f387c26145b87a9121ea6c2a6465ed7be7f327b7d91fbdf49feaea073116f087b9a3d9c8507a3308
|
7
|
+
data.tar.gz: fc0e3189520fe7840cbedbcae9ecb0c021789a3fcbece8b218f947532ae0a97211ea09f1461683f6173c8449667e78b3d26176a3f91594cc2695b3df61b4f8db
|
data/.gitignore
CHANGED
data/.rspec
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,24 +1,42 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
1
|
+
#ruby_rides
|
2
|
+
---
|
3
|
+
A Ruby gem to interface with Hubway's API.
|
4
4
|
|
5
5
|
## Installation
|
6
|
+
```ruby
|
7
|
+
gem install ruby_rides
|
8
|
+
```
|
9
|
+
Alternately, you can include this line in your Gemfile...
|
10
|
+
```ruby
|
11
|
+
gem 'ruby_rides'
|
12
|
+
```
|
6
13
|
|
7
|
-
|
8
|
-
|
9
|
-
|
14
|
+
And bundle install.
|
15
|
+
```ruby
|
16
|
+
$ bundle
|
17
|
+
```
|
10
18
|
|
11
|
-
|
19
|
+
## Configuration
|
20
|
+
To use the gem, you'll need to register with the Hubway data API, linked below, to acquire a username and apikey.
|
12
21
|
|
13
|
-
|
22
|
+
http://hubwaydatachallenge.org/data-api/
|
14
23
|
|
15
|
-
|
24
|
+
Define a client using your credentials, which I'd suggest you access using a .env file. Once this is set up, you can access gem methods in your application.
|
16
25
|
|
17
|
-
|
26
|
+
```ruby
|
27
|
+
client = RubyRides::Client.new(client_id: YOUR_USERNAME, client_api_key: YOUR_APIKEY)
|
28
|
+
```
|
18
29
|
|
19
|
-
|
30
|
+
# Usage
|
31
|
+
Return a hash listing data for all Hubway stations in the dataset.
|
32
|
+
```ruby
|
33
|
+
client.station_data
|
34
|
+
```
|
20
35
|
|
21
|
-
|
36
|
+
Return a location hash of all Hubway stations in the dataset with lat/long values for each and names as the key values.
|
37
|
+
```ruby
|
38
|
+
client.station_geo_locations
|
39
|
+
```
|
22
40
|
|
23
41
|
## Contributing
|
24
42
|
|
@@ -26,4 +44,4 @@ TODO: Write usage instructions here
|
|
26
44
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
45
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
46
|
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
-
5. Create new Pull Request
|
47
|
+
5. Create new Pull Request
|
data/Rakefile
CHANGED
@@ -1 +1,20 @@
|
|
1
|
-
|
1
|
+
# Gives me a few helper tasks:
|
2
|
+
|
3
|
+
# `rake build`
|
4
|
+
# is
|
5
|
+
# gem build ga-example-gem.gemspec
|
6
|
+
|
7
|
+
# `rake release`
|
8
|
+
# is, and also tags it in Github for us
|
9
|
+
# gem push ga-example-gem-0.0.3.gem
|
10
|
+
|
11
|
+
require 'bundler'
|
12
|
+
Bundler::GemHelper.install_tasks
|
13
|
+
|
14
|
+
# Pulls in equiv of 'rspec spec' to be 'rake spec'
|
15
|
+
require 'rspec/core/rake_task'
|
16
|
+
RSpec::Core::RakeTask.new(:spec)
|
17
|
+
|
18
|
+
# If you just run 'rake', it will run 'rake spec'
|
19
|
+
task test: :spec
|
20
|
+
task default: :spec
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'pry'
|
3
|
+
|
4
|
+
module RubyRides
|
5
|
+
class Client
|
6
|
+
include HTTParty
|
7
|
+
|
8
|
+
attr_accessor :options
|
9
|
+
|
10
|
+
def initialize(options={})
|
11
|
+
if options[:client_id].nil? || options[:client_api_key].nil?
|
12
|
+
raise ArgumentError.new ("A client_username and client_api_key must be present in the options hash.")
|
13
|
+
end
|
14
|
+
@options = options
|
15
|
+
end
|
16
|
+
|
17
|
+
def client_id
|
18
|
+
@options[:client_id]
|
19
|
+
end
|
20
|
+
|
21
|
+
def client_api_key
|
22
|
+
@options[:client_api_key]
|
23
|
+
end
|
24
|
+
|
25
|
+
def station_data
|
26
|
+
JSON.parse HTTParty.get("http://hubwaydatachallenge.org/api/v1/station/?format=json&username=#{@options[:client_id]}&api_key=#{@options[:client_api_key]}").body
|
27
|
+
end
|
28
|
+
|
29
|
+
def station_geo_locations
|
30
|
+
json = JSON.parse HTTParty.get("http://hubwaydatachallenge.org/api/v1/station/?format=json&username=#{@options[:client_id]}&api_key=#{@options[:client_api_key]}")
|
31
|
+
data = json['objects']
|
32
|
+
station_coordinates = {}
|
33
|
+
|
34
|
+
data.each do |d|
|
35
|
+
h = Hash["#{d['name']}", d['point']['coordinates']]
|
36
|
+
station_coordinates.merge!(h)
|
37
|
+
end
|
38
|
+
station_coordinates
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
data/lib/ruby_rides/version.rb
CHANGED
data/lib/ruby_rides.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
-
require "ruby_rides/version"
|
1
|
+
#require "ruby_rides/version.rb"
|
2
|
+
require "ruby_rides/client.rb"
|
2
3
|
|
3
4
|
module RubyRides
|
4
|
-
|
5
|
+
|
5
6
|
end
|
7
|
+
|
8
|
+
# client = RubyRides::Client.new(client_id: 'darkmoves', client_api_key: '7e35876d7b16b77d95712373f06a463bb21eeb32')
|
data/ruby_rides.gemspec
CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = RubyRides::VERSION
|
9
9
|
spec.authors = ["Matt Clement"]
|
10
10
|
spec.email = ["darkmoves@gmail.com"]
|
11
|
-
spec.description = %q{Access to Hubway data set through
|
12
|
-
spec.summary = %q{This is a ruby wrapper
|
13
|
-
spec.homepage = ""
|
11
|
+
spec.description = %q{Access to Hubway data set through API.}
|
12
|
+
spec.summary = %q{This is a ruby wrapper to access data in the Hubway API. Specifically, a list of data for each Hubway station is accessible as well as a hash with lat/long data for each station, using staiton name as a hash key.}
|
13
|
+
spec.homepage = "https://github.com/darkmoves/ruby_rides"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
@@ -21,4 +21,6 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
22
|
spec.add_development_dependency "rake"
|
23
23
|
spec.add_development_dependency "httparty"
|
24
|
+
spec.add_development_dependency "pry"
|
25
|
+
|
24
26
|
end
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
{"meta": {"limit": 100, "next": null, "offset": 0, "previous": null, "total_count": 95}, "objects": [{"id": 3, "installdate": null, "installed": true, "locked": false, "name": "Colleges of the Fenway", "point": {"coordinates": [-71.100812, 42.340021], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/3/", "temporary": false, "terminalname": "B32006"}, {"id": 4, "installdate": null, "installed": true, "locked": false, "name": "Tremont St. at Berkeley St.", "point": {"coordinates": [-71.069616, 42.345392], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/4/", "temporary": false, "terminalname": "C32000"}, {"id": 5, "installdate": null, "installed": true, "locked": false, "name": "Northeastern U / North Parking Lot", "point": {"coordinates": [-71.090179, 42.341814], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/5/", "temporary": false, "terminalname": "B32012"}, {"id": 6, "installdate": null, "installed": true, "locked": false, "name": "Cambridge St. at Joy St.", "point": {"coordinates": [-71.06514, 42.361285], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/6/", "temporary": false, "terminalname": "D32000"}, {"id": 7, "installdate": "2011-09-23T00:00:00", "installed": true, "locked": false, "name": "Fan Pier", "point": {"coordinates": [-71.044624, 42.353412], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/7/", "temporary": false, "terminalname": "A32000"}, {"id": 8, "installdate": null, "installed": true, "locked": false, "name": "Union Square - Brighton Ave. at Cambridge St.", "point": {"coordinates": [-71.137313, 42.353334], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/8/", "temporary": false, "terminalname": "A32001"}, {"id": 9, "installdate": "2012-03-23T14:24:00", "installed": true, "locked": false, "name": "Agganis Arena - 925 Comm Ave.", "point": {"coordinates": [-71.116174, 42.351313], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/9/", "temporary": false, "terminalname": "A32002"}, {"id": 10, "installdate": null, "installed": true, "locked": false, "name": "B.U. Central - 725 Comm. Ave.", "point": {"coordinates": [-71.105884, 42.350075], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/10/", "temporary": false, "terminalname": "A32003"}, {"id": 11, "installdate": null, "installed": true, "locked": false, "name": "Longwood Ave / Binney St", "point": {"coordinates": [-71.1065, 42.338629], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/11/", "temporary": false, "terminalname": "A32004"}, {"id": 12, "installdate": null, "installed": true, "locked": false, "name": "Ruggles Station / Columbus Ave.", "point": {"coordinates": [-71.088496, 42.335911], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/12/", "temporary": false, "terminalname": "B32002"}, {"id": 13, "installdate": null, "installed": true, "locked": false, "name": "Boston Medical Center - 721 Mass. Ave.", "point": {"coordinates": [-71.07403, 42.334057], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/13/", "temporary": false, "terminalname": "C32002"}, {"id": 14, "installdate": null, "installed": true, "locked": false, "name": "Louis Pasteur / Longwood Ave", "point": {"coordinates": [-71.102797, 42.337171], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/14/", "temporary": false, "terminalname": "B32003"}, {"id": 15, "installdate": "2012-07-31T17:16:00", "installed": true, "locked": false, "name": "Harvard Real Estate - Brighton Mills - 370 Western Ave", "point": {"coordinates": [-71.13802, 42.361667], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/15/", "temporary": false, "terminalname": "A32005"}, {"id": 16, "installdate": null, "installed": true, "locked": false, "name": "Back Bay / South End Station", "point": {"coordinates": [-71.076163, 42.347433], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/16/", "temporary": false, "terminalname": "C32003"}, {"id": 17, "installdate": null, "installed": true, "locked": false, "name": "Harvard University Housing - 111 Western Ave. at Soldiers Field Park ", "point": {"coordinates": [-71.119581, 42.365074], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/17/", "temporary": false, "terminalname": "A32006"}, {"id": 18, "installdate": null, "installed": true, "locked": false, "name": "Harvard Real Estate - 219 Western Ave. at North Harvard St.", "point": {"coordinates": [-71.129791, 42.36337], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/18/", "temporary": false, "terminalname": "A32007"}, {"id": 19, "installdate": "2012-08-10T14:25:00", "installed": true, "locked": false, "name": "Buswell Park", "point": {"coordinates": [-71.105828, 42.347527], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/19/", "temporary": false, "terminalname": "A32008"}, {"id": 20, "installdate": null, "installed": true, "locked": false, "name": "Aquarium Station - 200 Atlantic Ave.", "point": {"coordinates": [-71.051601, 42.35977], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/20/", "temporary": false, "terminalname": "B32004"}, {"id": 21, "installdate": "2012-03-14T14:51:00", "installed": true, "locked": false, "name": "Prudential Center / Belvidere", "point": {"coordinates": [-71.082578, 42.345959], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/21/", "temporary": false, "terminalname": "C32007"}, {"id": 22, "installdate": null, "installed": true, "locked": false, "name": "South Station - 700 Atlantic Ave.", "point": {"coordinates": [-71.055547, 42.352175], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/22/", "temporary": false, "terminalname": "A32010"}, {"id": 23, "installdate": null, "installed": true, "locked": false, "name": "Mayor Thomas M. Menino - Government Center", "point": {"coordinates": [-71.059364, 42.359677], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/23/", "temporary": false, "terminalname": "B32008"}, {"id": 24, "installdate": null, "installed": true, "locked": false, "name": "Seaport Square - Seaport Blvd. at Boston Wharf", "point": {"coordinates": [-71.045461, 42.351821], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/24/", "temporary": false, "terminalname": "B32007"}, {"id": 25, "installdate": null, "installed": true, "locked": false, "name": "Tremont St / W Newton St", "point": {"coordinates": [-71.076847, 42.341332], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/25/", "temporary": false, "terminalname": "A32009"}, {"id": 26, "installdate": "2012-03-28T13:01:00", "installed": true, "locked": false, "name": "Washington St. at Waltham St.", "point": {"coordinates": [-71.068922, 42.341522], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/26/", "temporary": false, "terminalname": "D32002"}, {"id": 27, "installdate": null, "installed": true, "locked": false, "name": "Roxbury Crossing Station", "point": {"coordinates": [-71.094734, 42.331567], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/27/", "temporary": false, "terminalname": "C32001"}, {"id": 29, "installdate": null, "installed": true, "locked": false, "name": "Innovation Lab - 125 Western Ave. at Batten Way", "point": {"coordinates": [-71.124565, 42.363732], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/29/", "temporary": false, "terminalname": "A32011"}, {"id": 30, "installdate": null, "installed": true, "locked": false, "name": "Brigham Cir / Huntington Ave", "point": {"coordinates": [-71.105221, 42.334073], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/30/", "temporary": false, "terminalname": "B32013"}, {"id": 31, "installdate": "2012-03-28T13:02:00", "installed": true, "locked": false, "name": "Seaport Hotel", "point": {"coordinates": [-71.041747, 42.348833], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/31/", "temporary": false, "terminalname": "B32014"}, {"id": 32, "installdate": null, "installed": true, "locked": false, "name": "Landmark Centre", "point": {"coordinates": [-71.102221, 42.343912], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/32/", "temporary": false, "terminalname": "B32015"}, {"id": 33, "installdate": null, "installed": true, "locked": false, "name": "Kenmore Sq / Comm Ave", "point": {"coordinates": [-71.096831, 42.349046], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/33/", "temporary": false, "terminalname": "B32010"}, {"id": 34, "installdate": null, "installed": true, "locked": false, "name": "Overland St at Brookline Ave", "point": {"coordinates": [-71.099855, 42.346171], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/34/", "temporary": false, "terminalname": "B32009"}, {"id": 35, "installdate": null, "installed": true, "locked": false, "name": "Summer St. / Arch St.", "point": {"coordinates": [-71.05896, 42.354594], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/35/", "temporary": false, "terminalname": "D32004"}, {"id": 36, "installdate": null, "installed": true, "locked": false, "name": "Boston Public Library - 700 Boylston St.", "point": {"coordinates": [-71.077303, 42.349673], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/36/", "temporary": false, "terminalname": "D32005"}, {"id": 37, "installdate": null, "installed": true, "locked": false, "name": "New Balance - 38 Guest St.", "point": {"coordinates": [-71.146452, 42.357247], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/37/", "temporary": false, "terminalname": "D32001"}, {"id": 38, "installdate": null, "installed": true, "locked": false, "name": "TD Garden - Legends Way", "point": {"coordinates": [-71.060868, 42.366231], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/38/", "temporary": false, "terminalname": "D32003"}, {"id": 39, "installdate": null, "installed": true, "locked": false, "name": "Washington St. at Rutland St.", "point": {"coordinates": [-71.074182, 42.338623], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/39/", "temporary": false, "terminalname": "C32006"}, {"id": 40, "installdate": null, "installed": true, "locked": false, "name": "Lewis Wharf - Atlantic Ave.", "point": {"coordinates": [-71.050877, 42.363871], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/40/", "temporary": false, "terminalname": "D32006"}, {"id": 41, "installdate": null, "installed": true, "locked": false, "name": "Packard's Corner - Comm. Ave. at Brighton Ave.", "point": {"coordinates": [-71.123831, 42.352261], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/41/", "temporary": false, "terminalname": "A32012"}, {"id": 42, "installdate": null, "installed": true, "locked": false, "name": "Boylston St. at Arlington St.", "point": {"coordinates": [-71.070378, 42.352096], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/42/", "temporary": false, "terminalname": "D32007"}, {"id": 43, "installdate": null, "installed": true, "locked": false, "name": "Rowes Wharf - Atlantic Ave", "point": {"coordinates": [-71.050699, 42.357143], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/43/", "temporary": false, "terminalname": "D32008"}, {"id": 44, "installdate": null, "installed": true, "locked": false, "name": "Faneuil Hall - Union St. at North St.", "point": {"coordinates": [-71.056868, 42.360583], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/44/", "temporary": false, "terminalname": "D32009"}, {"id": 45, "installdate": null, "installed": true, "locked": false, "name": "Yawkey Way at Boylston St.", "point": {"coordinates": [-71.09788, 42.344763], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/45/", "temporary": false, "terminalname": "B32011"}, {"id": 46, "installdate": null, "installed": true, "locked": false, "name": "Christian Science Plaza", "point": {"coordinates": [-71.085918, 42.343864], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/46/", "temporary": false, "terminalname": "B32005"}, {"id": 47, "installdate": null, "installed": true, "locked": false, "name": "Cross St. at Hanover St.", "point": {"coordinates": [-71.056067, 42.362811], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/47/", "temporary": false, "terminalname": "D32010"}, {"id": 48, "installdate": null, "installed": true, "locked": false, "name": "Post Office Square", "point": {"coordinates": [-71.055407, 42.356755], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/48/", "temporary": false, "terminalname": "D32012"}, {"id": 49, "installdate": "2012-03-14T15:02:00", "installed": true, "locked": false, "name": "Stuart St. at Charles St.", "point": {"coordinates": [-71.066289, 42.351146], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/49/", "temporary": false, "terminalname": "D32011"}, {"id": 50, "installdate": "2012-03-28T14:21:00", "installed": true, "locked": false, "name": "Boylston St / Berkeley St", "point": {"coordinates": [-71.073644, 42.350989], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/50/", "temporary": false, "terminalname": "D32013"}, {"id": 51, "installdate": null, "installed": true, "locked": false, "name": "Washington St. at Lenox St.", "point": {"coordinates": [-71.0790969, 42.3348756], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/51/", "temporary": false, "terminalname": "C32005"}, {"id": 52, "installdate": null, "installed": true, "locked": false, "name": "Newbury St / Hereford St", "point": {"coordinates": [-71.085954, 42.348717], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/52/", "temporary": false, "terminalname": "B32000"}, {"id": 53, "installdate": null, "installed": true, "locked": false, "name": "Beacon St / Mass Ave", "point": {"coordinates": [-71.089886, 42.350851], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/53/", "temporary": false, "terminalname": "B32016"}, {"id": 54, "installdate": "2012-03-28T14:22:00", "installed": true, "locked": false, "name": "Tremont St / West St", "point": {"coordinates": [-71.063348, 42.354979], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/54/", "temporary": false, "terminalname": "D32014"}, {"id": 55, "installdate": "2011-08-19T00:00:00", "installed": true, "locked": false, "name": "Boylston / Mass Ave", "point": {"coordinates": [-71.088088, 42.347265], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/55/", "temporary": false, "terminalname": "B32018"}, {"id": 56, "installdate": null, "installed": true, "locked": false, "name": "Dudley Square", "point": {"coordinates": [-71.0833545, 42.3281898], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/56/", "temporary": false, "terminalname": "B32017"}, {"id": 57, "installdate": "2011-08-19T00:00:00", "installed": true, "locked": false, "name": "Columbus Ave. at Mass. Ave.", "point": {"coordinates": [-71.081572, 42.340799], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/57/", "temporary": false, "terminalname": "C32004"}, {"id": 58, "installdate": "2011-08-29T16:49:00", "installed": true, "locked": false, "name": "The Esplanade - Beacon St. at Arlington St.", "point": {"coordinates": [-71.07278, 42.355596], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/58/", "temporary": false, "terminalname": "D32017"}, {"id": 59, "installdate": "2011-08-31T00:00:00", "installed": true, "locked": false, "name": "Chinatown Gate Plaza - Surface Rd. at Beach St.", "point": {"coordinates": [-71.059367, 42.351356], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/59/", "temporary": false, "terminalname": "D32015"}, {"id": 60, "installdate": "2011-09-23T00:00:00", "installed": true, "locked": false, "name": "Charles Circle - Charles St. at Cambridge St.", "point": {"coordinates": [-71.07131, 42.360877], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/60/", "temporary": false, "terminalname": "D32016"}, {"id": 61, "installdate": "2011-09-23T00:00:00", "installed": true, "locked": false, "name": "Boylston at Fairfield", "point": {"coordinates": [-71.082674, 42.348323], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/61/", "temporary": false, "terminalname": "C32008"}, {"id": 62, "installdate": "2011-10-14T00:00:00", "installed": true, "locked": false, "name": "Longwood Ave/Riverway", "point": {"coordinates": [-71.109927, 42.340299], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/62/", "temporary": false, "terminalname": "B32019"}, {"id": 63, "installdate": "2011-10-19T00:00:00", "installed": true, "locked": false, "name": "Dorchester Ave. at Gillette Park", "point": {"coordinates": [-71.057054, 42.344023], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/63/", "temporary": false, "terminalname": "C32009"}, {"id": 64, "installdate": null, "installed": true, "locked": false, "name": "Congress / Sleeper", "point": {"coordinates": [-71.0496, 42.3511], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/64/", "temporary": false, "terminalname": "C32010"}, {"id": 65, "installdate": "2012-03-09T11:52:00", "installed": true, "locked": false, "name": "Boston Convention & Exhibition Center", "point": {"coordinates": [-71.0441, 42.3475], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/65/", "temporary": false, "terminalname": "D32018"}, {"id": 66, "installdate": "2012-08-03T17:11:00", "installed": true, "locked": false, "name": "Allston Green District - Commonwealth Ave & Griggs St", "point": {"coordinates": [-71.13401, 42.348607], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/66/", "temporary": false, "terminalname": "A32017"}, {"id": 67, "installdate": "2012-08-03T12:10:00", "installed": true, "locked": false, "name": "MIT at Mass Ave / Amherst St", "point": {"coordinates": [-71.093198, 42.3581], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/67/", "temporary": false, "terminalname": "M32006"}, {"id": 68, "installdate": "2012-07-31T17:13:00", "installed": true, "locked": false, "name": "Central Square at Mass Ave / Essex St", "point": {"coordinates": [-71.1031, 42.36507], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/68/", "temporary": false, "terminalname": "M32011"}, {"id": 69, "installdate": "2012-08-03T12:23:00", "installed": true, "locked": false, "name": "Coolidge Corner - Beacon St @ Centre St", "point": {"coordinates": [-71.123338, 42.341598], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/69/", "temporary": false, "terminalname": "K32001"}, {"id": 70, "installdate": "2012-07-31T17:16:00", "installed": true, "locked": false, "name": "Harvard Kennedy School at Bennett St / Eliot St", "point": {"coordinates": [-71.121851, 42.372244], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/70/", "temporary": false, "terminalname": "M32016"}, {"id": 71, "installdate": "2012-08-14T09:44:00", "installed": true, "locked": false, "name": "Conway Park - Somerville Avenue", "point": {"coordinates": [-71.107593, 42.383405], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/71/", "temporary": false, "terminalname": "S32004"}, {"id": 72, "installdate": "2012-08-14T11:08:00", "installed": true, "locked": false, "name": "One Broadway / Kendall Sq at Main St / 3rd St", "point": {"coordinates": [-71.084105, 42.362613], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/72/", "temporary": false, "terminalname": "M32003"}, {"id": 73, "installdate": "2012-07-30T17:17:00", "installed": true, "locked": false, "name": "Harvard Square at Brattle St / Eliot St", "point": {"coordinates": [-71.120886, 42.373231], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/73/", "temporary": false, "terminalname": "M32017"}, {"id": 74, "installdate": "2012-07-30T17:15:00", "installed": true, "locked": false, "name": "Harvard Square at Mass Ave/ Dunster", "point": {"coordinates": [-71.118579, 42.373268], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/74/", "temporary": false, "terminalname": "M32018"}, {"id": 75, "installdate": "2012-07-30T17:17:00", "installed": true, "locked": false, "name": "Lafayette Square at Mass Ave / Main St / Columbia St", "point": {"coordinates": [-71.10042, 42.363562], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/75/", "temporary": false, "terminalname": "M32009"}, {"id": 76, "installdate": "2012-07-30T17:11:00", "installed": true, "locked": false, "name": "Central Sq Post Office / Cambridge City Hall at Mass Ave / Pleasant St", "point": {"coordinates": [-71.105495, 42.366426], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/76/", "temporary": false, "terminalname": "M32012"}, {"id": 77, "installdate": "2012-08-01T14:28:00", "installed": true, "locked": false, "name": "Somerville City Hall", "point": {"coordinates": [-71.096413, 42.386428], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/77/", "temporary": false, "terminalname": "S32001"}, {"id": 78, "installdate": "2012-08-01T14:28:00", "installed": true, "locked": false, "name": "Union Square - Somerville", "point": {"coordinates": [-71.095319, 42.379637], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/78/", "temporary": false, "terminalname": "S32002"}, {"id": 79, "installdate": "2012-08-01T17:19:00", "installed": true, "locked": false, "name": "Beacon St at Washington / Kirkland", "point": {"coordinates": [-71.106541, 42.378551], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/79/", "temporary": false, "terminalname": "S32003"}, {"id": 80, "installdate": "2012-08-07T10:22:00", "installed": true, "locked": false, "name": "MIT Stata Center at Vassar St / Main St", "point": {"coordinates": [-71.090188, 42.362429], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/80/", "temporary": false, "terminalname": "M32005"}, {"id": 81, "installdate": "2012-08-03T12:13:00", "installed": true, "locked": false, "name": "Boylston St / Washington St", "point": {"coordinates": [-71.062679, 42.352409], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/81/", "temporary": false, "terminalname": "D32019"}, {"id": 82, "installdate": "2012-08-03T17:08:00", "installed": true, "locked": false, "name": "Brookline Town Hall / Library Washington St", "point": {"coordinates": [-71.120526, 42.333689], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/82/", "temporary": false, "terminalname": "K32002"}, {"id": 83, "installdate": "2012-08-07T12:39:00", "installed": true, "locked": false, "name": "South Bay Plaza", "point": {"coordinates": [-71.065928, 42.325941], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/83/", "temporary": false, "terminalname": "C32011"}, {"id": 84, "installdate": "2012-08-10T16:12:00", "installed": true, "locked": false, "name": "CambridgeSide Galleria - CambridgeSide PL at Land Blvd", "point": {"coordinates": [-71.076472, 42.366981], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/84/", "temporary": false, "terminalname": "M32019"}, {"id": 85, "installdate": "2012-08-10T08:19:00", "installed": true, "locked": false, "name": "Andrew Station - Dorchester Ave at Humboldt Pl", "point": {"coordinates": [-71.057007, 42.330825], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/85/", "temporary": false, "terminalname": "C32012"}, {"id": 86, "installdate": "2012-08-14T13:27:00", "installed": true, "locked": false, "name": "Brookline Village - Station Street @ MBTA", "point": {"coordinates": [-71.116205, 42.332799], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/86/", "temporary": false, "terminalname": "K32003"}, {"id": 87, "installdate": "2012-09-07T14:45:00", "installed": true, "locked": false, "name": "Harvard University Housing - 115 Putnam Ave at Peabody Terrace", "point": {"coordinates": [-71.114214, 42.366621], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/87/", "temporary": false, "terminalname": "M32014"}, {"id": 88, "installdate": "2012-08-29T15:27:00", "installed": true, "locked": false, "name": "Inman Square at Vellucci Plaza / Hampshire St", "point": {"coordinates": [-71.101427, 42.374035], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/88/", "temporary": false, "terminalname": "M32010"}, {"id": 89, "installdate": "2012-09-07T12:40:00", "installed": true, "locked": false, "name": "Harvard Law School at Mass Ave / Jarvis St", "point": {"coordinates": [-71.119945, 42.379011], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/89/", "temporary": false, "terminalname": "M32020"}, {"id": 90, "installdate": "2012-08-29T20:21:00", "installed": true, "locked": false, "name": "Lechmere Station at Cambridge St / First St", "point": {"coordinates": [-71.07711, 42.3707], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/90/", "temporary": false, "terminalname": "M32001"}, {"id": 91, "installdate": "2012-08-29T11:57:00", "installed": true, "locked": false, "name": "One Kendall Square at Hampshire St / Portland St", "point": {"coordinates": [-71.09169, 42.366277], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/91/", "temporary": false, "terminalname": "M32002"}, {"id": 92, "installdate": "2012-09-07T16:26:00", "installed": true, "locked": false, "name": "University of Massachusetts Boston", "point": {"coordinates": [-71.035705, 42.311819], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/92/", "temporary": false, "terminalname": "C32014"}, {"id": 93, "installdate": "2012-09-07T18:54:00", "installed": true, "locked": false, "name": "JFK / UMASS Station", "point": {"coordinates": [-71.051122, 42.320494], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/93/", "temporary": false, "terminalname": "C32013"}, {"id": 94, "installdate": "2012-09-11T09:39:00", "installed": true, "locked": false, "name": "Charlestown - Main St at Austin St", "point": {"coordinates": [-71.064608, 42.375603], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/94/", "temporary": false, "terminalname": "D32020"}, {"id": 95, "installdate": "2012-09-11T10:49:00", "installed": true, "locked": false, "name": "Cambridge St - at Columbia St / Webster Ave", "point": {"coordinates": [-71.094445, 42.372969], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/95/", "temporary": false, "terminalname": "M32007"}, {"id": 96, "installdate": "2012-09-11T12:12:00", "installed": true, "locked": false, "name": "Cambridge Main Library at Broadway / Trowbridge St", "point": {"coordinates": [-71.111075, 42.373379], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/96/", "temporary": false, "terminalname": "M32013"}, {"id": 97, "installdate": "2012-09-11T13:46:00", "installed": true, "locked": false, "name": "Harvard University River Houses at DeWolfe St / Cowperthwaite St", "point": {"coordinates": [-71.117152, 42.369182], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/97/", "temporary": false, "terminalname": "M32015"}, {"id": 98, "installdate": "2012-09-11T15:22:00", "installed": true, "locked": false, "name": "Charlestown - Warren St at Chelsea St", "point": {"coordinates": [-71.060292, 42.371848], "type": "Point"}, "removaldate": null, "resource_uri": "/api/v1/station/98/", "temporary": false, "terminalname": "D32021"}]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"Colleges of the Fenway":[-71.100812,42.340021],"Tremont St. at Berkeley St.":[-71.069616,42.345392],"Northeastern U / North Parking Lot":[-71.090179,42.341814],"Cambridge St. at Joy St.":[-71.06514,42.361285],"Fan Pier":[-71.044624,42.353412],"Union Square - Brighton Ave. at Cambridge St.":[-71.137313,42.353334],"Agganis Arena - 925 Comm Ave.":[-71.116174,42.351313],"B.U. Central - 725 Comm. Ave.":[-71.105884,42.350075],"Longwood Ave / Binney St":[-71.1065,42.338629],"Ruggles Station / Columbus Ave.":[-71.088496,42.335911],"Boston Medical Center - 721 Mass. Ave.":[-71.07403,42.334057],"Louis Pasteur / Longwood Ave":[-71.102797,42.337171],"Harvard Real Estate - Brighton Mills - 370 Western Ave":[-71.13802,42.361667],"Back Bay / South End Station":[-71.076163,42.347433],"Harvard University Housing - 111 Western Ave. at Soldiers Field Park ":[-71.119581,42.365074],"Harvard Real Estate - 219 Western Ave. at North Harvard St.":[-71.129791,42.36337],"Buswell Park":[-71.105828,42.347527],"Aquarium Station - 200 Atlantic Ave.":[-71.051601,42.35977],"Prudential Center / Belvidere":[-71.082578,42.345959],"South Station - 700 Atlantic Ave.":[-71.055547,42.352175],"Mayor Thomas M. Menino - Government Center":[-71.059364,42.359677],"Seaport Square - Seaport Blvd. at Boston Wharf":[-71.045461,42.351821],"Tremont St / W Newton St":[-71.076847,42.341332],"Washington St. at Waltham St.":[-71.068922,42.341522],"Roxbury Crossing Station":[-71.094734,42.331567],"Innovation Lab - 125 Western Ave. at Batten Way":[-71.124565,42.363732],"Brigham Cir / Huntington Ave":[-71.105221,42.334073],"Seaport Hotel":[-71.041747,42.348833],"Landmark Centre":[-71.102221,42.343912],"Kenmore Sq / Comm Ave":[-71.096831,42.349046],"Overland St at Brookline Ave":[-71.099855,42.346171],"Summer St. / Arch St.":[-71.05896,42.354594],"Boston Public Library - 700 Boylston St.":[-71.077303,42.349673],"New Balance - 38 Guest St.":[-71.146452,42.357247],"TD Garden - Legends Way":[-71.060868,42.366231],"Washington St. at Rutland St.":[-71.074182,42.338623],"Lewis Wharf - Atlantic Ave.":[-71.050877,42.363871],"Packard's Corner - Comm. Ave. at Brighton Ave.":[-71.123831,42.352261],"Boylston St. at Arlington St.":[-71.070378,42.352096],"Rowes Wharf - Atlantic Ave":[-71.050699,42.357143],"Faneuil Hall - Union St. at North St.":[-71.056868,42.360583],"Yawkey Way at Boylston St.":[-71.09788,42.344763],"Christian Science Plaza":[-71.085918,42.343864],"Cross St. at Hanover St.":[-71.056067,42.362811],"Post Office Square":[-71.055407,42.356755],"Stuart St. at Charles St.":[-71.066289,42.351146],"Boylston St / Berkeley St":[-71.073644,42.350989],"Washington St. at Lenox St.":[-71.0790969,42.3348756],"Newbury St / Hereford St":[-71.085954,42.348717],"Beacon St / Mass Ave":[-71.089886,42.350851],"Tremont St / West St":[-71.063348,42.354979],"Boylston / Mass Ave":[-71.088088,42.347265],"Dudley Square":[-71.0833545,42.3281898],"Columbus Ave. at Mass. Ave.":[-71.081572,42.340799],"The Esplanade - Beacon St. at Arlington St.":[-71.07278,42.355596],"Chinatown Gate Plaza - Surface Rd. at Beach St.":[-71.059367,42.351356],"Charles Circle - Charles St. at Cambridge St.":[-71.07131,42.360877],"Boylston at Fairfield":[-71.082674,42.348323],"Longwood Ave/Riverway":[-71.109927,42.340299],"Dorchester Ave. at Gillette Park":[-71.057054,42.344023],"Congress / Sleeper":[-71.0496,42.3511],"Boston Convention & Exhibition Center":[-71.0441,42.3475],"Allston Green District - Commonwealth Ave & Griggs St":[-71.13401,42.348607],"MIT at Mass Ave / Amherst St":[-71.093198,42.3581],"Central Square at Mass Ave / Essex St":[-71.1031,42.36507],"Coolidge Corner - Beacon St @ Centre St":[-71.123338,42.341598],"Harvard Kennedy School at Bennett St / Eliot St":[-71.121851,42.372244],"Conway Park - Somerville Avenue":[-71.107593,42.383405],"One Broadway / Kendall Sq at Main St / 3rd St":[-71.084105,42.362613],"Harvard Square at Brattle St / Eliot St":[-71.120886,42.373231],"Harvard Square at Mass Ave/ Dunster":[-71.118579,42.373268],"Lafayette Square at Mass Ave / Main St / Columbia St":[-71.10042,42.363562],"Central Sq Post Office / Cambridge City Hall at Mass Ave / Pleasant St":[-71.105495,42.366426],"Somerville City Hall":[-71.096413,42.386428],"Union Square - Somerville":[-71.095319,42.379637],"Beacon St at Washington / Kirkland":[-71.106541,42.378551],"MIT Stata Center at Vassar St / Main St":[-71.090188,42.362429],"Boylston St / Washington St":[-71.062679,42.352409],"Brookline Town Hall / Library Washington St":[-71.120526,42.333689],"South Bay Plaza":[-71.065928,42.325941],"CambridgeSide Galleria - CambridgeSide PL at Land Blvd":[-71.076472,42.366981],"Andrew Station - Dorchester Ave at Humboldt Pl":[-71.057007,42.330825],"Brookline Village - Station Street @ MBTA":[-71.116205,42.332799],"Harvard University Housing - 115 Putnam Ave at Peabody Terrace":[-71.114214,42.366621],"Inman Square at Vellucci Plaza / Hampshire St":[-71.101427,42.374035],"Harvard Law School at Mass Ave / Jarvis St":[-71.119945,42.379011],"Lechmere Station at Cambridge St / First St":[-71.07711,42.3707],"One Kendall Square at Hampshire St / Portland St":[-71.09169,42.366277],"University of Massachusetts Boston":[-71.035705,42.311819],"JFK / UMASS Station":[-71.051122,42.320494],"Charlestown - Main St at Austin St":[-71.064608,42.375603],"Cambridge St - at Columbia St / Webster Ave":[-71.094445,42.372969],"Cambridge Main Library at Broadway / Trowbridge St":[-71.111075,42.373379],"Harvard University River Houses at DeWolfe St / Cowperthwaite St":[-71.117152,42.369182],"Charlestown - Warren St at Chelsea St":[-71.060292,42.371848]}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe RubyRides::Client do
|
4
|
+
before do
|
5
|
+
@client = RubyRides::Client.new(client_id: 'gandalf', client_api_key: 'asdf')
|
6
|
+
end
|
7
|
+
describe '.initialize' do
|
8
|
+
it 'returns a valid client when passed a client_id and client_api_key in the options hash' do
|
9
|
+
expect(@client).to be_a RubyRides::Client
|
10
|
+
end
|
11
|
+
it 'raises an ArgumentError when creating a client without client_id and/or client_api_key' do
|
12
|
+
expect{RubyRides::Client.new()}.to raise_error(ArgumentError)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '.client_id' do
|
17
|
+
it 'returns client_id of the client it\'s called on' do
|
18
|
+
expect(@client.client_id).to eq('gandalf')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '.client_api_key' do
|
23
|
+
it 'returns client_api_key of the client it\'s called on' do
|
24
|
+
expect(@client.client_api_key).to eq('asdf')
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '.station_data' do
|
29
|
+
before do
|
30
|
+
stub_request(:get, "http://hubwaydatachallenge.org/api/v1/station/?format=json&username=gandalf&api_key=asdf").to_return(body: fixture('station_data.json'))
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'makes a get request which retrieves a set of data including all Hubway stations' do
|
34
|
+
data = @client.station_data
|
35
|
+
|
36
|
+
expect(a_request(:get, "http://hubwaydatachallenge.org/api/v1/station/?format=json&username=gandalf&api_key=asdf")).to have_been_made
|
37
|
+
|
38
|
+
expect(data['objects'].first['id']).to eq(3)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe '.station_geo_locations' do
|
43
|
+
before do
|
44
|
+
stub_request(:get, "http://hubwaydatachallenge.org/api/v1/station/?format=json&username=gandalf&api_key=asdf").to_return(body: fixture('station_data.json'))
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'makes a get request which retrieves a set of data including all Hubway stations' do
|
48
|
+
@client.station_geo_locations
|
49
|
+
|
50
|
+
expect(a_request(:get, "http://hubwaydatachallenge.org/api/v1/station/?format=json&username=gandalf&api_key=asdf")).to have_been_made
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'returns a hash of Hubway station latitudes/longitudes with station names as keys' do
|
55
|
+
hash = @client.station_geo_locations
|
56
|
+
|
57
|
+
expect(hash['Colleges of the Fenway']).to eq([-71.100812, 42.340021])
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Do these first
|
2
|
+
require 'simplecov'
|
3
|
+
# Coveralls only reports when Travis runs the tests
|
4
|
+
require 'coveralls'
|
5
|
+
|
6
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
7
|
+
SimpleCov::Formatter::HTMLFormatter,
|
8
|
+
Coveralls::SimpleCov::Formatter
|
9
|
+
]
|
10
|
+
SimpleCov.start
|
11
|
+
|
12
|
+
# Require my gem itself
|
13
|
+
require 'ruby_rides'
|
14
|
+
|
15
|
+
# Require testing dependencies
|
16
|
+
require 'rspec'
|
17
|
+
require 'webmock/rspec'
|
18
|
+
|
19
|
+
# This is where you put additional rSpec configuration
|
20
|
+
RSpec.configure do |config|
|
21
|
+
config.order = 'random'
|
22
|
+
config.expect_with :rspec do |c|
|
23
|
+
c.syntax = :expect
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Helper methods for accessing fixture path
|
28
|
+
def fixture_path
|
29
|
+
File.expand_path('../fixtures', __FILE__)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Helper method for accessing a real file in the fixture path
|
33
|
+
def fixture(file)
|
34
|
+
File.new(fixture_path + '/' + file)
|
35
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_rides
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Clement
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,7 +52,21 @@ dependencies:
|
|
52
52
|
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Access to Hubway data set through API.
|
56
70
|
email:
|
57
71
|
- darkmoves@gmail.com
|
58
72
|
executables: []
|
@@ -60,14 +74,22 @@ extensions: []
|
|
60
74
|
extra_rdoc_files: []
|
61
75
|
files:
|
62
76
|
- .gitignore
|
77
|
+
- .rspec
|
63
78
|
- Gemfile
|
64
79
|
- LICENSE.txt
|
65
80
|
- README.md
|
66
81
|
- Rakefile
|
67
82
|
- lib/ruby_rides.rb
|
83
|
+
- lib/ruby_rides/client.rb
|
68
84
|
- lib/ruby_rides/version.rb
|
69
85
|
- ruby_rides.gemspec
|
70
|
-
|
86
|
+
- spec/fixtures/.DS_Store
|
87
|
+
- spec/fixtures/station_data.json
|
88
|
+
- spec/fixtures/station_geo_locations.json
|
89
|
+
- spec/ruby_rides/client_spec.rb
|
90
|
+
- spec/ruby_rides_spec.rb
|
91
|
+
- spec/spec_helper.rb
|
92
|
+
homepage: https://github.com/darkmoves/ruby_rides
|
71
93
|
licenses:
|
72
94
|
- MIT
|
73
95
|
metadata: {}
|
@@ -90,5 +112,13 @@ rubyforge_project:
|
|
90
112
|
rubygems_version: 2.0.6
|
91
113
|
signing_key:
|
92
114
|
specification_version: 4
|
93
|
-
summary: This is a ruby wrapper
|
94
|
-
|
115
|
+
summary: This is a ruby wrapper to access data in the Hubway API. Specifically, a
|
116
|
+
list of data for each Hubway station is accessible as well as a hash with lat/long
|
117
|
+
data for each station, using staiton name as a hash key.
|
118
|
+
test_files:
|
119
|
+
- spec/fixtures/.DS_Store
|
120
|
+
- spec/fixtures/station_data.json
|
121
|
+
- spec/fixtures/station_geo_locations.json
|
122
|
+
- spec/ruby_rides/client_spec.rb
|
123
|
+
- spec/ruby_rides_spec.rb
|
124
|
+
- spec/spec_helper.rb
|