tfl_api_client 0.5.0 → 0.6.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 +4 -4
- data/CHANGELOG.md +8 -0
- data/LICENSE +1 -1
- data/README.md +4 -2
- data/lib/tfl_api_client/accident_stats.rb +1 -1
- data/lib/tfl_api_client/air_quality.rb +1 -1
- data/lib/tfl_api_client/bike_point.rb +1 -1
- data/lib/tfl_api_client/cabwise.rb +1 -1
- data/lib/tfl_api_client/client.rb +9 -1
- data/lib/tfl_api_client/cycle.rb +1 -1
- data/lib/tfl_api_client/exceptions.rb +1 -1
- data/lib/tfl_api_client/journey.rb +1 -1
- data/lib/tfl_api_client/mode.rb +64 -0
- data/lib/tfl_api_client/version.rb +2 -2
- data/lib/tfl_api_client.rb +2 -1
- metadata +16 -15
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: d635aab374d02a5db6034aa5fe70a1304ee226e7
         | 
| 4 | 
            +
              data.tar.gz: bda385133a306071f14bce1b41873fd7ffc73816
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: ae52ceb724c21a99e526808c6453cd627257708019b6b82c0b14a2855c6f5c1665338650f48c8fc1755540a5c2ccbc81fde6225dd1b2ec1a2b490e2bbf0aab31
         | 
| 7 | 
            +
              data.tar.gz: 399007e96aeb0eb3d84eff84af220a0430987591ead676ca3867bb945f7c0eef895167ebf889958253cb6abd7d9bc65bc7aff4e8f7e376802649755819c50deb
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,5 +1,13 @@ | |
| 1 1 | 
             
            # CHANGELOG
         | 
| 2 2 |  | 
| 3 | 
            +
            ## v0.5.0  [13-MAY-2017]
         | 
| 4 | 
            +
            * Added support for the /Journey resource.
         | 
| 5 | 
            +
             | 
| 6 | 
            +
             | 
| 7 | 
            +
            ## v0.4.0  [18-APR-2017]
         | 
| 8 | 
            +
            * Added support for the /Cabwise resource.
         | 
| 9 | 
            +
             | 
| 10 | 
            +
             | 
| 3 11 | 
             
            ## v0.3.0  [16-FEB-2017]
         | 
| 4 12 | 
             
            * Added support for the /AccidentStats resource.
         | 
| 5 13 | 
             
            * Added support for the /AirQuality resource.
         | 
    
        data/LICENSE
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -56,8 +56,10 @@ can be passed: | |
| 56 56 | 
             
            | log_level    | INFO                   | The log level to logging at                         |
         | 
| 57 57 | 
             
            | log_location | STDOUT                 | Location to send all logs (can be a file or STDOUT) |
         | 
| 58 58 |  | 
| 59 | 
            -
            [ | 
| 59 | 
            +
            Full documentation can be found on the project's [ruby docs][ruby_docs].
         | 
| 60 60 |  | 
| 61 | 
            +
            [tfl_registration]: https://api-portal.tfl.gov.uk/signup
         | 
| 62 | 
            +
            [ruby_docs]: http://www.rubydoc.info/github/LukeHackett/tfl_api_client
         | 
| 61 63 |  | 
| 62 64 | 
             
            ## Changelog
         | 
| 63 65 |  | 
| @@ -133,7 +135,7 @@ and [Factory Girl][factory_girl]. | |
| 133 135 |  | 
| 134 136 | 
             
            ## License
         | 
| 135 137 |  | 
| 136 | 
            -
            Copyright (c) 2015 -  | 
| 138 | 
            +
            Copyright (c) 2015 - 2018 Luke Hackett. MIT Licensed, see [LICENSE][license] for details.
         | 
| 137 139 |  | 
| 138 140 | 
             
            [license]: LICENSE
         | 
| 139 141 |  | 
| @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            #
         | 
| 2 | 
            -
            # Copyright (c) 2015 -  | 
| 2 | 
            +
            # Copyright (c) 2015 - 2018 Luke Hackett
         | 
| 3 3 | 
             
            #
         | 
| 4 4 | 
             
            # MIT License
         | 
| 5 5 | 
             
            #
         | 
| @@ -144,6 +144,14 @@ module TflApi | |
| 144 144 | 
             
                  TflApi::Client::Journey.new(self)
         | 
| 145 145 | 
             
                end
         | 
| 146 146 |  | 
| 147 | 
            +
                # Creates an instance to the Mode class by passing a reference to self
         | 
| 148 | 
            +
                #
         | 
| 149 | 
            +
                # @return [TflApi::Client::Mode] An object to Mode subclass
         | 
| 150 | 
            +
                #
         | 
| 151 | 
            +
                def mode
         | 
| 152 | 
            +
                  TflApi::Client::Mode.new(self)
         | 
| 153 | 
            +
                end
         | 
| 154 | 
            +
             | 
| 147 155 | 
             
                # Performs a HTTP GET request to the api, based upon the given URI resource
         | 
| 148 156 | 
             
                # and any additional HTTP query parameters. This method will automatically
         | 
| 149 157 | 
             
                # inject the mandatory application id and application key HTTP query
         | 
    
        data/lib/tfl_api_client/cycle.rb
    CHANGED
    
    
| @@ -0,0 +1,64 @@ | |
| 1 | 
            +
            #
         | 
| 2 | 
            +
            # Copyright (c) 2015 - 2018 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 | 
            +
            module TflApi
         | 
| 27 | 
            +
              class Client
         | 
| 28 | 
            +
                # This class communicates with the TFL "/Journey" API to obtain
         | 
| 29 | 
            +
                # details about taxis and minicabs contact information.
         | 
| 30 | 
            +
                #
         | 
| 31 | 
            +
                class Mode
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                  # Initialize the Mode object and store the reference to Client object
         | 
| 34 | 
            +
                  #
         | 
| 35 | 
            +
                  # @param client [Client] the client object
         | 
| 36 | 
            +
                  #
         | 
| 37 | 
            +
                  # @return [Mode] the Mode object
         | 
| 38 | 
            +
                  #
         | 
| 39 | 
            +
                  def initialize(client)
         | 
| 40 | 
            +
                    @client = client
         | 
| 41 | 
            +
                  end
         | 
| 42 | 
            +
             | 
| 43 | 
            +
                  # Returns the service type active for a mode.
         | 
| 44 | 
            +
                  #
         | 
| 45 | 
            +
                  # @return [Array] An array of service types that are active for a mode
         | 
| 46 | 
            +
                  #
         | 
| 47 | 
            +
                  def active_service_types
         | 
| 48 | 
            +
                    @client.get('/Mode/ActiveServiceTypes')
         | 
| 49 | 
            +
                  end
         | 
| 50 | 
            +
             | 
| 51 | 
            +
                  # Returns the next arrival predictions for all stops of a given mode
         | 
| 52 | 
            +
                  #
         | 
| 53 | 
            +
                  # @param mode [String] A mode name e.g. tube, dlr
         | 
| 54 | 
            +
                  # @param count [Integer] Number of arrivals to return for each stop
         | 
| 55 | 
            +
                  #
         | 
| 56 | 
            +
                  # @return [Array] An array of arrival predictions for all stops of a given mode
         | 
| 57 | 
            +
                  #
         | 
| 58 | 
            +
                  def next_arrival(mode, count = -1)
         | 
| 59 | 
            +
                    @client.get("/Mode/#{mode}/Arrivals", { count: count })
         | 
| 60 | 
            +
                  end
         | 
| 61 | 
            +
             | 
| 62 | 
            +
                end
         | 
| 63 | 
            +
              end
         | 
| 64 | 
            +
            end
         | 
    
        data/lib/tfl_api_client.rb
    CHANGED
    
    | @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            #
         | 
| 2 | 
            -
            # Copyright (c) 2015 -  | 
| 2 | 
            +
            # Copyright (c) 2015 - 2018 Luke Hackett
         | 
| 3 3 | 
             
            #
         | 
| 4 4 | 
             
            # MIT License
         | 
| 5 5 | 
             
            #
         | 
| @@ -31,6 +31,7 @@ require 'tfl_api_client/bike_point' | |
| 31 31 | 
             
            require 'tfl_api_client/cycle'
         | 
| 32 32 | 
             
            require 'tfl_api_client/cabwise'
         | 
| 33 33 | 
             
            require 'tfl_api_client/journey'
         | 
| 34 | 
            +
            require 'tfl_api_client/mode'
         | 
| 34 35 | 
             
            require 'tfl_api_client/exceptions'
         | 
| 35 36 |  | 
| 36 37 | 
             
            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. | 
| 4 | 
            +
              version: 0.6.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:  | 
| 11 | 
            +
            date: 2018-02-13 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -16,14 +16,14 @@ dependencies: | |
| 16 16 | 
             
                requirements:
         | 
| 17 17 | 
             
                - - "~>"
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version: '1. | 
| 19 | 
            +
                    version: '1.16'
         | 
| 20 20 | 
             
              type: :development
         | 
| 21 21 | 
             
              prerelease: false
         | 
| 22 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 23 | 
             
                requirements:
         | 
| 24 24 | 
             
                - - "~>"
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            -
                    version: '1. | 
| 26 | 
            +
                    version: '1.16'
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 28 | 
             
              name: rake
         | 
| 29 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -58,14 +58,14 @@ dependencies: | |
| 58 58 | 
             
                requirements:
         | 
| 59 59 | 
             
                - - "~>"
         | 
| 60 60 | 
             
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            -
                    version: '3. | 
| 61 | 
            +
                    version: '3.6'
         | 
| 62 62 | 
             
              type: :development
         | 
| 63 63 | 
             
              prerelease: false
         | 
| 64 64 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 65 | 
             
                requirements:
         | 
| 66 66 | 
             
                - - "~>"
         | 
| 67 67 | 
             
                  - !ruby/object:Gem::Version
         | 
| 68 | 
            -
                    version: '3. | 
| 68 | 
            +
                    version: '3.6'
         | 
| 69 69 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 70 70 | 
             
              name: fuubar
         | 
| 71 71 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -86,56 +86,56 @@ dependencies: | |
| 86 86 | 
             
                requirements:
         | 
| 87 87 | 
             
                - - "~>"
         | 
| 88 88 | 
             
                  - !ruby/object:Gem::Version
         | 
| 89 | 
            -
                    version: ' | 
| 89 | 
            +
                    version: '4.0'
         | 
| 90 90 | 
             
              type: :development
         | 
| 91 91 | 
             
              prerelease: false
         | 
| 92 92 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 93 93 | 
             
                requirements:
         | 
| 94 94 | 
             
                - - "~>"
         | 
| 95 95 | 
             
                  - !ruby/object:Gem::Version
         | 
| 96 | 
            -
                    version: ' | 
| 96 | 
            +
                    version: '4.0'
         | 
| 97 97 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 98 98 | 
             
              name: webmock
         | 
| 99 99 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 100 100 | 
             
                requirements:
         | 
| 101 101 | 
             
                - - "~>"
         | 
| 102 102 | 
             
                  - !ruby/object:Gem::Version
         | 
| 103 | 
            -
                    version: ' | 
| 103 | 
            +
                    version: '3.3'
         | 
| 104 104 | 
             
              type: :development
         | 
| 105 105 | 
             
              prerelease: false
         | 
| 106 106 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 107 107 | 
             
                requirements:
         | 
| 108 108 | 
             
                - - "~>"
         | 
| 109 109 | 
             
                  - !ruby/object:Gem::Version
         | 
| 110 | 
            -
                    version: ' | 
| 110 | 
            +
                    version: '3.3'
         | 
| 111 111 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 112 112 | 
             
              name: simplecov
         | 
| 113 113 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 114 114 | 
             
                requirements:
         | 
| 115 115 | 
             
                - - "~>"
         | 
| 116 116 | 
             
                  - !ruby/object:Gem::Version
         | 
| 117 | 
            -
                    version:  | 
| 117 | 
            +
                    version: 0.14.1
         | 
| 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:  | 
| 124 | 
            +
                    version: 0.14.1
         | 
| 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. | 
| 131 | 
            +
                    version: 0.8.21
         | 
| 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. | 
| 138 | 
            +
                    version: 0.8.21
         | 
| 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
         | 
| @@ -157,6 +157,7 @@ files: | |
| 157 157 | 
             
            - lib/tfl_api_client/cycle.rb
         | 
| 158 158 | 
             
            - lib/tfl_api_client/exceptions.rb
         | 
| 159 159 | 
             
            - lib/tfl_api_client/journey.rb
         | 
| 160 | 
            +
            - lib/tfl_api_client/mode.rb
         | 
| 160 161 | 
             
            - lib/tfl_api_client/version.rb
         | 
| 161 162 | 
             
            homepage: https://github.com/LukeHackett/tfl_api_client
         | 
| 162 163 | 
             
            licenses:
         | 
| @@ -178,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 178 179 | 
             
                  version: '0'
         | 
| 179 180 | 
             
            requirements: []
         | 
| 180 181 | 
             
            rubyforge_project: 
         | 
| 181 | 
            -
            rubygems_version: 2.6. | 
| 182 | 
            +
            rubygems_version: 2.6.14
         | 
| 182 183 | 
             
            signing_key: 
         | 
| 183 184 | 
             
            specification_version: 4
         | 
| 184 185 | 
             
            summary: Transport for London API Client
         |