tfl_api_client 0.3.1 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc6e7d11384505488f3b2ade8fd0ac36ac7a84e2
4
- data.tar.gz: 9bcb540bebb5f2cbe0854092f159bbc2b571c76e
3
+ metadata.gz: deb99ecef39b8759c52cdaa5e774800efc2dde1b
4
+ data.tar.gz: c1c9adf6bf722e5281ea6f80d920ee4edefa38dc
5
5
  SHA512:
6
- metadata.gz: e414ce9d93ea823e441aa41d8df35111cbf6d150318b570c29affe677d60c44c2906e286932a4fc06c6e8fb1ab48ac6c881402a75876138ddf119691f406bedd
7
- data.tar.gz: ac1fa21410376796d7f3ec91a90f0f21179fcbbb36fde1973c476606a240dffb882b0fa898ff9f1238159c12b1e79e10ce6abad6f5dbaee44d94d39b415ea84c
6
+ metadata.gz: 521acedbe9583749c68f84f4754fa159bc1fe7ec7ab1faab21d1c2f7b11e048ff4f03c8fa84a95d9b9cee62e2300e494bfbfc80e2269dc05ae840670d2e23048
7
+ data.tar.gz: ef54b73f0b5f1ae27ae0f3bb67b3a706aa539f1c76c86471c4ba675b5ec2c5e5b7efc38d782ae112ef02a709e75f6c40157586f7ebaeee7e3576d13d09e2b894
data/README.md CHANGED
@@ -31,20 +31,37 @@ Or install it yourself as:
31
31
 
32
32
  The TFL API Client supports Ruby 2.0.0 or higher.
33
33
 
34
- Ruby 1.9.3 is currently not supported, but will be supported in future
35
- iterations of the gem.
36
-
37
34
 
38
35
  ## Usage
39
36
 
40
- Checkout the [Getting Started][getting_started] guide.
37
+ TFL API Client has been designed to be as simple as possible to work with.
38
+
39
+ To use the TFL API, developers should [register][tfl_registration] for a set
40
+ of API credentials (an Application ID and Application Key).
41
+
42
+ Once valid API credentials have been obtained, you will need to pass the
43
+ Application ID and Application Key upon initialisation of the client:
44
+
45
+ ```ruby
46
+ @client = TflApi::Client.new(app_id: TFL_APP_ID, app_key: TFL_APP_KEY)
47
+ ````
48
+
49
+ In addition to the above mandatory parameters, a number of optional parameters
50
+ can be passed:
51
+
52
+ | Option | Default Value | Description |
53
+ | ------------ | ---------------------- | --------------------------------------------------- |
54
+ | host | https://api.tfl.gov.uk | TFL API's host url |
55
+ | logger | a new Logger instance | Logger object to log into |
56
+ | log_level | INFO | The log level to logging at |
57
+ | log_location | STDOUT | Location to send all logs (can be a file or STDOUT) |
41
58
 
42
- [getting_started]: GETTING_STARTED.md
59
+ [registration]: https://api-portal.tfl.gov.uk
43
60
 
44
61
 
45
62
  ## Changelog
46
63
 
47
- See [CHANGELOG][changelog] for a list of changes.
64
+ See the [CHANGELOG][changelog] for a list of changes.
48
65
 
49
66
  [changelog]: CHANGELOG.md
50
67
 
@@ -0,0 +1,59 @@
1
+ #
2
+ # Copyright (c) 2015 - 2017 Luke Hackett
3
+ #
4
+ # MIT License
5
+ #
6
+ # Permission is hereby granted, free of charge, to any person obtaining
7
+ # a copy of this software and associated documentation files (the
8
+ # "Software"), to deal in the Software without restriction, including
9
+ # without limitation the rights to use, copy, modify, merge, publish,
10
+ # distribute, sublicense, and/or sell copies of the Software, and to
11
+ # permit persons to whom the Software is furnished to do so, subject to
12
+ # the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be
15
+ # included in all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+ #
25
+
26
+
27
+ module TflApi
28
+ class Client
29
+ # This class communicates with the TFL "/Cabwise" API to obtain
30
+ # details about taxis and minicabs contact information.
31
+ #
32
+ class Cabwise
33
+
34
+ # Initialize the Cabwise object and store the reference to Client object
35
+ #
36
+ # @param client [Client] the client object
37
+ #
38
+ # @return [Cabwise] the Cabwise object
39
+ #
40
+ def initialize(client)
41
+ @client = client
42
+ end
43
+
44
+ # Returns all contact information for taxis and minicabs known by the TFL
45
+ # service within based upon the given search query.
46
+ #
47
+ # @param latitude [String] the latitude value
48
+ # @param longitude [String] the longitude value
49
+ # @param params [String] Additional search query values
50
+ #
51
+ # @return [Hash] A hash of operator information
52
+ #
53
+ def search(latitude, longitude, params={})
54
+ @client.get('/Cabwise/search', params.merge({ lat: latitude, lon: longitude }))
55
+ end
56
+
57
+ end
58
+ end
59
+ end
@@ -128,6 +128,14 @@ module TflApi
128
128
  TflApi::Client::Cycle.new(self)
129
129
  end
130
130
 
131
+ # Creates an instance to the Cabwise class by passing a reference to self
132
+ #
133
+ # @return [TflApi::Client::Cabwise] An object to Cabwise subclass
134
+ #
135
+ def cabwise
136
+ TflApi::Client::Cabwise.new(self)
137
+ end
138
+
131
139
  # Performs a HTTP GET request to the api, based upon the given URI resource
132
140
  # and any additional HTTP query parameters. This method will automatically
133
141
  # inject the mandatory application id and application key HTTP query
@@ -24,5 +24,5 @@
24
24
  #
25
25
 
26
26
  module TflApi
27
- VERSION = '0.3.1'
27
+ VERSION = '0.4.0'
28
28
  end
@@ -29,6 +29,7 @@ require 'tfl_api_client/accident_stats'
29
29
  require 'tfl_api_client/air_quality'
30
30
  require 'tfl_api_client/bike_point'
31
31
  require 'tfl_api_client/cycle'
32
+ require 'tfl_api_client/cabwise'
32
33
  require 'tfl_api_client/exceptions'
33
34
 
34
35
  module TflApi
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tfl_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Hackett
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-16 00:00:00.000000000 Z
11
+ date: 2017-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '11.3'
33
+ version: '12.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '11.3'
40
+ version: '12.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: yard
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.8.7
47
+ version: 0.9.8
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.8.7
54
+ version: 0.9.8
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -114,28 +114,28 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '0.12'
117
+ version: '0.14'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '0.12'
124
+ version: '0.14'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: coveralls
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 0.8.2
131
+ version: 0.8.20
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 0.8.2
138
+ version: 0.8.20
139
139
  description: |2
140
140
  This gem aims to provide a simple, programmatic ruby client that allows
141
141
  native ruby applications to seamlessly interact with the Transport for
@@ -152,6 +152,7 @@ files:
152
152
  - lib/tfl_api_client/accident_stats.rb
153
153
  - lib/tfl_api_client/air_quality.rb
154
154
  - lib/tfl_api_client/bike_point.rb
155
+ - lib/tfl_api_client/cabwise.rb
155
156
  - lib/tfl_api_client/client.rb
156
157
  - lib/tfl_api_client/cycle.rb
157
158
  - lib/tfl_api_client/exceptions.rb
@@ -181,4 +182,3 @@ signing_key:
181
182
  specification_version: 4
182
183
  summary: Transport for London API Client
183
184
  test_files: []
184
- has_rdoc: