citybikes_api 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f91ce098bd210ba468ad187303179fbeb1678383
4
+ data.tar.gz: fb8b84adbd697181b9e03ce6382afbd1c688f596
5
+ SHA512:
6
+ metadata.gz: 9a029d6d1f4af8082805bf7b8e0bc6e97ad875a8e159b1b02122af5e0ce46c438afe3a1c575fdd7cabf99c1f7660eedd6a575af8c69661c1d68de6ce02c97be7
7
+ data.tar.gz: 5c6e4858140f737ad9f9b02fbeb89b5fbdcfa48cc8bd256a8a9c3eca541abf7d1c92b4495785d7c7e3bb22fc3736298cd58e3581ea14473adac506ddde26a6fa
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
4
+ before_install: gem install bundler -v 1.10.5
data/.yardopts ADDED
@@ -0,0 +1 @@
1
+ --markup-provider=redcarpet --markup=markdown
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in citybikes_api.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 MJ Rossetti (@s2t2)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # CitybikesApi - Ruby
2
+
3
+ A ruby interface to the [CityBikes API](http://api.citybik.es/v2/) (v2). Includes endpoints for bike-share network and station data.
4
+
5
+ ## Installation
6
+
7
+ Add `gem 'citybikes_api', '~> 2.0'` to Gemfile and run `bundle install`. Or install with:
8
+
9
+ ```` sh
10
+ gem install citybikes_api
11
+ ````
12
+
13
+ ## Usage
14
+
15
+ Get a list of all bike-share networks.
16
+
17
+ ```` rb
18
+ response = CitybikesApi.networks
19
+ puts response["networks"]
20
+ ````
21
+
22
+ Find a given bike-share network and all of its stations.
23
+
24
+ ```` rb
25
+ response = CitybikesApi.network(network_id)
26
+ puts response["network"]
27
+ puts response["network"]["stations"]
28
+ ````
29
+
30
+ ## Contributing
31
+
32
+ Browse existing [issues](https://github.com/data-creative/citybikes-api-ruby/issues) or create a new issue to communicate bugs, desired features, etc.
33
+
34
+ After forking the repo and pushing your changes, create a pull request referencing the applicable issue(s).
35
+
36
+ ### Developing
37
+
38
+ After checking out the repo, run `bin/setup` to install dependencies.
39
+
40
+ ### Testing
41
+
42
+ Run `rake rspec` or `bundle exec rspec spec/` to run the tests.
43
+
44
+ You can also run `bin/console` for an interactive prompt that will allow you to experiment.
45
+
46
+ ### Releasing
47
+
48
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
49
+
50
+ ## [License](LICENSE.txt)
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "citybikes_api"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ # require "irb"
14
+ # IRB.start
15
+
16
+ require 'pry'
17
+ Pry.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'citybikes_api/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "citybikes_api"
8
+ spec.version = CitybikesApi::VERSION
9
+ spec.authors = ["MJ Rossetti (@s2t2)"]
10
+ spec.email = ["s2t2mail+git@gmail.com"]
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.}
14
+ spec.homepage = "https://github.com/data-creative/citybikes-api-ruby"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.10"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rspec"
25
+ spec.add_development_dependency "pry", "~> 0.10"
26
+ spec.add_development_dependency "yard"
27
+ spec.add_development_dependency "redcarpet"
28
+ spec.add_development_dependency "github-markup"
29
+ spec.add_dependency "httparty", "~> 0.13"
30
+ end
@@ -0,0 +1,76 @@
1
+ {
2
+ "network"=>{
3
+ "company"=>["PBSC", "Alta Bicycle Share, Inc"],
4
+ "href"=>"/v2/networks/capital-bikeshare",
5
+ "id"=>"capital-bikeshare",
6
+ "location"=>{
7
+ "city"=>"Washington, DC",
8
+ "country"=>"US",
9
+ "latitude"=>38.8967584,
10
+ "longitude"=>-77.03701629999999
11
+ },
12
+ "name"=>"Capital BikeShare",
13
+ "stations"=>[
14
+ {
15
+ "empty_slots"=>3,
16
+ "extra"=>{
17
+ "installDate"=>"0",
18
+ "installed"=>true,
19
+ "latestUpdateTime"=>"1445815427035",
20
+ "locked"=>false,
21
+ "name"=>"20th & Bell St",
22
+ "removalDate"=>"",
23
+ "temporary"=>false,
24
+ "terminalName"=>"31000",
25
+ "uid"=>1
26
+ },
27
+ "free_bikes"=>8,
28
+ "id"=>"13a08d3d6015b722c2df3fad76f15887",
29
+ "latitude"=>38.8561,
30
+ "longitude"=>-77.0512,
31
+ "name"=>"31000 - 20th & Bell St",
32
+ "timestamp"=>"2015-10-26T02:02:47.54Z"
33
+ },
34
+ {
35
+ "empty_slots"=>6,
36
+ "extra"=>{
37
+ "installDate"=>"0",
38
+ "installed"=>true,
39
+ "latestUpdateTime"=>"1445819118925",
40
+ "locked"=>false,
41
+ "name"=>"18th & Eads St.",
42
+ "removalDate"=>"",
43
+ "temporary"=>false,
44
+ "terminalName"=>"31001",
45
+ "uid"=>2
46
+ },
47
+ "free_bikes"=>4,
48
+ "id"=>"f6738240b9295f642cc22bdcfa7db14c",
49
+ "latitude"=>38.85725,
50
+ "longitude"=>-77.05332,
51
+ "name"=>"31001 - 18th & Eads St.",
52
+ "timestamp"=>"2015-10-26T02:02:47.548Z"
53
+ },
54
+ {
55
+ "empty_slots"=>9,
56
+ "extra"=>{
57
+ "installDate"=>"0",
58
+ "installed"=>true,
59
+ "latestUpdateTime"=>"1445821053080",
60
+ "locked"=>false,
61
+ "name"=>"20th & Crystal Dr",
62
+ "removalDate"=>"",
63
+ "temporary"=>false,
64
+ "terminalName"=>"31002",
65
+ "uid"=>3
66
+ },
67
+ "free_bikes"=>6,
68
+ "id"=>"897f90919fd8c4a6756e077d292e52fe",
69
+ "latitude"=>38.856214,
70
+ "longitude"=>-77.049828,
71
+ "name"=>"31002 - 20th & Crystal Dr",
72
+ "timestamp"=>"2015-10-26T02:02:47.554Z"
73
+ }
74
+ ]
75
+ }
76
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "networks"=> [
3
+ {
4
+ "company"=>"Cyclopolis Systems",
5
+ "href"=>"/v2/networks/cyclopolis-arxaiaolympia",
6
+ "id"=>"cyclopolis-arxaiaolympia",
7
+ "location"=>{
8
+ "city"=>"Αrxaia Olympia",
9
+ "country"=>"GR",
10
+ "latitude"=>37.6419700934,
11
+ "longitude"=>21.6247265179
12
+ },
13
+ "name"=>"Cyclopolis"
14
+ },
15
+ {
16
+ "company"=>"Cyclopolis Systems",
17
+ "href"=>"/v2/networks/cyclopolis-kiato",
18
+ "id"=>"cyclopolis-kiato",
19
+ "location"=>{
20
+ "city"=>"Kιato",
21
+ "country"=>"GR",
22
+ "latitude"=>38.0132674508,
23
+ "longitude"=>22.7493819902
24
+ },
25
+ "name"=>"Cyclopolis"
26
+ },
27
+ {
28
+ "company"=>["Keolis", "STAP"],
29
+ "href"=>"/v2/networks/idecycle",
30
+ "id"=>"idecycle",
31
+ "location"=>{
32
+ "city"=>"Pau",
33
+ "country"=>"FR",
34
+ "latitude"=>43.2951,
35
+ "longitude"=>-0.370797
36
+ },
37
+ "name"=>"IDECycle"
38
+ }
39
+ ]
40
+ }
@@ -0,0 +1,18 @@
1
+ require "citybikes_api/version"
2
+ require "httparty"
3
+
4
+ module CitybikesApi
5
+ BASE_URL = "http://api.citybik.es/v2"
6
+
7
+ # Networks Endpoint
8
+ #
9
+ # @example CityBikesApi.networks
10
+ #
11
+ def self.networks
12
+ response = HTTParty.get("#{BASE_URL}/networks")
13
+ end
14
+
15
+ def self.network(network_id)
16
+ response = HTTParty.get("#{BASE_URL}/networks/#{network_id}")
17
+ end
18
+ end
@@ -0,0 +1,3 @@
1
+ module CitybikesApi
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,174 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: citybikes_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - MJ Rossetti (@s2t2)
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-10-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
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.10'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.10'
69
+ - !ruby/object:Gem::Dependency
70
+ name: yard
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: redcarpet
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: github-markup
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: httparty
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.13'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.13'
125
+ description: A ruby interface to the CityBikes API (v2). Includes endpoints for bike-share
126
+ network and station data.
127
+ email:
128
+ - s2t2mail+git@gmail.com
129
+ executables: []
130
+ extensions: []
131
+ extra_rdoc_files: []
132
+ files:
133
+ - ".gitignore"
134
+ - ".rspec"
135
+ - ".travis.yml"
136
+ - ".yardopts"
137
+ - Gemfile
138
+ - LICENSE.txt
139
+ - README.md
140
+ - Rakefile
141
+ - bin/console
142
+ - bin/setup
143
+ - citybikes_api.gemspec
144
+ - fixtures/network_response.rb
145
+ - fixtures/networks_response.rb
146
+ - lib/citybikes_api.rb
147
+ - lib/citybikes_api/version.rb
148
+ homepage: https://github.com/data-creative/citybikes-api-ruby
149
+ licenses:
150
+ - MIT
151
+ metadata: {}
152
+ post_install_message:
153
+ rdoc_options: []
154
+ require_paths:
155
+ - lib
156
+ required_ruby_version: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ required_rubygems_version: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ requirements: []
167
+ rubyforge_project:
168
+ rubygems_version: 2.4.5
169
+ signing_key:
170
+ specification_version: 4
171
+ summary: A ruby interface to the CityBikes API (v2). Includes endpoints for bike-share
172
+ network and station data.
173
+ test_files: []
174
+ has_rdoc: