tfl_api_client 0.2.1 → 0.3.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/CHANGELOG.md +5 -0
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/lib/tfl_api_client.rb +2 -0
- data/{spec/support/coverage.rb → lib/tfl_api_client/accident_stats.rb} +27 -8
- data/{spec/support/vcr.rb → lib/tfl_api_client/air_quality.rb} +25 -14
- data/lib/tfl_api_client/bike_point.rb +0 -1
- data/lib/tfl_api_client/client.rb +16 -0
- data/lib/tfl_api_client/version.rb +1 -1
- metadata +4 -55
- data/.gitignore +0 -37
- data/.travis.yml +0 -31
- data/.yardopts +0 -4
- data/GETTING_STARTED.md +0 -231
- data/Gemfile +0 -4
- data/Rakefile +0 -36
- data/spec/cassettes/bike_point/authorised_client_location.yml +0 -83
- data/spec/cassettes/bike_point/authorised_client_locations.yml +0 -8179
- data/spec/cassettes/bike_point/authorised_client_locations_within_bounding_box.yml +0 -402
- data/spec/cassettes/bike_point/authorised_client_locations_within_locus.yml +0 -106
- data/spec/cassettes/bike_point/authorised_client_search.yml +0 -80
- data/spec/cassettes/bike_point/unauthorised_client_location.yml +0 -50
- data/spec/cassettes/bike_point/unauthorised_client_locations.yml +0 -50
- data/spec/cassettes/bike_point/unauthorised_client_locations_within_bounding_box.yml +0 -50
- data/spec/cassettes/bike_point/unauthorised_client_locations_within_locus.yml +0 -50
- data/spec/cassettes/bike_point/unauthorised_client_search.yml +0 -50
- data/spec/cassettes/cycle/authorised_client_superhighway.yml +0 -75
- data/spec/cassettes/cycle/authorised_client_superhighways.yml +0 -99
- data/spec/cassettes/cycle/unauthorised_client_superhighway.yml +0 -50
- data/spec/cassettes/cycle/unauthorised_client_superhighways.yml +0 -50
- data/spec/integration/bike_point_spec.rb +0 -158
- data/spec/integration/cycle_spec.rb +0 -79
- data/spec/spec_helper.rb +0 -114
- data/spec/support/helpers.rb +0 -81
- data/spec/unit/bike_point_spec.rb +0 -87
- data/spec/unit/client_spec.rb +0 -199
- data/spec/unit/cycle_spec.rb +0 -66
- data/tfl_api_client.gemspec +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc6e7d11384505488f3b2ade8fd0ac36ac7a84e2
|
4
|
+
data.tar.gz: 9bcb540bebb5f2cbe0854092f159bbc2b571c76e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e414ce9d93ea823e441aa41d8df35111cbf6d150318b570c29affe677d60c44c2906e286932a4fc06c6e8fb1ab48ac6c881402a75876138ddf119691f406bedd
|
7
|
+
data.tar.gz: ac1fa21410376796d7f3ec91a90f0f21179fcbbb36fde1973c476606a240dffb882b0fa898ff9f1238159c12b1e79e10ce6abad6f5dbaee44d94d39b415ea84c
|
data/CHANGELOG.md
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -116,7 +116,7 @@ and [Factory Girl][factory_girl].
|
|
116
116
|
|
117
117
|
## License
|
118
118
|
|
119
|
-
Copyright (c) 2015 -
|
119
|
+
Copyright (c) 2015 - 2017 Luke Hackett. MIT Licensed, see [LICENSE][license] for details.
|
120
120
|
|
121
121
|
[license]: LICENSE
|
122
122
|
|
data/lib/tfl_api_client.rb
CHANGED
@@ -25,6 +25,8 @@
|
|
25
25
|
|
26
26
|
require 'tfl_api_client/version'
|
27
27
|
require 'tfl_api_client/client'
|
28
|
+
require 'tfl_api_client/accident_stats'
|
29
|
+
require 'tfl_api_client/air_quality'
|
28
30
|
require 'tfl_api_client/bike_point'
|
29
31
|
require 'tfl_api_client/cycle'
|
30
32
|
require 'tfl_api_client/exceptions'
|
@@ -23,14 +23,33 @@
|
|
23
23
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
24
|
#
|
25
25
|
|
26
|
-
|
27
|
-
|
26
|
+
module TflApi
|
27
|
+
class Client
|
28
|
+
# This class communicates with the TFL "/AccidentStats" API to obtain
|
29
|
+
# details about Accident Statistics based upon the year the accident
|
30
|
+
# occurred.
|
31
|
+
#
|
32
|
+
class AccidentStats
|
28
33
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
]
|
34
|
+
# Initialize the AccidentStats object and store the reference to Client
|
35
|
+
# object.
|
36
|
+
#
|
37
|
+
# @param client [Client] the client object
|
38
|
+
#
|
39
|
+
# @return [AccidentStats] the AccidentStats object
|
40
|
+
#
|
41
|
+
def initialize(client)
|
42
|
+
@client = client
|
43
|
+
end
|
33
44
|
|
34
|
-
|
35
|
-
|
45
|
+
# Returns all accident details for accidents occurring in the specified
|
46
|
+
# year.
|
47
|
+
#
|
48
|
+
# @return [Array] An array of hashes containing all Accident Statistics
|
49
|
+
#
|
50
|
+
def details(year)
|
51
|
+
@client.get("/AccidentStats/#{year}")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
36
55
|
end
|
@@ -23,21 +23,32 @@
|
|
23
23
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
24
|
#
|
25
25
|
|
26
|
-
|
26
|
+
module TflApi
|
27
|
+
class Client
|
28
|
+
# This class communicates with the TFL "/AirQuality" API to obtain
|
29
|
+
# details about London's Air Quality.
|
30
|
+
#
|
31
|
+
class AirQuality
|
27
32
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
33
|
+
# Initialize the AirQuality object and store the reference to Client
|
34
|
+
# object.
|
35
|
+
#
|
36
|
+
# @param client [Client] the client object
|
37
|
+
#
|
38
|
+
# @return [AirQuality] the AirQuality object
|
39
|
+
#
|
40
|
+
def initialize(client)
|
41
|
+
@client = client
|
42
|
+
end
|
32
43
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
44
|
+
# Returns all Air Quality details for the current time period (currently
|
45
|
+
# every hour).
|
46
|
+
#
|
47
|
+
# @return [Hash] A hash containing details upon London's Air Quality
|
48
|
+
#
|
49
|
+
def details
|
50
|
+
@client.get('/AirQuality')
|
51
|
+
end
|
52
|
+
end
|
37
53
|
end
|
38
|
-
|
39
|
-
# Prevent VCR from matching on Application ID and Application Key
|
40
|
-
config.default_cassette_options = {
|
41
|
-
match_requests_on: [:method, VCR.request_matchers.uri_without_param(:app_id, :app_key)]
|
42
|
-
}
|
43
54
|
end
|
@@ -96,6 +96,22 @@ module TflApi
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
+
# Creates an instance to the AccidentStats class by passing a reference to self
|
100
|
+
#
|
101
|
+
# @return [TflApi::Client::AccidentStats] An object to AccidentStats subclass
|
102
|
+
#
|
103
|
+
def accident_stats
|
104
|
+
TflApi::Client::AccidentStats.new(self)
|
105
|
+
end
|
106
|
+
|
107
|
+
# Creates an instance to the AirQuality class by passing a reference to self
|
108
|
+
#
|
109
|
+
# @return [TflApi::Client::AirQuality] An object to AirQuality subclass
|
110
|
+
#
|
111
|
+
def air_quality
|
112
|
+
TflApi::Client::AirQuality.new(self)
|
113
|
+
end
|
114
|
+
|
99
115
|
# Creates an instance to the BikePoint class by passing a reference to self
|
100
116
|
#
|
101
117
|
# @return [TflApi::Client::BikePoint] An object to BikePoint subclass
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tfl_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luke Hackett
|
@@ -145,45 +145,17 @@ executables: []
|
|
145
145
|
extensions: []
|
146
146
|
extra_rdoc_files: []
|
147
147
|
files:
|
148
|
-
- ".gitignore"
|
149
|
-
- ".travis.yml"
|
150
|
-
- ".yardopts"
|
151
148
|
- CHANGELOG.md
|
152
|
-
- GETTING_STARTED.md
|
153
|
-
- Gemfile
|
154
149
|
- LICENSE
|
155
150
|
- README.md
|
156
|
-
- Rakefile
|
157
151
|
- lib/tfl_api_client.rb
|
152
|
+
- lib/tfl_api_client/accident_stats.rb
|
153
|
+
- lib/tfl_api_client/air_quality.rb
|
158
154
|
- lib/tfl_api_client/bike_point.rb
|
159
155
|
- lib/tfl_api_client/client.rb
|
160
156
|
- lib/tfl_api_client/cycle.rb
|
161
157
|
- lib/tfl_api_client/exceptions.rb
|
162
158
|
- lib/tfl_api_client/version.rb
|
163
|
-
- spec/cassettes/bike_point/authorised_client_location.yml
|
164
|
-
- spec/cassettes/bike_point/authorised_client_locations.yml
|
165
|
-
- spec/cassettes/bike_point/authorised_client_locations_within_bounding_box.yml
|
166
|
-
- spec/cassettes/bike_point/authorised_client_locations_within_locus.yml
|
167
|
-
- spec/cassettes/bike_point/authorised_client_search.yml
|
168
|
-
- spec/cassettes/bike_point/unauthorised_client_location.yml
|
169
|
-
- spec/cassettes/bike_point/unauthorised_client_locations.yml
|
170
|
-
- spec/cassettes/bike_point/unauthorised_client_locations_within_bounding_box.yml
|
171
|
-
- spec/cassettes/bike_point/unauthorised_client_locations_within_locus.yml
|
172
|
-
- spec/cassettes/bike_point/unauthorised_client_search.yml
|
173
|
-
- spec/cassettes/cycle/authorised_client_superhighway.yml
|
174
|
-
- spec/cassettes/cycle/authorised_client_superhighways.yml
|
175
|
-
- spec/cassettes/cycle/unauthorised_client_superhighway.yml
|
176
|
-
- spec/cassettes/cycle/unauthorised_client_superhighways.yml
|
177
|
-
- spec/integration/bike_point_spec.rb
|
178
|
-
- spec/integration/cycle_spec.rb
|
179
|
-
- spec/spec_helper.rb
|
180
|
-
- spec/support/coverage.rb
|
181
|
-
- spec/support/helpers.rb
|
182
|
-
- spec/support/vcr.rb
|
183
|
-
- spec/unit/bike_point_spec.rb
|
184
|
-
- spec/unit/client_spec.rb
|
185
|
-
- spec/unit/cycle_spec.rb
|
186
|
-
- tfl_api_client.gemspec
|
187
159
|
homepage: https://github.com/LukeHackett/tfl_api_client
|
188
160
|
licenses:
|
189
161
|
- MIT
|
@@ -208,28 +180,5 @@ rubygems_version: 2.6.8
|
|
208
180
|
signing_key:
|
209
181
|
specification_version: 4
|
210
182
|
summary: Transport for London API Client
|
211
|
-
test_files:
|
212
|
-
- spec/cassettes/bike_point/authorised_client_location.yml
|
213
|
-
- spec/cassettes/bike_point/authorised_client_locations.yml
|
214
|
-
- spec/cassettes/bike_point/authorised_client_locations_within_bounding_box.yml
|
215
|
-
- spec/cassettes/bike_point/authorised_client_locations_within_locus.yml
|
216
|
-
- spec/cassettes/bike_point/authorised_client_search.yml
|
217
|
-
- spec/cassettes/bike_point/unauthorised_client_location.yml
|
218
|
-
- spec/cassettes/bike_point/unauthorised_client_locations.yml
|
219
|
-
- spec/cassettes/bike_point/unauthorised_client_locations_within_bounding_box.yml
|
220
|
-
- spec/cassettes/bike_point/unauthorised_client_locations_within_locus.yml
|
221
|
-
- spec/cassettes/bike_point/unauthorised_client_search.yml
|
222
|
-
- spec/cassettes/cycle/authorised_client_superhighway.yml
|
223
|
-
- spec/cassettes/cycle/authorised_client_superhighways.yml
|
224
|
-
- spec/cassettes/cycle/unauthorised_client_superhighway.yml
|
225
|
-
- spec/cassettes/cycle/unauthorised_client_superhighways.yml
|
226
|
-
- spec/integration/bike_point_spec.rb
|
227
|
-
- spec/integration/cycle_spec.rb
|
228
|
-
- spec/spec_helper.rb
|
229
|
-
- spec/support/coverage.rb
|
230
|
-
- spec/support/helpers.rb
|
231
|
-
- spec/support/vcr.rb
|
232
|
-
- spec/unit/bike_point_spec.rb
|
233
|
-
- spec/unit/client_spec.rb
|
234
|
-
- spec/unit/cycle_spec.rb
|
183
|
+
test_files: []
|
235
184
|
has_rdoc:
|
data/.gitignore
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# Ruby files
|
2
|
-
*.gem
|
3
|
-
*.rbc
|
4
|
-
/.config
|
5
|
-
/coverage/
|
6
|
-
/InstalledFiles
|
7
|
-
/pkg/
|
8
|
-
/spec/reports/
|
9
|
-
/test/tmp/
|
10
|
-
/test/version_tmp/
|
11
|
-
/tmp/
|
12
|
-
|
13
|
-
# Specific to RubyMotion:
|
14
|
-
.dat*
|
15
|
-
.repl_history
|
16
|
-
build/
|
17
|
-
|
18
|
-
# Documentation cache and generated files:
|
19
|
-
/.yardoc/
|
20
|
-
/_yardoc/
|
21
|
-
/doc/
|
22
|
-
/rdoc/
|
23
|
-
|
24
|
-
# Environment normalisation:
|
25
|
-
/.bundle/
|
26
|
-
/vendor/bundle
|
27
|
-
/lib/bundler/man/
|
28
|
-
/.idea/
|
29
|
-
|
30
|
-
# for a library or gem, you might want to ignore these files since the code is
|
31
|
-
# intended to run in multiple environments; otherwise, check them in:
|
32
|
-
Gemfile.lock
|
33
|
-
.ruby-version
|
34
|
-
.ruby-gemset
|
35
|
-
|
36
|
-
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
37
|
-
.rvmrc
|
data/.travis.yml
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
sudo: false
|
3
|
-
cache: bundler
|
4
|
-
|
5
|
-
rvm:
|
6
|
-
- 2.4.0
|
7
|
-
- 2.3.0
|
8
|
-
- 2.2.0
|
9
|
-
- 2.1.0
|
10
|
-
- 2.0.0
|
11
|
-
|
12
|
-
before_install:
|
13
|
-
- gem uninstall bundler
|
14
|
-
- gem install bundler --version '~> 1.14'
|
15
|
-
|
16
|
-
script:
|
17
|
-
- bundle exec rake
|
18
|
-
|
19
|
-
env:
|
20
|
-
global:
|
21
|
-
# Application ID
|
22
|
-
- secure: mNYN26/OaEx535SefPMYfR3hYpYbm7GBJcWuSQ+emO22LDF90dFVHzIakmNAvwPG+sMkjKmKdxbQHOW7IVvfQ7wSc7uQ1lKpUVQcbimc+VXdQ/KIhlKVmIu/ZNV3KJW+d+/4PXMIY88tUynfd9CcuG3SyIrpmjQbSyQM0N/EbK0S4dMMfxSr6ryUnRh3X5Jcyl/hnGzeFqQ8ZVSFBVOPgW1Tkn69MemYNCQtkIyHHAUgCgRc96VJMVaKo0Fujs1WHtsjy9fHmhbduDZ/th3Enl7H2YuayYrYxzJwWIFpKNT0eTx8DoQIhtgRDiCyRaAH+lqfmgr/a3UIEG0q7PABDg97n/I9Ie0dtwTGJ1arrRKvQ7l8S4rv0pRSIaSOdUPce5BIqoMmmexIfiCnuQCPzxIjbHVLBXf85XuNhNzlTJDsXGqyekuQxWcV7iTy305jVokgEQETE5s0lX2x2HpFPCBYm/Ig8zF/wII2QRgN4t7eeUxYuGWkJKw6h7ssuB3Zv0KNKZsNeLvCo9l3Z+8TZ6u1uS3ab61eUYY165HBAGUq5PQ7xBuWD25ERcbU+mtPClLwrKdJmR0m5BmUC33ZXXqgje3qfzBhJdwLULPj/j7Hy+SUx4RgFDfIxB0eXa8XUHoMX8V1R4MlUt08LtQej3NCNHUogYf9Jo01lPtte08=
|
23
|
-
# Application Key
|
24
|
-
- secure: epXs5gDgdb/krwvS0gCYVlB2IusKfYHE3pbc90Pd+XqqEHsdqYQ5vpNYFiDjHpazh7xVtW8gL/5UIjSU4AFSjgNphhb83YBmdvWO5z/Zugs/F7llseYCt8QtLkpw8a7ERzsXjnq91zbxiJO4+Vz0DSZRw8nUNiN4wRGmKVIHWPHe/yi3J7GfJ4xZXe2N+yXbXR36DWaGWvjdJDh3S1wSHGe3+HAmZq6e1Xw2a27hwkpUUA4eviCnuV6CfzJl/KVjLEdneBPQ3lhHsLOgZ4ZpoC1uFICyJfRwbWdaaG+J9VQMbmpjaZfpJlV3ObZsIjis6rpVvDaqRnVGOvnlFy6gdCh3Onqm6N9I7s4lVaGKFldciIJwwC/WoMiXZJBMKO3IlmcRHQJVzc1B+lS8ehCUSvtCl6AZ9R2EOYMfiDXp5c4jjZRcVfeqpuGg56twBzFNNu2AN3JLtgwEhGgvWg6176ws2hpYjJxSDtjFZoErfsRP8vl/vzXtnNNx8p1R4Z/eOTO/IKGdW4YI3e1JwszPEegohNpeVWgAGW3SrNeuDmfXJ8j0+SuuTlHcqmBc0fzjz+pEG8/irG2dfCvpVoDKUQhk8NJtvxsXHsVllk5SifwplAWZhFmXom4ID5HDpMpl0sQ7ynIO+5f9/KJAFnhqGlvoXRgQIBmO8/yyOlVeLnY=
|
25
|
-
# Coveralls Repository Token
|
26
|
-
- secure: djKSoF3fahZ0s0SfwZHCGdBA/OU66aNdj0XBhjCz4LkDFn5f9I2TdymY5kMQWnFeyiyQ298cwb0o1FfTZ/jIziI/bU1evLuQk4PTjwiW1P8nKcxK8FBNEhn1CFNyCZHfD4O7DqXsDZwbCgcDg3gQPO1+RL3Te1Ez5ZOsSpXtT4MOXZJ83lBRcN+YSQlaJ/kL/O6R7ipO5iRH92hu6+iZJTL6KaL67maU/06e+Sup/LcdxEfL9l4uPx+KSR4uHgZrnWNS0NIouS9nhaml5wXmdeNQeAzRRthIni1CgKB7z1o/+65aLa+FPwnOk7pBz/xOrWQZMDq2KvCpXg1cdzMQw2ptxSM2YRwDGIoMCMUIoowSacvtNILjwjIZFR3OjYeWBcgw8cTdTqAxDOnUCgjrGGHhKL9Fz/48jbnAs0Lbrdf15YKS8Ro/qi9bOeKEJ51lXmKVd2dy2XmnYzqFModdRza7IpmhjmX2qeNh7u8EEUZJbArxPZZNAuNmWb/j3hHaCwqOxXmeFEtDZNkA/DVQYDbz0yXihq7GcStcUBB23H9PDDyTec05ISC0c6yb17JcHP751t9BIvWlG1F1k7MZAqHmjbhReuCocW6Usk5J6CW8WN/dz/xDgwEhEZn5ElzwUae3G0N1APVFRcxrCJRzSBF2DMpSvc7jotFVE3sg7Kg=
|
27
|
-
|
28
|
-
notifications:
|
29
|
-
email:
|
30
|
-
on_success: change
|
31
|
-
on_failure: always
|
data/.yardopts
DELETED
data/GETTING_STARTED.md
DELETED
@@ -1,231 +0,0 @@
|
|
1
|
-
# Getting Started
|
2
|
-
|
3
|
-
TFL API Client has been designed to be as simple as possible to work with.
|
4
|
-
|
5
|
-
This Getting Started guide will cover basic usage of the gem, however for a
|
6
|
-
more in depth guide, checkout the [docs][docs].
|
7
|
-
|
8
|
-
[docs]: http://www.rubydoc.info/github/LukeHackett/tfl_api_client
|
9
|
-
|
10
|
-
|
11
|
-
## BikePoint
|
12
|
-
|
13
|
-
The bike point interface interacts with the /BikePoint end point upon the
|
14
|
-
TFL API. This end point will return information regarding the [Santander
|
15
|
-
Cycle hire][cycle_hire] docking stations, including 5 minute real-time bike
|
16
|
-
and docking station status information.
|
17
|
-
|
18
|
-
[cycle_hire]: https://tfl.gov.uk/modes/cycling/santander-cycles
|
19
|
-
|
20
|
-
|
21
|
-
### Obtain an individual BikePoint
|
22
|
-
|
23
|
-
Information upon an individual BikePoint can be obtained using the `location`
|
24
|
-
method, whilst also passing the ID of the BikePoint.
|
25
|
-
|
26
|
-
```ruby
|
27
|
-
client = TflApi::Client.new(app_id: YOUR_TFL_APP_ID, app_key: YOUR_TFL_APP_KEY)
|
28
|
-
client.bike_point.location
|
29
|
-
|
30
|
-
=> {
|
31
|
-
"id":"BikePoints_10",
|
32
|
-
"url": "https://api-prod5.tfl.gov.uk/Place/BikePoints_10",
|
33
|
-
"commonName": "Park Street, Bankside",
|
34
|
-
"placeType": "BikePoint",
|
35
|
-
"additionalProperties": [],
|
36
|
-
"children":[],
|
37
|
-
"childrenUrls": [],
|
38
|
-
"lat":51.505974,
|
39
|
-
"lon":-0.092754
|
40
|
-
}
|
41
|
-
```
|
42
|
-
|
43
|
-
### Obtain all BikePoint locations
|
44
|
-
|
45
|
-
In order to obtain all BikePoint locations and their details the `locations`
|
46
|
-
method can be used.
|
47
|
-
|
48
|
-
```ruby
|
49
|
-
client = TflApi::Client.new(app_id: YOUR_TFL_APP_ID, app_key: YOUR_TFL_APP_KEY)
|
50
|
-
client.bike_point.locations
|
51
|
-
|
52
|
-
=> [
|
53
|
-
{
|
54
|
-
"id":"BikePoints_10",
|
55
|
-
"url": "https://api-prod5.tfl.gov.uk/Place/BikePoints_10",
|
56
|
-
"commonName": "Park Street, Bankside",
|
57
|
-
"placeType": "BikePoint",
|
58
|
-
"additionalProperties": [],
|
59
|
-
"children":[],
|
60
|
-
"childrenUrls": [],
|
61
|
-
"lat":51.505974,
|
62
|
-
"lon":-0.092754
|
63
|
-
},
|
64
|
-
...
|
65
|
-
// Additional Locations
|
66
|
-
...
|
67
|
-
]
|
68
|
-
```
|
69
|
-
|
70
|
-
|
71
|
-
### Obtain all BikePoint locations within a locus
|
72
|
-
|
73
|
-
In order to obtain all BikePoint locations within a given locus the
|
74
|
-
`locations_within_locus` method should be used. In this context, a locus is a
|
75
|
-
particular position given by the longitude and latitude values with an area
|
76
|
-
that is calculated in accordance to the given radius in metres.
|
77
|
-
|
78
|
-
```ruby
|
79
|
-
client = TflApi::Client.new(app_id: YOUR_TFL_APP_ID, app_key: YOUR_TFL_APP_KEY)
|
80
|
-
client.bike_point.locations_within_locus(51.5007292, -0.1246254, 500)
|
81
|
-
|
82
|
-
=> {
|
83
|
-
"centrePoint": [
|
84
|
-
51.5, -0.124
|
85
|
-
],
|
86
|
-
"places": [
|
87
|
-
{
|
88
|
-
"additionalProperties": [],
|
89
|
-
"children": [],
|
90
|
-
"commonName": "Abingdon Green, Westminster",
|
91
|
-
"distance": 298.0259124357908,
|
92
|
-
"id": "BikePoints_583",
|
93
|
-
"lat": 51.497622,
|
94
|
-
"lon": -0.125978,
|
95
|
-
"placeType": "BikePoint",
|
96
|
-
"url": "https://api-prod6.tfl.gov.uk/Place/BikePoints_583",
|
97
|
-
}
|
98
|
-
...
|
99
|
-
// Additional Locations
|
100
|
-
...
|
101
|
-
]
|
102
|
-
}
|
103
|
-
```
|
104
|
-
|
105
|
-
|
106
|
-
### Obtain all BikePoint locations within a bounding box
|
107
|
-
|
108
|
-
In order to obtain all BikePoint locations within a given square the
|
109
|
-
`locations_within_bounding_box` method should be used. Each of the coordinate
|
110
|
-
pairs are used to draw a bounding box, to which all BikePoint locations within
|
111
|
-
the box are returned.
|
112
|
-
|
113
|
-
```ruby
|
114
|
-
client = TflApi::Client.new(app_id: YOUR_TFL_APP_ID, app_key: YOUR_TFL_APP_KEY)
|
115
|
-
client.bike_point.locations_within_bounding_box(51.5138453, -0.0983506, 51.5007292, -0.1246254)
|
116
|
-
|
117
|
-
=> [
|
118
|
-
{
|
119
|
-
"additionalProperties": [],
|
120
|
-
"children": [],
|
121
|
-
"commonName": "Godliman Street, St. Paul's",
|
122
|
-
"id": "BikePoints_48",
|
123
|
-
"lat": 51.512484,
|
124
|
-
"lon": -0.099141,
|
125
|
-
"placeType": "BikePoint",
|
126
|
-
"url": "https://api-prod6.tfl.gov.uk/Place/BikePoints_48"
|
127
|
-
}
|
128
|
-
...
|
129
|
-
// Additional Locations
|
130
|
-
...
|
131
|
-
]
|
132
|
-
```
|
133
|
-
|
134
|
-
|
135
|
-
### Search for a given BikePoint location
|
136
|
-
|
137
|
-
The TFL API supports searching for BikePoint locations and will search within
|
138
|
-
the "commonName" field. To search for a given location the `search` method
|
139
|
-
accepts a query String.
|
140
|
-
|
141
|
-
```ruby
|
142
|
-
client = TflApi::Client.new(app_id: YOUR_TFL_APP_ID, app_key: YOUR_TFL_APP_KEY)
|
143
|
-
client.bike_point.search("St. James's")
|
144
|
-
|
145
|
-
=> [
|
146
|
-
{
|
147
|
-
"id": "BikePoints_160",
|
148
|
-
"url": "https: //api-prod6.tfl.gov.uk/Place/BikePoints_160",
|
149
|
-
"commonName": "Waterloo Place, St. James's",
|
150
|
-
"placeType": "BikePoint",
|
151
|
-
"additionalProperties": [],
|
152
|
-
"children": [],
|
153
|
-
"childrenUrls": [],
|
154
|
-
"lat": 51.506633,
|
155
|
-
"lon": -0.131773
|
156
|
-
}
|
157
|
-
...
|
158
|
-
// Additional Locations
|
159
|
-
...
|
160
|
-
]
|
161
|
-
```
|
162
|
-
|
163
|
-
|
164
|
-
## Cycle Superhighway
|
165
|
-
|
166
|
-
The cycle superhighway interface interacts with the /CycleSuperhighway
|
167
|
-
end point upon the TFL API. This end point will return information
|
168
|
-
regarding the [Cycle Superhighways][cycle_superhighways] locations,
|
169
|
-
including coordinates of the route.
|
170
|
-
|
171
|
-
[cycle_superhighways]: https://tfl.gov.uk/modes/cycling/routes-and-maps/cycle-superhighways
|
172
|
-
|
173
|
-
### Obtain all Cycle Superhighways routes
|
174
|
-
|
175
|
-
In order to obtain all Cycle Superhighway routes and their details the
|
176
|
-
`superhighways` method can be used.
|
177
|
-
|
178
|
-
```ruby
|
179
|
-
client = TflApi::Client.new(app_id: YOUR_TFL_APP_ID, app_key: YOUR_TFL_APP_KEY)
|
180
|
-
client.cycle.superhighways
|
181
|
-
|
182
|
-
=> [
|
183
|
-
{
|
184
|
-
'id': 'CS-1',
|
185
|
-
'label': 'CS Route 1',
|
186
|
-
'labelShort': 'CS-1',
|
187
|
-
'segmented': true,
|
188
|
-
'geography': {
|
189
|
-
'type': 'LineString',
|
190
|
-
'coordinates': [],
|
191
|
-
'crs': {
|
192
|
-
'type': 'name',
|
193
|
-
'properties': {
|
194
|
-
'name': 'ABC:1234'
|
195
|
-
}
|
196
|
-
}
|
197
|
-
}
|
198
|
-
}
|
199
|
-
...
|
200
|
-
// Additional Cycle Superhighways
|
201
|
-
...
|
202
|
-
]
|
203
|
-
```
|
204
|
-
|
205
|
-
### Obtain an individual Cycle Superhighway routes
|
206
|
-
|
207
|
-
Information upon an individual Cycle Superhighway can be obtained using
|
208
|
-
the `superhighway` method, whilst passing the ID of the Cycle
|
209
|
-
Superhighway route.
|
210
|
-
|
211
|
-
```ruby
|
212
|
-
client = TflApi::Client.new(app_id: YOUR_TFL_APP_ID, app_key: YOUR_TFL_APP_KEY)
|
213
|
-
client.cycle.superhighway('CS-1')
|
214
|
-
|
215
|
-
=> {
|
216
|
-
'id': 'CS-1',
|
217
|
-
'label': 'CS Route 1',
|
218
|
-
'labelShort': 'CS-1',
|
219
|
-
'segmented': true,
|
220
|
-
'geography': {
|
221
|
-
'type': 'LineString',
|
222
|
-
'coordinates': [],
|
223
|
-
'crs': {
|
224
|
-
'type': 'name',
|
225
|
-
'properties': {
|
226
|
-
'name': 'ABC:1234'
|
227
|
-
}
|
228
|
-
}
|
229
|
-
}
|
230
|
-
}
|
231
|
-
```
|