google_distance_matrix 0.6.6 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +6 -9
- data/.rubocop.yml +5 -2
- data/.ruby-version +1 -1
- data/CHANGELOG.md +9 -0
- data/README.md +10 -1
- data/google_distance_matrix.gemspec +6 -4
- data/lib/google_distance_matrix/client.rb +2 -2
- data/lib/google_distance_matrix/logger.rb +4 -0
- data/lib/google_distance_matrix/place.rb +0 -4
- data/lib/google_distance_matrix/polyline_encoder/value_encoder.rb +2 -0
- data/lib/google_distance_matrix/url_builder.rb +0 -2
- data/lib/google_distance_matrix/version.rb +1 -1
- data/spec/lib/google_distance_matrix/client_cache_spec.rb +2 -2
- data/spec/lib/google_distance_matrix/configuration_spec.rb +2 -2
- data/spec/lib/google_distance_matrix/log_subscriber_spec.rb +4 -0
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b098eb0fe7c5d46575b1299e8f4b3b157d50bce9e174c5def509202693271922
|
4
|
+
data.tar.gz: cca42d1568b4edea65856e0a9bf908bc8432a72bfed291df793bec72d9352e29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e389e6170462fbba875fcb14cac0ce81a88eaab72a26fc17e615f61c2d820f377fe4f94ae83e429c162909e90f2b762ded571a06bac3d8379062bd44da939b4
|
7
|
+
data.tar.gz: 6a4f8d019754aa7030d311633dc7e2f6f17d97dd19c51955888d5c0ca365c5d7dcdb2f58822c69a8e1a3a3a582cb06f49caa8881dce90ac43c55edcaee5baa55
|
data/.github/workflows/ruby.yml
CHANGED
@@ -3,7 +3,7 @@ name: Ruby
|
|
3
3
|
on:
|
4
4
|
push:
|
5
5
|
branches:
|
6
|
-
-
|
6
|
+
- main
|
7
7
|
pull_request:
|
8
8
|
|
9
9
|
jobs:
|
@@ -13,17 +13,14 @@ jobs:
|
|
13
13
|
strategy:
|
14
14
|
matrix:
|
15
15
|
ruby-version:
|
16
|
-
- '
|
17
|
-
- '2
|
18
|
-
- '3.
|
16
|
+
- '3.1'
|
17
|
+
- '3.2'
|
18
|
+
- '3.3'
|
19
19
|
|
20
20
|
steps:
|
21
|
-
- uses: actions/checkout@
|
21
|
+
- uses: actions/checkout@v4
|
22
22
|
- name: Set up Ruby
|
23
|
-
|
24
|
-
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
25
|
-
# uses: ruby/setup-ruby@v1
|
26
|
-
uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
|
23
|
+
uses: ruby/setup-ruby@v1
|
27
24
|
with:
|
28
25
|
ruby-version: ${{ matrix.ruby-version }}
|
29
26
|
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0.7
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## v.0.7.0
|
2
|
+
|
3
|
+
* chore: bumped dependency support up to Rails 7.2 (by yenshirak)
|
4
|
+
* dropped support for Ruby 2.x
|
5
|
+
|
6
|
+
## v.0.6.7
|
7
|
+
|
8
|
+
* chore: bumped dependency support up to Rails 7.1 (by justisb)
|
9
|
+
|
1
10
|
## v.0.6.6
|
2
11
|
|
3
12
|
* chore: require net/http in client.rb (#57)
|
data/README.md
CHANGED
@@ -103,7 +103,7 @@ routes in your result set for the called method are ok.
|
|
103
103
|
Add this line to your application's Gemfile:
|
104
104
|
|
105
105
|
```ruby
|
106
|
-
gem 'google_distance_matrix'
|
106
|
+
gem 'google_distance_matrix'‚ '~> 0.7.0'
|
107
107
|
```
|
108
108
|
And then execute:
|
109
109
|
|
@@ -114,6 +114,15 @@ Or install it yourself as:
|
|
114
114
|
$ gem install google_distance_matrix
|
115
115
|
|
116
116
|
|
117
|
+
### Ruby 2.x support
|
118
|
+
|
119
|
+
Legacy systems that needs to run on unsupported rubies can depend on `v0.6.7`, which is the last supported version for Ruby 2.
|
120
|
+
|
121
|
+
```ruby
|
122
|
+
gem 'google_distance_matrix', '0.6.7'
|
123
|
+
```
|
124
|
+
|
125
|
+
|
117
126
|
## Configuration
|
118
127
|
|
119
128
|
Configuration is done directly on a matrix or via `GoogleDistanceMatrix.configure_defaults`.
|
@@ -19,14 +19,16 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.
|
23
|
-
|
22
|
+
spec.required_ruby_version = '>= 3.0'
|
23
|
+
|
24
|
+
spec.add_dependency 'activemodel', '>= 3.2.13', '< 8'
|
25
|
+
spec.add_dependency 'activesupport', '>= 3.2.13', '< 8'
|
24
26
|
spec.add_dependency 'google_business_api_url_signer', '~> 0.1.3'
|
25
27
|
|
26
28
|
spec.add_development_dependency 'bundler'
|
27
29
|
spec.add_development_dependency 'rake'
|
28
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
29
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
30
|
+
spec.add_development_dependency 'rspec', '~> 3.12.0'
|
31
|
+
spec.add_development_dependency 'rubocop', '~> 0.93.1'
|
30
32
|
spec.add_development_dependency 'shoulda-matchers', '~> 4.0.0.rc1'
|
31
33
|
spec.add_development_dependency 'webmock', '~> 3.4.2'
|
32
34
|
end
|
@@ -95,8 +95,6 @@ module GoogleDistanceMatrix
|
|
95
95
|
@lng = attributes[:lng]
|
96
96
|
end
|
97
97
|
|
98
|
-
# rubocop:disable Metrics/AbcSize
|
99
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
100
98
|
# rubocop:disable Style/GuardClause
|
101
99
|
def validate_attributes
|
102
100
|
unless address.present? || (lat.present? && lng.present?)
|
@@ -107,8 +105,6 @@ module GoogleDistanceMatrix
|
|
107
105
|
raise ArgumentError, 'Cannot provide address, lat and lng.'
|
108
106
|
end
|
109
107
|
end
|
110
|
-
# rubocop:enable Metrics/AbcSize
|
111
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
112
108
|
# rubocop:enable Style/GuardClause
|
113
109
|
end
|
114
110
|
end
|
@@ -14,6 +14,7 @@ module GoogleDistanceMatrix
|
|
14
14
|
class ValueEncoder
|
15
15
|
# rubocop:disable Metrics/MethodLength
|
16
16
|
# rubocop:disable Metrics/AbcSize
|
17
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
17
18
|
def encode(value)
|
18
19
|
negative = value < 0
|
19
20
|
value = value.abs
|
@@ -49,6 +50,7 @@ module GoogleDistanceMatrix
|
|
49
50
|
# step 11: Convert to ASCII
|
50
51
|
chunks_of_5_bits.map(&:chr)
|
51
52
|
end
|
53
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
52
54
|
# rubocop:enable Metrics/MethodLength
|
53
55
|
# rubocop:enable Metrics/AbcSize
|
54
56
|
|
@@ -81,7 +81,6 @@ module GoogleDistanceMatrix
|
|
81
81
|
end
|
82
82
|
|
83
83
|
# rubocop:disable Metrics/MethodLength
|
84
|
-
# rubocop:disable Metrics/AbcSize
|
85
84
|
def places_to_param(places)
|
86
85
|
places_to_param_config = { lat_lng_scale: configuration.lat_lng_scale }
|
87
86
|
|
@@ -102,7 +101,6 @@ module GoogleDistanceMatrix
|
|
102
101
|
out.join(DELIMITER)
|
103
102
|
end
|
104
103
|
# rubocop:enable Metrics/MethodLength
|
105
|
-
# rubocop:enable Metrics/AbcSize
|
106
104
|
|
107
105
|
def protocol
|
108
106
|
configuration.protocol + '://'
|
@@ -12,7 +12,7 @@ describe GoogleDistanceMatrix::ClientCache do
|
|
12
12
|
|
13
13
|
subject { described_class.new client, cache }
|
14
14
|
|
15
|
-
# rubocop:disable
|
15
|
+
# rubocop:disable Layout/LineLength
|
16
16
|
describe '::key' do
|
17
17
|
it 'returns a digest of given URL' do
|
18
18
|
key = described_class.key 'some url with secret parts', config
|
@@ -29,7 +29,7 @@ describe GoogleDistanceMatrix::ClientCache do
|
|
29
29
|
|
30
30
|
expect(subject.get(url, options)).to eq 'cached-data'
|
31
31
|
end
|
32
|
-
# rubocop:enable
|
32
|
+
# rubocop:enable Layout/LineLength
|
33
33
|
|
34
34
|
it 'asks client when cache miss' do
|
35
35
|
expect(client).to receive(:get).with(url, options).and_return 'api-data'
|
@@ -91,12 +91,12 @@ describe GoogleDistanceMatrix::Configuration do
|
|
91
91
|
it { expect(subject.logger).to be_nil }
|
92
92
|
it { expect(subject.cache).to be_nil }
|
93
93
|
|
94
|
-
# rubocop:disable
|
94
|
+
# rubocop:disable Layout/LineLength
|
95
95
|
it 'has a default expected cache_key_transform' do
|
96
96
|
key = subject.cache_key_transform.call('foo')
|
97
97
|
expect(key).to eq 'f7fbba6e0636f890e56fbbf3283e524c6fa3204ae298382d624741d0dc6638326e282c41be5e4254d8820772c5518a2c5a8c0c7f7eda19594a7eb539453e1ed7'
|
98
98
|
end
|
99
|
-
# rubocop:enable
|
99
|
+
# rubocop:enable Layout/LineLength
|
100
100
|
end
|
101
101
|
|
102
102
|
describe '#to_param' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_distance_matrix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thorbjørn Hermansen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: 3.2.13
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '8'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: 3.2.13
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '8'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: activesupport
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
version: 3.2.13
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
42
|
+
version: '8'
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -49,7 +49,7 @@ dependencies:
|
|
49
49
|
version: 3.2.13
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '
|
52
|
+
version: '8'
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: google_business_api_url_signer
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,28 +98,28 @@ dependencies:
|
|
98
98
|
requirements:
|
99
99
|
- - "~>"
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: 3.
|
101
|
+
version: 3.12.0
|
102
102
|
type: :development
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
106
|
- - "~>"
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version: 3.
|
108
|
+
version: 3.12.0
|
109
109
|
- !ruby/object:Gem::Dependency
|
110
110
|
name: rubocop
|
111
111
|
requirement: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
113
|
- - "~>"
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
version: 0.
|
115
|
+
version: 0.93.1
|
116
116
|
type: :development
|
117
117
|
prerelease: false
|
118
118
|
version_requirements: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
120
|
- - "~>"
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version: 0.
|
122
|
+
version: 0.93.1
|
123
123
|
- !ruby/object:Gem::Dependency
|
124
124
|
name: shoulda-matchers
|
125
125
|
requirement: !ruby/object:Gem::Requirement
|
@@ -214,14 +214,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
214
214
|
requirements:
|
215
215
|
- - ">="
|
216
216
|
- !ruby/object:Gem::Version
|
217
|
-
version: '0'
|
217
|
+
version: '3.0'
|
218
218
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
220
|
- - ">="
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '0'
|
223
223
|
requirements: []
|
224
|
-
rubygems_version: 3.
|
224
|
+
rubygems_version: 3.2.33
|
225
225
|
signing_key:
|
226
226
|
specification_version: 4
|
227
227
|
summary: Ruby client for The Google Distance Matrix API
|