google_distance_matrix 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e2a2232b164549acbd29af07935315c8859dc19c
4
- data.tar.gz: 3f29dc7ef98d87e913c1372fabd660766150dc8b
2
+ SHA256:
3
+ metadata.gz: 38cca78e153cdfc6eca4ccb53116f4d5224872342179ce20bc9869961e0abffe
4
+ data.tar.gz: 12f845ae5fad59d60bd6f9796da24c4ce736ab7766cf1fd95e9cfe315d1660ba
5
5
  SHA512:
6
- metadata.gz: bead0dcdb680422cac5db6463af54580036dc6fae0f98373eec513e18a3a197ca7981d57db4ca64a27cc7461e675bd181b81a284b0cd98129e98fa916735be28
7
- data.tar.gz: 0d6d9b8a96282568c647293adab6c58e9eed438e36d1e42f1f4b473a6da59c7cb5014eebc5cc56b4326211e8faa68e292651940a5f1e1d2c30b9b82ba5435710
6
+ metadata.gz: b4dd69ed7bf22b3c8ee1c8443aa63f486bbfe4139f4dfc3aea7671018ff01a4997253837812c92d552047132e6fb0e2c5cb348f980a969bbe2f6dc943212d959
7
+ data.tar.gz: b25399a083d05f99b7345cd1ba167701e00b79265302131bcbea76608419210d7d094238134d86e31e1dfbc83590d0686143eac7ae5909eb3f690b9d136e9832
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.3.4
1
+ 2.5.3
data/.travis.yml CHANGED
@@ -1,13 +1,10 @@
1
1
  before_install:
2
2
  - gem update bundler
3
3
  rvm:
4
- - 2.1.0
5
- - 2.1.2
6
- - 2.1.5
7
- - 2.2.3
8
- - 2.3.0
9
- - 2.3.1
10
- - 2.3.4
4
+ - 2.3.8
5
+ - 2.4.5
6
+ - 2.5.5
7
+ - 2.6.2
11
8
  - ruby-head
12
9
  matrix:
13
10
  allow_failures:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## v.0.6.1 (to be released)
2
+
3
+
4
+ ## v.0.6.0
5
+
6
+ * Depend on activemodel & activesupport < 5.3 (by brauliomartinezlm)
7
+ * Tested with Ruby 2.5.
8
+ * Dropped support for Ruby 2.2 and below.
9
+ * Added support for `channel` (by michaelgpearce)
10
+
1
11
  ## v.0.5.0
2
12
 
3
13
  This release contains breaking change where `url` has been renamed to
@@ -1,6 +1,6 @@
1
1
  # frozen_String_literal: true
2
2
 
3
- lib = File.expand_path('../lib', __FILE__)
3
+ lib = File.expand_path('lib', __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require 'google_distance_matrix/version'
6
6
 
@@ -19,14 +19,14 @@ 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 'activesupport', '>= 3.2.13', '<= 5'
23
- spec.add_dependency 'activemodel', '>= 3.2.13', '<= 5'
22
+ spec.add_dependency 'activemodel', '>= 3.2.13', '< 5.3'
23
+ spec.add_dependency 'activesupport', '>= 3.2.13', '< 5.3'
24
24
  spec.add_dependency 'google_business_api_url_signer', '~> 0.1.3'
25
25
 
26
26
  spec.add_development_dependency 'bundler'
27
- spec.add_development_dependency 'rspec', '~> 3.5.0'
28
- spec.add_development_dependency 'rubocop', '~> 0.48'
29
- spec.add_development_dependency 'shoulda-matchers', '~> 3.1.1'
30
- spec.add_development_dependency 'webmock', '~> 3.0.1'
31
27
  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 'shoulda-matchers', '~> 4.0.0.rc1'
31
+ spec.add_development_dependency 'webmock', '~> 3.4.2'
32
32
  end
@@ -18,7 +18,7 @@ module GoogleDistanceMatrix
18
18
  mode avoid units language
19
19
  departure_time arrival_time
20
20
  transit_mode transit_routing_preference
21
- traffic_model
21
+ traffic_model channel
22
22
  ].freeze
23
23
 
24
24
  API_DEFAULTS = {
@@ -84,7 +84,7 @@ module GoogleDistanceMatrix
84
84
  API_DEFAULTS.each_pair do |attr_name, value|
85
85
  self[attr_name] = begin
86
86
  value.dup
87
- rescue
87
+ rescue StandardError
88
88
  value
89
89
  end
90
90
  end
@@ -105,10 +105,7 @@ module GoogleDistanceMatrix
105
105
  attr_and_value[1].nil? || param_same_as_api_default?(attr_and_value)
106
106
  end
107
107
 
108
- if google_business_api_client_id.present?
109
- out << ['client', google_business_api_client_id]
110
- end
111
-
108
+ out << ['client', google_business_api_client_id] if google_business_api_client_id.present?
112
109
  out << ['key', google_api_key] if google_api_key.present?
113
110
 
114
111
  out
@@ -19,7 +19,7 @@ module GoogleDistanceMatrix
19
19
  msg = args.first
20
20
  tags = PREFIXES.dup.concat Array.wrap(options[:tag])
21
21
 
22
- backend.public_send level, tag_msg(msg, tags) if backend
22
+ backend&.public_send level, tag_msg(msg, tags)
23
23
  end
24
24
  end
25
25
 
@@ -74,9 +74,7 @@ module GoogleDistanceMatrix
74
74
 
75
75
  def extract_and_assign_attributes_from_object(object)
76
76
  attrs = Hash[ATTRIBUTES.map do |attr_name|
77
- if object.respond_to? attr_name
78
- [attr_name, object.public_send(attr_name)]
79
- end
77
+ [attr_name, object.public_send(attr_name)] if object.respond_to? attr_name
80
78
  end.compact]
81
79
 
82
80
  attrs.delete 'address' if attrs.key?('lat') || attrs.key?('lng')
@@ -58,11 +58,12 @@ module GoogleDistanceMatrix
58
58
  #
59
59
  # Example of usage
60
60
  # p d 17998321 # => "00000001 00010010 10100001 11110001"
61
- def d(v, bits = 32, chunk_size = 8)
61
+ def d(val, bits = 32, chunk_size = 8)
62
62
  (bits - 1).downto(0)
63
- .map { |n| v[n] }
63
+ .map { |n| val[n] }
64
64
  .each_slice(chunk_size).map(&:join).join ' '
65
65
  end
66
66
  end
67
67
  end
68
68
  end
69
+ # rubocop:enable Style/NumericPredicate
@@ -10,8 +10,9 @@ module GoogleDistanceMatrix
10
10
 
11
11
  def initialize(matrix)
12
12
  @matrix = matrix
13
- end # Public: Finds routes for given place.
13
+ end
14
14
 
15
+ # Public: Finds routes for given place.
15
16
  #
16
17
  # place - Either an origin or destination, or an object which you built the place from
17
18
  #
@@ -53,9 +54,7 @@ module GoogleDistanceMatrix
53
54
  origin = ensure_place options[:origin]
54
55
  destination = ensure_place options[:destination]
55
56
 
56
- if origin.nil? || destination.nil?
57
- raise ArgumentError, 'Must provide origin and destination'
58
- end
57
+ raise ArgumentError, 'Must provide origin and destination' if origin.nil? || destination.nil?
59
58
 
60
59
  routes_for(origin).detect { |route| route.destination == destination }
61
60
  end
@@ -196,4 +195,5 @@ module GoogleDistanceMatrix
196
195
  raise InvalidQuery, 'Matrix must be in mode driving and a departure_time must be set'
197
196
  end
198
197
  end
198
+ # rubocop:enable Metrics/ClassLength
199
199
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GoogleDistanceMatrix
4
- VERSION = '0.5.0'
4
+ VERSION = '0.6.0'
5
5
  end
@@ -29,6 +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
33
 
33
34
  it 'asks client when cache miss' do
34
35
  expect(client).to receive(:get).with(url, options).and_return 'api-data'
@@ -49,7 +49,7 @@ describe GoogleDistanceMatrix::UrlBuilder do
49
49
 
50
50
  describe '#sensitive_url' do
51
51
  it 'fails if the url is more than 2048 characters' do
52
- long_string = ''.dup
52
+ long_string = +''
53
53
  2049.times { long_string << 'a' }
54
54
 
55
55
  expect(subject).to receive(:query_params_string).and_return long_string
metadata CHANGED
@@ -1,25 +1,25 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_distance_matrix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.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: 2017-04-23 00:00:00.000000000 Z
11
+ date: 2019-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: activesupport
14
+ name: activemodel
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 3.2.13
20
- - - "<="
20
+ - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '5'
22
+ version: '5.3'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,19 +27,19 @@ dependencies:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: 3.2.13
30
- - - "<="
30
+ - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '5'
32
+ version: '5.3'
33
33
  - !ruby/object:Gem::Dependency
34
- name: activemodel
34
+ name: activesupport
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: 3.2.13
40
- - - "<="
40
+ - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: '5'
42
+ version: '5.3'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -47,9 +47,9 @@ dependencies:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: 3.2.13
50
- - - "<="
50
+ - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: '5'
52
+ version: '5.3'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: google_business_api_url_signer
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -79,75 +79,75 @@ dependencies:
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
81
  - !ruby/object:Gem::Dependency
82
- name: rspec
82
+ name: rake
83
83
  requirement: !ruby/object:Gem::Requirement
84
84
  requirements:
85
- - - "~>"
85
+ - - ">="
86
86
  - !ruby/object:Gem::Version
87
- version: 3.5.0
87
+ version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
90
  version_requirements: !ruby/object:Gem::Requirement
91
91
  requirements:
92
- - - "~>"
92
+ - - ">="
93
93
  - !ruby/object:Gem::Version
94
- version: 3.5.0
94
+ version: '0'
95
95
  - !ruby/object:Gem::Dependency
96
- name: rubocop
96
+ name: rspec
97
97
  requirement: !ruby/object:Gem::Requirement
98
98
  requirements:
99
99
  - - "~>"
100
100
  - !ruby/object:Gem::Version
101
- version: '0.48'
101
+ version: 3.8.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: '0.48'
108
+ version: 3.8.0
109
109
  - !ruby/object:Gem::Dependency
110
- name: shoulda-matchers
110
+ name: rubocop
111
111
  requirement: !ruby/object:Gem::Requirement
112
112
  requirements:
113
113
  - - "~>"
114
114
  - !ruby/object:Gem::Version
115
- version: 3.1.1
115
+ version: 0.59.2
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: 3.1.1
122
+ version: 0.59.2
123
123
  - !ruby/object:Gem::Dependency
124
- name: webmock
124
+ name: shoulda-matchers
125
125
  requirement: !ruby/object:Gem::Requirement
126
126
  requirements:
127
127
  - - "~>"
128
128
  - !ruby/object:Gem::Version
129
- version: 3.0.1
129
+ version: 4.0.0.rc1
130
130
  type: :development
131
131
  prerelease: false
132
132
  version_requirements: !ruby/object:Gem::Requirement
133
133
  requirements:
134
134
  - - "~>"
135
135
  - !ruby/object:Gem::Version
136
- version: 3.0.1
136
+ version: 4.0.0.rc1
137
137
  - !ruby/object:Gem::Dependency
138
- name: rake
138
+ name: webmock
139
139
  requirement: !ruby/object:Gem::Requirement
140
140
  requirements:
141
- - - ">="
141
+ - - "~>"
142
142
  - !ruby/object:Gem::Version
143
- version: '0'
143
+ version: 3.4.2
144
144
  type: :development
145
145
  prerelease: false
146
146
  version_requirements: !ruby/object:Gem::Requirement
147
147
  requirements:
148
- - - ">="
148
+ - - "~>"
149
149
  - !ruby/object:Gem::Version
150
- version: '0'
150
+ version: 3.4.2
151
151
  description: Ruby client for The Google Distance Matrix API
152
152
  email:
153
153
  - thhermansen@gmail.com
@@ -222,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
222
  version: '0'
223
223
  requirements: []
224
224
  rubyforge_project:
225
- rubygems_version: 2.5.2
225
+ rubygems_version: 2.7.6
226
226
  signing_key:
227
227
  specification_version: 4
228
228
  summary: Ruby client for The Google Distance Matrix API