citybikes_api 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 023d6a354f3510731f6961806f642958fc59f1f3
4
- data.tar.gz: 6baef3ed49ad9f16f5aa259f94523e96665ee9e5
3
+ metadata.gz: 88d592037677bcce62bf6d8ea72179f13542958f
4
+ data.tar.gz: 2fd4f6eca577525be49fccc20d88d3f835465c93
5
5
  SHA512:
6
- metadata.gz: 8e6236c38e3405de262769be0767eb49fa240133a38d2f3a5e746026fc552e308e48c87ec4fd08c28df3006f79dccf7ca605e03e3d9b94d63a5a5d6e9ee1197b
7
- data.tar.gz: 3670331f6e7c82ff4fe3b4986450069d97b9fbacdb41f125d23806a48e42cf6864615015c0f32139288d51cfd92a8295f92878e1ca5816ca77bb9472e91b80ab
6
+ metadata.gz: 6ce0f7e19774e6a2e0e6836f082f806223938bf33f09cd4b9365abdc87ba1264b639a409d09fbb120a48aae3257da15a247a12ac8254819519d67a3add9de987
7
+ data.tar.gz: 91e697245f6b6ea3d759ddc4c930bf94f6b8c4bfc2c51b3d89c0ad16e17988d7f4480bc9ee77cab321c7062c553feae240bf3b1012e6026321f1804ae15a26b0
data/README.md CHANGED
@@ -1,7 +1,8 @@
1
- # CitybikesApi - Ruby
1
+ # CityBikes API - Ruby :bike: :bike: :bike:
2
2
 
3
- A ruby interface to the [CityBikes API](http://api.citybik.es/v2/) (v2).
4
- Includes endpoints for bike-share network and station data.
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
  [![Gem Version](https://badge.fury.io/rb/citybikes_api.svg)](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
- Get a list of all bike-share networks.
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
- Find a given bike-share network and all of its stations.
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
- puts response["network"]["stations"]
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.
@@ -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 (v2). Includes endpoints for bike-share network and station data.}
13
- spec.description = %q{A ruby interface to the CityBikes API (v2). Includes endpoints for bike-share network and station data.}
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
 
@@ -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
- response = HTTParty.get("#{BASE_URL}/networks")
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
- response = HTTParty.get("#{BASE_URL}/networks/#{network_id}")
30
+ def self.network(network_id, options = {})
31
+ HTTParty.get("#{BASE_URL}/networks/#{network_id}", :query => options)
25
32
  end
26
33
  end
@@ -1,4 +1,4 @@
1
1
  module CitybikesApi
2
2
  # The major version of this gem should correspond to the citybikes api version.
3
- VERSION = "2.0.0"
3
+ VERSION = "2.0.1"
4
4
  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.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-26 00:00:00.000000000 Z
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 (v2). Includes endpoints for bike-share
126
- network and station data.
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 (v2). Includes endpoints for bike-share
172
- network and station data.
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: