citybikes_api 2.0.0 → 2.0.1
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 +4 -4
- data/README.md +34 -8
- data/citybikes_api.gemspec +2 -2
- data/lib/citybikes_api.rb +11 -4
- data/lib/citybikes_api/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88d592037677bcce62bf6d8ea72179f13542958f
|
4
|
+
data.tar.gz: 2fd4f6eca577525be49fccc20d88d3f835465c93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ce0f7e19774e6a2e0e6836f082f806223938bf33f09cd4b9365abdc87ba1264b639a409d09fbb120a48aae3257da15a247a12ac8254819519d67a3add9de987
|
7
|
+
data.tar.gz: 91e697245f6b6ea3d759ddc4c930bf94f6b8c4bfc2c51b3d89c0ad16e17988d7f4480bc9ee77cab321c7062c553feae240bf3b1012e6026321f1804ae15a26b0
|
data/README.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
#
|
1
|
+
# CityBikes API - Ruby :bike: :bike: :bike:
|
2
2
|
|
3
|
-
A ruby interface to the [CityBikes API](http://api.citybik.es/v2/)
|
4
|
-
|
3
|
+
A ruby interface to the [CityBikes API](http://api.citybik.es/v2/) v2.
|
4
|
+
Returns data about bike-share networks and stations.
|
5
|
+
Includes options to customize API requests.
|
5
6
|
|
6
7
|
[](https://badge.fury.io/rb/citybikes_api)
|
7
8
|
|
@@ -15,21 +16,46 @@ gem install citybikes_api
|
|
15
16
|
|
16
17
|
## Usage
|
17
18
|
|
18
|
-
|
19
|
+
### Requests
|
20
|
+
|
21
|
+
#### Networks Endpoint
|
22
|
+
|
23
|
+
List all bike-share networks.
|
19
24
|
|
20
25
|
```` rb
|
21
26
|
response = CitybikesApi.networks
|
22
|
-
puts response["networks"]
|
27
|
+
puts response["networks"] #=> returns an Array of Hash objects
|
23
28
|
````
|
24
29
|
|
25
|
-
|
30
|
+
#### Network Endpoint
|
31
|
+
|
32
|
+
Find a bike-share network by its CityBikes identifier.
|
26
33
|
|
27
34
|
```` rb
|
35
|
+
network_id = "capital-bikeshare"
|
28
36
|
response = CitybikesApi.network(network_id)
|
29
|
-
puts response["network"]
|
30
|
-
|
37
|
+
puts response["network"] #=> returns a Hash object
|
38
|
+
````
|
39
|
+
|
40
|
+
### Request Options
|
41
|
+
|
42
|
+
Customize any network request by passing URL parameters.
|
43
|
+
|
44
|
+
```` rb
|
45
|
+
request_options = {:fields => "id,name,href"}
|
46
|
+
response = CitybikesApi.networks(request_options)
|
47
|
+
puts response["networks"] #=> returns an Array of Hash objects, each of which should only contain the requested fields/attributes
|
48
|
+
````
|
49
|
+
|
50
|
+
```` rb
|
51
|
+
network_id = "capital-bikeshare"
|
52
|
+
request_options = {:fields => "id,name,href"}
|
53
|
+
response = CitybikesApi.network(network_id, request_options)
|
54
|
+
puts response["network"] #=> returns a Hash object which should only contain the requested fields/attributes
|
31
55
|
````
|
32
56
|
|
57
|
+
See [CityBikes documentation](http://api.citybik.es/v2/#Syntax) for more info about field-filtering.
|
58
|
+
|
33
59
|
## Contributing
|
34
60
|
|
35
61
|
Browse existing [issues](https://github.com/data-creative/citybikes-api-ruby/issues) or create a new issue to communicate bugs, desired features, etc.
|
data/citybikes_api.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["MJ Rossetti (@s2t2)"]
|
10
10
|
spec.email = ["s2t2mail+git@gmail.com"]
|
11
11
|
|
12
|
-
spec.summary = %q{A ruby interface to the CityBikes API
|
13
|
-
spec.description = %q{A ruby interface to the CityBikes API
|
12
|
+
spec.summary = %q{A ruby interface to the CityBikes API v2. Returns data about bike-share networks and stations. Includes options to customize API requests.}
|
13
|
+
spec.description = %q{A ruby interface to the CityBikes API v2. Returns data about bike-share networks and stations. Includes options to customize API requests.}
|
14
14
|
spec.homepage = "https://github.com/data-creative/citybikes-api-ruby"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
data/lib/citybikes_api.rb
CHANGED
@@ -8,19 +8,26 @@ module CitybikesApi
|
|
8
8
|
|
9
9
|
# Networks Endpoint
|
10
10
|
#
|
11
|
+
# @param [Hash] options An object of named URL parameters to pass along with the request.
|
12
|
+
# @param [Hash] options [String] :field A comma-separated string of network object attributes.
|
13
|
+
#
|
11
14
|
# @example CityBikesApi.networks
|
15
|
+
# @example CityBikesApi.networks({:fields => "id,name,href"})
|
12
16
|
#
|
13
|
-
def self.networks
|
14
|
-
|
17
|
+
def self.networks(options = {})
|
18
|
+
HTTParty.get("#{BASE_URL}/networks", :query => options)
|
15
19
|
end
|
16
20
|
|
17
21
|
# Network Endpoint
|
18
22
|
#
|
19
23
|
# @param [String] network_id The unique bike-share network identifier assigned by citybikes.
|
24
|
+
# @param [Hash] options An object of named URL parameters to pass along with the request.
|
25
|
+
# @param [Hash] options [String] :field A comma-separated string of network object attributes.
|
20
26
|
#
|
21
27
|
# @example CityBikesApi.network("capital-bikeshare")
|
28
|
+
# @example CityBikesApi.network("capital-bikeshare", {:fields => "id,name,href"})
|
22
29
|
#
|
23
|
-
def self.network(network_id)
|
24
|
-
|
30
|
+
def self.network(network_id, options = {})
|
31
|
+
HTTParty.get("#{BASE_URL}/networks/#{network_id}", :query => options)
|
25
32
|
end
|
26
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: citybikes_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MJ Rossetti (@s2t2)
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -122,8 +122,8 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0.13'
|
125
|
-
description: A ruby interface to the CityBikes API
|
126
|
-
|
125
|
+
description: A ruby interface to the CityBikes API v2. Returns data about bike-share
|
126
|
+
networks and stations. Includes options to customize API requests.
|
127
127
|
email:
|
128
128
|
- s2t2mail+git@gmail.com
|
129
129
|
executables: []
|
@@ -168,7 +168,7 @@ rubyforge_project:
|
|
168
168
|
rubygems_version: 2.4.5
|
169
169
|
signing_key:
|
170
170
|
specification_version: 4
|
171
|
-
summary: A ruby interface to the CityBikes API
|
172
|
-
|
171
|
+
summary: A ruby interface to the CityBikes API v2. Returns data about bike-share networks
|
172
|
+
and stations. Includes options to customize API requests.
|
173
173
|
test_files: []
|
174
174
|
has_rdoc:
|