google_distance_matrix 0.6.6 → 0.7.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: 9a10d12400b1ded8f4d8803a1ba53e38fbdf2ae26687dec9c763bd5aa2327100
4
- data.tar.gz: 81ebcd758bccc4ce98fb57221954d570ffa0be69a27e7bf101616966d2288850
3
+ metadata.gz: b098eb0fe7c5d46575b1299e8f4b3b157d50bce9e174c5def509202693271922
4
+ data.tar.gz: cca42d1568b4edea65856e0a9bf908bc8432a72bfed291df793bec72d9352e29
5
5
  SHA512:
6
- metadata.gz: 23373a368af616c476a49caecf1235d769acb5ce3bf19f005848bbbda5d4fc31b7ae5d246a5ee4f8c2511cc3251e5dc9504aea79d234eac719ac123d86927236
7
- data.tar.gz: 7c2bb213bcda87d85fc6c3e3e572211a99a4cf86acb3d2dddde1492f92ea34514be60eaf71fa282796ddf60171e478c5620c61b460a8aa6e38eb2c9f552f2b56
6
+ metadata.gz: 0e389e6170462fbba875fcb14cac0ce81a88eaab72a26fc17e615f61c2d820f377fe4f94ae83e429c162909e90f2b762ded571a06bac3d8379062bd44da939b4
7
+ data.tar.gz: 6a4f8d019754aa7030d311633dc7e2f6f17d97dd19c51955888d5c0ca365c5d7dcdb2f58822c69a8e1a3a3a582cb06f49caa8881dce90ac43c55edcaee5baa55
@@ -3,7 +3,7 @@ name: Ruby
3
3
  on:
4
4
  push:
5
5
  branches:
6
- - master
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
- - '2.6'
17
- - '2.7'
18
- - '3.0'
16
+ - '3.1'
17
+ - '3.2'
18
+ - '3.3'
19
19
 
20
20
  steps:
21
- - uses: actions/checkout@v2
21
+ - uses: actions/checkout@v4
22
22
  - name: Set up Ruby
23
- # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
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
@@ -1,6 +1,9 @@
1
- Metrics/LineLength:
1
+ AllCops:
2
+ NewCops: disable
3
+
4
+ Layout/LineLength:
2
5
  Max: 100
3
-
6
+
4
7
  Metrics/BlockLength:
5
8
  Exclude:
6
9
  - 'spec/**/*_spec.rb'
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.5
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.add_dependency 'activemodel', '>= 3.2.13', '< 7.1'
23
- spec.add_dependency 'activesupport', '>= 3.2.13', '< 7.1'
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.8.0'
29
- spec.add_development_dependency 'rubocop', '~> 0.59.2'
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
@@ -32,8 +32,8 @@ module GoogleDistanceMatrix
32
32
  end
33
33
 
34
34
  handle response, url
35
- rescue Timeout::Error => error
36
- raise ServerError, error
35
+ rescue Timeout::Error => e
36
+ raise ServerError, e
37
37
  end
38
38
 
39
39
  private
@@ -23,6 +23,10 @@ module GoogleDistanceMatrix
23
23
  end
24
24
  end
25
25
 
26
+ def level
27
+ backend&.level || 1
28
+ end
29
+
26
30
  private
27
31
 
28
32
  def tag_msg(msg, tags)
@@ -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 + '://'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GoogleDistanceMatrix
4
- VERSION = '0.6.6'
4
+ VERSION = '0.7.0'
5
5
  end
@@ -12,7 +12,7 @@ describe GoogleDistanceMatrix::ClientCache do
12
12
 
13
13
  subject { described_class.new client, cache }
14
14
 
15
- # rubocop:disable Metrics/LineLength
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 Metrics/LineLength
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 Metrics/LineLength
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 Metrics/LineLength
99
+ # rubocop:enable Layout/LineLength
100
100
  end
101
101
 
102
102
  describe '#to_param' do
@@ -18,6 +18,10 @@ module GoogleDistanceMatrix
18
18
  def error(msg)
19
19
  raise msg
20
20
  end
21
+
22
+ def level
23
+ 1
24
+ end
21
25
  end
22
26
 
23
27
  # Little helper to clean up examples
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.6.6
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: 2023-08-26 00:00:00.000000000 Z
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: '7.1'
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: '7.1'
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: '7.1'
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: '7.1'
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.8.0
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.8.0
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.59.2
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.59.2
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.4.10
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