google_maps_juice 1.0.0 → 1.2.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
  SHA256:
3
- metadata.gz: 81dd523f6c0a801f8b8e15d0589525cd683359f4b85d0427f9b697d1ade77f5d
4
- data.tar.gz: 2fb1b05f6a92b3770771a5ae74de3ccd09f411f66dabde16d38160f151f48d66
3
+ metadata.gz: b096bfd2976402f76bd58fd937bdbcf15206d291ccbcca518d792fd4b49ddaa6
4
+ data.tar.gz: c1d8264eded57719f6240ed043e3d653ac8c4a9ba70306eaeb385e04fddb2240
5
5
  SHA512:
6
- metadata.gz: cdc4a09d044ecd8549b5a7851c1fda06be8a1ff4677df0e3173dfdabadfbb9b791789a3fe4a4a8d1dbc1d353f2382812ddc6dbb912915b679598502dd0254212
7
- data.tar.gz: 646b96bb8275a1230eb16a19d6472e56bd0f31218e0580976f1e9a4c88f738604885a156d92927fcb5060e54ab0ea077bc66c77e4f351eb12384ef63b3ac5260
6
+ metadata.gz: 2b395e3a30ec760d8e2547d75b51ba535aeddb73d439ef36ecc5ad275cce6dacda45a5d7aabed072bc2c0a5456e1f67554a20dd06619da8ac3a3d78f792e6241
7
+ data.tar.gz: '092bf6f8dc940b3f32350e2db2b191ce19094fbfc7eb4ea0e16fea0a1decd2f45ce8fa5d13c43576d3c8f721f7d9fb4aee3720a7b84bbdab21ad9b226b96845d'
@@ -0,0 +1,32 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ ruby-version: ['3.2', '3.3', '4.0']
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Set up Ruby ${{ matrix.ruby-version }}
20
+ uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: ${{ matrix.ruby-version }}
23
+ bundler-cache: true
24
+
25
+ - name: Run tests
26
+ run: bundle exec rspec
27
+
28
+ - name: Upload coverage to Codecov
29
+ if: matrix.ruby-version == '3.3'
30
+ uses: codecov/codecov-action@v5
31
+ with:
32
+ token: ${{ secrets.CODECOV_TOKEN }}
data/.gitignore CHANGED
@@ -7,7 +7,10 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
 
10
+ .env
11
+
10
12
  # rspec failure tracking
11
13
  .rspec_status
12
- Gemfile.lock
13
- .env
14
+
15
+ # Ignore local claude settings folder.
16
+ /.claude/
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 4.0.4
data/Gemfile CHANGED
@@ -1,6 +1,14 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
- # Specify your gem's dependencies in google_maps_juice.gemspec
6
3
  gemspec
4
+
5
+ group :development, :test do
6
+ gem 'bundler'
7
+ gem 'rake', '~> 13.0'
8
+ gem 'rspec', '~> 3.0'
9
+ gem 'webmock', '~> 3.0'
10
+ gem 'dotenv', '~> 3.0'
11
+ gem 'vcr', '~> 6.0'
12
+ gem 'simplecov', require: false
13
+ gem 'simplecov-lcov', require: false
14
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,135 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ google_maps_juice (1.1.0)
5
+ activesupport
6
+ excon
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (8.1.3)
12
+ base64
13
+ bigdecimal
14
+ concurrent-ruby (~> 1.0, >= 1.3.1)
15
+ connection_pool (>= 2.2.5)
16
+ drb
17
+ i18n (>= 1.6, < 2)
18
+ json
19
+ logger (>= 1.4.2)
20
+ minitest (>= 5.1)
21
+ securerandom (>= 0.3)
22
+ tzinfo (~> 2.0, >= 2.0.5)
23
+ uri (>= 0.13.1)
24
+ addressable (2.9.0)
25
+ public_suffix (>= 2.0.2, < 8.0)
26
+ base64 (0.3.0)
27
+ bigdecimal (4.1.2)
28
+ concurrent-ruby (1.3.6)
29
+ connection_pool (3.0.2)
30
+ crack (1.0.1)
31
+ bigdecimal
32
+ rexml
33
+ diff-lcs (1.6.2)
34
+ docile (1.4.1)
35
+ dotenv (3.2.0)
36
+ drb (2.2.3)
37
+ excon (1.4.2)
38
+ logger
39
+ hashdiff (1.2.1)
40
+ i18n (1.14.8)
41
+ concurrent-ruby (~> 1.0)
42
+ json (2.19.5)
43
+ logger (1.7.0)
44
+ minitest (6.0.6)
45
+ drb (~> 2.0)
46
+ prism (~> 1.5)
47
+ prism (1.9.0)
48
+ public_suffix (7.0.5)
49
+ rake (13.4.2)
50
+ rexml (3.4.4)
51
+ rspec (3.13.2)
52
+ rspec-core (~> 3.13.0)
53
+ rspec-expectations (~> 3.13.0)
54
+ rspec-mocks (~> 3.13.0)
55
+ rspec-core (3.13.6)
56
+ rspec-support (~> 3.13.0)
57
+ rspec-expectations (3.13.5)
58
+ diff-lcs (>= 1.2.0, < 2.0)
59
+ rspec-support (~> 3.13.0)
60
+ rspec-mocks (3.13.8)
61
+ diff-lcs (>= 1.2.0, < 2.0)
62
+ rspec-support (~> 3.13.0)
63
+ rspec-support (3.13.7)
64
+ securerandom (0.4.1)
65
+ simplecov (0.22.0)
66
+ docile (~> 1.1)
67
+ simplecov-html (~> 0.11)
68
+ simplecov_json_formatter (~> 0.1)
69
+ simplecov-html (0.13.2)
70
+ simplecov-lcov (0.9.0)
71
+ simplecov_json_formatter (0.1.4)
72
+ tzinfo (2.0.6)
73
+ concurrent-ruby (~> 1.0)
74
+ uri (1.1.1)
75
+ vcr (6.4.0)
76
+ webmock (3.26.2)
77
+ addressable (>= 2.8.0)
78
+ crack (>= 0.3.2)
79
+ hashdiff (>= 0.4.0, < 2.0.0)
80
+
81
+ PLATFORMS
82
+ ruby
83
+ x86_64-linux
84
+
85
+ DEPENDENCIES
86
+ bundler
87
+ dotenv (~> 3.0)
88
+ google_maps_juice!
89
+ rake (~> 13.0)
90
+ rspec (~> 3.0)
91
+ simplecov
92
+ simplecov-lcov
93
+ vcr (~> 6.0)
94
+ webmock (~> 3.0)
95
+
96
+ CHECKSUMS
97
+ activesupport (8.1.3) sha256=21a5e0dfbd4c3ddd9e1317ec6a4d782fa226e7867dc70b0743acda81a1dca20e
98
+ addressable (2.9.0) sha256=7fdf6ac3660f7f4e867a0838be3f6cf722ace541dd97767fa42bc6cfa980c7af
99
+ base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
100
+ bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd
101
+ concurrent-ruby (1.3.6) sha256=6b56837e1e7e5292f9864f34b69c5a2cbc75c0cf5338f1ce9903d10fa762d5ab
102
+ connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a
103
+ crack (1.0.1) sha256=ff4a10390cd31d66440b7524eb1841874db86201d5b70032028553130b6d4c7e
104
+ diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
105
+ docile (1.4.1) sha256=96159be799bfa73cdb721b840e9802126e4e03dfc26863db73647204c727f21e
106
+ dotenv (3.2.0) sha256=e375b83121ea7ca4ce20f214740076129ab8514cd81378161f11c03853fe619d
107
+ drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
108
+ excon (1.4.2) sha256=32d8d8eda619717d9b8043b4675e096fb5c2139b080e2ad3b267f88c545aaa35
109
+ google_maps_juice (1.1.0)
110
+ hashdiff (1.2.1) sha256=9c079dbc513dfc8833ab59c0c2d8f230fa28499cc5efb4b8dd276cf931457cd1
111
+ i18n (1.14.8) sha256=285778639134865c5e0f6269e0b818256017e8cde89993fdfcbfb64d088824a5
112
+ json (2.19.5) sha256=218a18553e4801d579ca7e0f5bc72bafd776d7397238a1fb4e74db5b0a812c59
113
+ logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
114
+ minitest (6.0.6) sha256=153ea36d1d987a62942382b61075745042a2b3123b1cd48f4c3675af9cc7d6f1
115
+ prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
116
+ public_suffix (7.0.5) sha256=1a8bb08f1bbea19228d3bed6e5ed908d1cb4f7c2726d18bd9cadf60bc676f623
117
+ rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
118
+ rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142
119
+ rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
120
+ rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d
121
+ rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
122
+ rspec-mocks (3.13.8) sha256=086ad3d3d17533f4237643de0b5c42f04b66348c28bf6b9c2d3f4a3b01af1d47
123
+ rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c
124
+ securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
125
+ simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5
126
+ simplecov-html (0.13.2) sha256=bd0b8e54e7c2d7685927e8d6286466359b6f16b18cb0df47b508e8d73c777246
127
+ simplecov-lcov (0.9.0) sha256=7a77a31e200a595ed4b0249493056efd0c920601f53d2ef135ca34ee796346cd
128
+ simplecov_json_formatter (0.1.4) sha256=529418fbe8de1713ac2b2d612aa3daa56d316975d307244399fa4838c601b428
129
+ tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b
130
+ uri (1.1.1) sha256=379fa58d27ffb1387eaada68c749d1426738bd0f654d812fcc07e7568f5c57c6
131
+ vcr (6.4.0) sha256=077ac92cc16efc5904eb90492a18153b5e6ca5398046d8a249a7c96a9ea24ae6
132
+ webmock (3.26.2) sha256=774556f2ea6371846cca68c01769b2eac0d134492d21f6d0ab5dd643965a4c90
133
+
134
+ BUNDLED WITH
135
+ 4.0.10
data/README.md CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  **Drink Google Maps Services with ease!** :tropical_drink: :earth_americas:
4
4
 
5
- [![Build Status](https://travis-ci.org/algonauti/google_maps_juice.svg?branch=master)](https://travis-ci.org/algonauti/google_maps_juice)
6
- [![Coverage Status](https://coveralls.io/repos/github/algonauti/google_maps_juice/badge.svg?branch=master)](https://coveralls.io/github/algonauti/google_maps_juice?branch=master)
5
+ [![CI](https://github.com/algonauti/google_maps_juice/actions/workflows/ci.yml/badge.svg)](https://github.com/algonauti/google_maps_juice/actions/workflows/ci.yml)
6
+ [![Coverage](https://codecov.io/gh/algonauti/google_maps_juice/branch/main/graph/badge.svg)](https://codecov.io/gh/algonauti/google_maps_juice)
7
7
 
8
8
  This gem aims at progressively covering a fair amount of those widely-used services that are part of the Google Maps Platform, such as: [Geocoding](https://developers.google.com/maps/documentation/geocoding/intro), [Time Zone](https://developers.google.com/maps/documentation/timezone/intro), [Directions](https://developers.google.com/maps/documentation/directions/intro), etc. with some key ideas:
9
9
 
@@ -17,6 +17,7 @@ This gem aims at progressively covering a fair amount of those widely-used servi
17
17
 
18
18
  * Geocoding
19
19
  * Time Zone
20
+ * Directions
20
21
 
21
22
  Contributors are welcome!
22
23
 
@@ -72,13 +73,13 @@ This is especially useful in some "hybrid" scenario, where an API key is shared
72
73
 
73
74
  ## Error Handling
74
75
 
75
- If Google servers respond with a non-successful HTTP status code, i.e. `4xx` or `5xx`, a `GoogleMapsJuice::Error` is raised with a message of the form `'HTTP 503 - Error details as returned by the server'`.
76
+ If Google servers respond with a non-successful HTTP status code, i.e. `4xx` or `5xx`, a `GoogleMapsJuice::ResponseError` is raised with a message of the form `'HTTP 503 - Error details as returned by the server'`.
76
77
 
77
78
  API errors are also handled, based on the `status` attribute of Google's JSON response, and the optional `error_message` attribute.
78
79
 
79
80
  * `GoogleMapsJuice::ZeroResults` is raised when `status` is `'ZERO_RESULTS'`
80
81
  * `GoogleMapsJuice::ApiLimitError` is raised when `status` is `'OVER_DAILY_LIMIT'` or `'OVER_QUERY_LIMIT'`
81
- * `GoogleMapsJuice::Error` is raised when `status` is not `OK` with a message of the form `API <status> - <error_message>`
82
+ * `GoogleMapsJuice::ResponseError` is raised when `status` is not `OK` with a message of the form `API <status> - <error_message>`
82
83
 
83
84
 
84
85
  ## Geocoding
@@ -181,6 +182,57 @@ The `by_location` method returns a `GoogleMapsJuice::Timezone::Response`. It's a
181
182
  * `dst_offset`: the offset for daylight-savings time in seconds
182
183
 
183
184
 
185
+ ## Directions
186
+
187
+ [Google's Directions API](https://developers.google.com/maps/documentation/directions/intro#DirectionsRequests) returns the possible routes of given origin and destination geographic locations; Google's API accepts address, textual latitude/longitude value, or place ID of which you wish to calculate directions. Currently this gem implements only latitude/longitude mode.
188
+ `GoogleMapsJuice` will raise an `ArgumentError` if some unsupported param is passed, or when none of the required params are passed.
189
+
190
+ ```ruby
191
+ response = GoogleMapsJuice::Directions.find(origin: '41.8892732,12.4921921', destination: '41.9016488,12.4583003')
192
+ ```
193
+
194
+ Compared to Google's raw API request, it provides validation of both origin and destination, in order to avoid sending requests when they would fail for sure - to learn more see `spec/unit/directions_spec.rb`.
195
+
196
+ **Accepted params:**
197
+
198
+ * Both `origin` and `destination` are mandatory
199
+ * `origin` is composed by `latitude` and `longitude`, comma separated float values
200
+ * `destination` same format as `origin`
201
+
202
+
203
+ ### Directions Response
204
+
205
+ The `find` method returns a `GoogleMapsJuice::Directions::Response`. It's a `Hash` representation of Google's JSON response. However, it also provides a few useful methods:
206
+
207
+ * `results`: the `Hash` raw result
208
+
209
+ * `routes`: an `Array` of `GoogleMapsJuice::Directions::Response::Route` objects
210
+
211
+ * `first`: the first `Route` of the `routes` `List`
212
+
213
+ As described in [Google's Directions API](https://developers.google.com/maps/documentation/directions/intro#Routes), the response contains all possible routes. Each route has some attributes and one or more *legs*, wich in turn have one or more *steps*.
214
+ If no waypoints are passed, the route response will contain a single leg. Since `GoogleMapsJuice::Directions` doesn't handles waypoints yet, only the first leg is considered for each route.
215
+ The `GoogleMapsJuice::Directions::Response::Route` is a representation of a response route and provides methods to access all route's attributes:
216
+
217
+ * `summary`: a brief description of the route
218
+
219
+ * `legs`: all legs of the route, generally a single one
220
+
221
+ * `steps`: all steps of the first route's leg
222
+
223
+ * `duration`: time duration of the first route's leg
224
+
225
+ * `distance`: distance between origin and destination of first route's leg
226
+
227
+ * `start_location`: `latitude`/`longitude` of the origin first route's leg
228
+
229
+ * `end_location`: `latitude`/`longitude` of the destination first route's leg
230
+
231
+ * `start_address`: address of the origin first route's leg
232
+
233
+ * `end_address`: address of the destination first route's leg
234
+
235
+
184
236
  ## Development
185
237
 
186
238
  After checking out the repo, run `bin/setup` to install dependencies. Create a `.env` file and save your Google API key there; if you want to use a different key for testing, put it in `.env.test` and it will override the one in `.env`.
@@ -22,14 +22,8 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ["lib"]
24
24
 
25
- spec.add_dependency 'activesupport', '~> 5.2'
26
- spec.add_dependency 'excon'
25
+ spec.required_ruby_version = '>= 3.2.0'
27
26
 
28
- spec.add_development_dependency 'bundler', '~> 1.16'
29
- spec.add_development_dependency 'rake', '~> 12.3'
30
- spec.add_development_dependency 'rspec', '~> 3.5'
31
- spec.add_development_dependency 'webmock', '~> 3.4'
32
- spec.add_development_dependency 'dotenv', '~> 2.5'
33
- spec.add_development_dependency 'vcr', '~> 4.0'
34
- spec.add_development_dependency 'coveralls', '~> 0.8'
27
+ spec.add_dependency 'activesupport'
28
+ spec.add_dependency 'excon'
35
29
  end
@@ -27,7 +27,7 @@ module GoogleMapsJuice
27
27
  else
28
28
  msg = "HTTP #{response.status}"
29
29
  msg += " - #{response.body}" if response.body.present?
30
- raise GoogleMapsJuice::Error, msg
30
+ raise GoogleMapsJuice::ResponseError, msg
31
31
  end
32
32
  end
33
33
 
@@ -1,5 +1,19 @@
1
- require 'active_support/configurable'
2
-
3
1
  module GoogleMapsJuice
4
- include ActiveSupport::Configurable
2
+ class Configuration
3
+ attr_accessor :api_key
4
+
5
+ def initialize
6
+ @api_key = nil
7
+ end
8
+ end
9
+
10
+ class << self
11
+ def configure
12
+ yield config
13
+ end
14
+
15
+ def config
16
+ @config ||= Configuration.new
17
+ end
18
+ end
5
19
  end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/hash/slice'
4
+
5
+ module GoogleMapsJuice
6
+ class Directions::Response < GoogleMapsJuice::Endpoint::Response
7
+ def results
8
+ self['routes']
9
+ end
10
+
11
+ def routes
12
+ results.map { |r| Route.new(r) }
13
+ end
14
+
15
+ def first
16
+ routes.first
17
+ end
18
+
19
+ class Route
20
+ attr_reader :route, :first_leg
21
+ def initialize(route)
22
+ @route = route
23
+ @first_leg = route['legs'].first
24
+ end
25
+
26
+ def legs
27
+ route['legs']
28
+ end
29
+
30
+ def summary
31
+ route['summary']
32
+ end
33
+
34
+ def steps
35
+ first_leg['steps']
36
+ end
37
+
38
+ def duration
39
+ first_leg['duration']
40
+ end
41
+
42
+ def distance
43
+ first_leg['distance']
44
+ end
45
+
46
+ def start_location
47
+ first_leg['start_location']
48
+ end
49
+
50
+ def end_location
51
+ first_leg['end_location']
52
+ end
53
+
54
+ def start_address
55
+ first_leg['start_address']
56
+ end
57
+
58
+ def end_address
59
+ first_leg['end_address']
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,55 @@
1
+ module GoogleMapsJuice
2
+ class Directions < Endpoint
3
+
4
+ ENDPOINT = '/directions'
5
+
6
+ autoload :Response, 'google_maps_juice/directions/response'
7
+
8
+ class << self
9
+ def find(params, api_key: GoogleMapsJuice.config.api_key)
10
+ client = GoogleMapsJuice::Client.new(api_key: api_key)
11
+ new(client).find(params)
12
+ end
13
+ end
14
+
15
+ def find(params)
16
+ validate_find_params(params)
17
+ response_text = @client.get("#{ENDPOINT}/json", params)
18
+ response = JSON.parse(response_text, object_class: Response)
19
+ detect_errors(response)
20
+ end
21
+
22
+ def validate_find_params(params)
23
+ raise ArgumentError, 'Hash argument expected' unless params.is_a?(Hash)
24
+
25
+ supported_keys = %w[origin destination]
26
+ validate_supported_params(params, supported_keys)
27
+
28
+ required_keys = %w[origin destination]
29
+ validate_any_required_params(params, required_keys)
30
+
31
+ validate_geo_coordinate(params)
32
+ end
33
+
34
+ def validate_geo_coordinate(params)
35
+ raise ArgumentError, 'String argument expected' unless params.values.all?(String)
36
+
37
+ geocoords = params.values.map { |x| x.split(',') }.flatten
38
+ geocoords.map! { |x| Float(x).round(7) }
39
+ raise ArgumentError, 'Wrong geo-coordinates' if geocoords.size != 4
40
+
41
+ validate_location_params(geocoords)
42
+ end
43
+
44
+ def validate_location_params(params)
45
+ latitudes = params[0], params[2]
46
+ if latitudes.any? { |l| l.abs > 90 }
47
+ raise ArgumentError, 'Wrong latitude value'
48
+ end
49
+ longitudes = params[1], params[3]
50
+ if longitudes.any? { |l| l.abs > 180 }
51
+ raise ArgumentError, 'Wrong longitude value'
52
+ end
53
+ end
54
+ end
55
+ end
@@ -14,7 +14,7 @@ module GoogleMapsJuice
14
14
  elsif response.limit_error?
15
15
  raise GoogleMapsJuice::ApiLimitError, build_error_message(response)
16
16
  elsif response.error?
17
- raise GoogleMapsJuice::Error, "API #{build_error_message(response)}"
17
+ raise GoogleMapsJuice::ResponseError, "API #{build_error_message(response)}"
18
18
  else
19
19
  response
20
20
  end
@@ -1,3 +1,3 @@
1
1
  module GoogleMapsJuice
2
- VERSION = "1.0.0"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -1,3 +1,4 @@
1
+ require 'active_support'
1
2
  require 'active_support/core_ext/object'
2
3
  require 'active_support/dependencies/autoload'
3
4
 
@@ -14,8 +15,9 @@ module GoogleMapsJuice
14
15
  autoload :Endpoint, 'google_maps_juice/endpoint'
15
16
  autoload :Geocoding, 'google_maps_juice/geocoding'
16
17
  autoload :Timezone, 'google_maps_juice/timezone'
18
+ autoload :Directions, 'google_maps_juice/directions'
17
19
 
18
- class Error < Exception; end
19
- class ApiLimitError < Exception; end
20
- class ZeroResults < Exception; end
20
+ class ResponseError < RuntimeError; end
21
+ class ApiLimitError < ResponseError; end
22
+ class ZeroResults < ResponseError; end
21
23
  end
metadata CHANGED
@@ -1,29 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_maps_juice
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Algonauti srl
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2018-10-17 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - "~>"
16
+ - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: '5.2'
18
+ version: '0'
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
- - - "~>"
23
+ - - ">="
25
24
  - !ruby/object:Gem::Version
26
- version: '5.2'
25
+ version: '0'
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: excon
29
28
  requirement: !ruby/object:Gem::Requirement
@@ -38,104 +37,6 @@ dependencies:
38
37
  - - ">="
39
38
  - !ruby/object:Gem::Version
40
39
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: bundler
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '1.16'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '1.16'
55
- - !ruby/object:Gem::Dependency
56
- name: rake
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '12.3'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '12.3'
69
- - !ruby/object:Gem::Dependency
70
- name: rspec
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '3.5'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '3.5'
83
- - !ruby/object:Gem::Dependency
84
- name: webmock
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '3.4'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '3.4'
97
- - !ruby/object:Gem::Dependency
98
- name: dotenv
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '2.5'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '2.5'
111
- - !ruby/object:Gem::Dependency
112
- name: vcr
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '4.0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '4.0'
125
- - !ruby/object:Gem::Dependency
126
- name: coveralls
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '0.8'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '0.8'
139
40
  description: 'Put Google Maps APIs in a spin-dryer and drink their juice: Geocoding,
140
41
  Time Zones, ...and more upcoming!'
141
42
  email:
@@ -144,11 +45,12 @@ executables: []
144
45
  extensions: []
145
46
  extra_rdoc_files: []
146
47
  files:
48
+ - ".github/workflows/ci.yml"
147
49
  - ".gitignore"
148
50
  - ".rspec"
149
- - ".ruby-version"
150
- - ".travis.yml"
51
+ - ".tool-versions"
151
52
  - Gemfile
53
+ - Gemfile.lock
152
54
  - LICENSE.txt
153
55
  - README.md
154
56
  - Rakefile
@@ -159,6 +61,8 @@ files:
159
61
  - lib/google_maps_juice.rb
160
62
  - lib/google_maps_juice/client.rb
161
63
  - lib/google_maps_juice/configuration.rb
64
+ - lib/google_maps_juice/directions.rb
65
+ - lib/google_maps_juice/directions/response.rb
162
66
  - lib/google_maps_juice/endpoint.rb
163
67
  - lib/google_maps_juice/geocoding.rb
164
68
  - lib/google_maps_juice/geocoding/response.rb
@@ -168,7 +72,6 @@ homepage: https://github.com/algonauti/google_maps_juice
168
72
  licenses:
169
73
  - MIT
170
74
  metadata: {}
171
- post_install_message:
172
75
  rdoc_options: []
173
76
  require_paths:
174
77
  - lib
@@ -176,16 +79,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
176
79
  requirements:
177
80
  - - ">="
178
81
  - !ruby/object:Gem::Version
179
- version: '0'
82
+ version: 3.2.0
180
83
  required_rubygems_version: !ruby/object:Gem::Requirement
181
84
  requirements:
182
85
  - - ">="
183
86
  - !ruby/object:Gem::Version
184
87
  version: '0'
185
88
  requirements: []
186
- rubyforge_project:
187
- rubygems_version: 2.7.3
188
- signing_key:
89
+ rubygems_version: 4.0.10
189
90
  specification_version: 4
190
91
  summary: 'Client for popular Google Maps API Services: Geocoding, Time Zones'
191
92
  test_files: []
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.5.0
data/.travis.yml DELETED
@@ -1,10 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.5.0
5
-
6
- before_install: gem install bundler -v 1.16.4
7
-
8
- install: bundle install
9
-
10
- script: bundle exec rspec