bikeshare 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/bikeshare.rb +16 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjVjN2FhNjU4NWU2ZjdiYjcxODZlNTFmMmJmMDZkMmVlZWM1NDg2Mg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MGMwMGEzYTlkNDQ4MjJkYTNjYTBiOTNkYmZjNTNjMjdjM2Y3ZDI5MA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MmFjNjc3ZTUxOTQ0MTg5MTI1MzUwMzIzNjk2MDJiOTJhZDZjMGUyZWRiZTBm
|
10
|
+
ZjdkM2MwZDZkNjI2NDg3OTRlYWJmYjM2OTI4ZGJiYmYxOTljN2MxMGRhM2My
|
11
|
+
M2RhZTAyOGI2MzEwM2ZiYmQ4ZGUzMTQ3MmJmMmMzM2ZjNTZjYjc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OWRlNjNiZTI0YmYxMjUzZGIxNWVjOTM4MmExZTVlMDFmNTgwOWVjZDIzZjc3
|
14
|
+
YzM5OGVjZWEzMGJlNTM1ZmQzNGU5NjJiNjljOGE1NTY3MjcyNzZhYWRlMTM4
|
15
|
+
ZDlmMjM3MjFiOWY5ZjlmMjc4ZmNhNzU4MWFjOTJhMDJkOTVmNWE=
|
data/lib/bikeshare.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
class BikeShare
|
2
2
|
|
3
3
|
FIRST_STATION_ID = 2
|
4
|
+
BAY_AREA_BIKE_JSON_URL = "http://bayareabikeshare.com/stations/json"
|
4
5
|
|
5
|
-
def initialize
|
6
|
-
|
6
|
+
def initialize url = nil
|
7
|
+
response_url = url || BAY_AREA_BIKE_JSON_URL
|
8
|
+
|
9
|
+
response = JSON.parse(open(response_url).read)
|
7
10
|
@response = response["stationBeanList"]
|
8
11
|
end
|
9
12
|
|
@@ -81,6 +84,17 @@ class BikeShare
|
|
81
84
|
list.empty? ? [] : list
|
82
85
|
end
|
83
86
|
|
87
|
+
def lat_and_long(station_id)
|
88
|
+
check_valid_station_id!(station_id)
|
89
|
+
|
90
|
+
station = @response.select { |station| station["id"] == station_id }
|
91
|
+
|
92
|
+
lat = station.first["latitude"]
|
93
|
+
long = station.first["longitude"]
|
94
|
+
|
95
|
+
[lat, long]
|
96
|
+
end
|
97
|
+
|
84
98
|
private
|
85
99
|
|
86
100
|
def check_valid_station_id!(station_id)
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bikeshare
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zack Shapiro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description: A Ruby wrapper for Bay Area Bike Share bike and station information.
|
14
14
|
email: zack@zackshapiro.com
|
15
15
|
executables: []
|
16
16
|
extensions: []
|
@@ -40,5 +40,5 @@ rubyforge_project:
|
|
40
40
|
rubygems_version: 2.0.7
|
41
41
|
signing_key:
|
42
42
|
specification_version: 4
|
43
|
-
summary: A Ruby wrapper for Bay Area Bike Share station information
|
43
|
+
summary: A Ruby wrapper for Bay Area Bike Share bike and station information.
|
44
44
|
test_files: []
|