gistance 1.1.0 → 1.2.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
2
  SHA1:
3
- metadata.gz: 0bb92df92ed4fea89666a41d5c2c2f022ffe7c38
4
- data.tar.gz: d291398fbabe94d12d404dbf431a80ca4bb7070f
3
+ metadata.gz: 19bd9d56947e3ca6c8928a676f133748aac382ed
4
+ data.tar.gz: 6e17c917f886d710220754edd936bbf586ccf9c3
5
5
  SHA512:
6
- metadata.gz: 45793bb6bcb381a7ef454c1173d09272c4886a6b6d59e5354d4b99814d994fc0b7ac95026c88823897cd0e6f04e51fff00b14bd06a72ed4e85d4c0548126fa1d
7
- data.tar.gz: 65720f0ad44376ed8813d97d6bfbbebc65008c2db59e21b611adb997110f5360a28e511d7d95c538c7d7d561a4027e85d090f0877ba7ad36352ce47293334e28
6
+ metadata.gz: 2c24751f2975401787661da72216a95ca9c8770768b742c3c8ba525920cd5ea4872c41f22de23d3cfe848cfd6c32f5f0a9f2ab3d81768c845d1f45ffd8311932
7
+ data.tar.gz: 778c86fec5a8e26cba1cdb898d00e6a839fcec26b1ef1ceb6f8c5afe35e6a6204ef72399f3e45730d9613a1f8194ce9ed7b091c4adf40ec5a7751e621407384e
data/README.md CHANGED
@@ -33,7 +33,7 @@ API methods are available as module methods
33
33
  ```ruby
34
34
  Gistance.configure do |c|
35
35
  c.api_key = 'YOUR_API_KEY'
36
- c.unit = 'imperial' # default to metric
36
+ c.units = 'imperial' # default to metric
37
37
  c.language = 'fr' # default to en
38
38
  c.sensor = true # default to false
39
39
  end
@@ -44,13 +44,13 @@ or as client instance methods
44
44
  ```ruby
45
45
  Gistance::Client.new(
46
46
  api_key: 'YOUR_API_KEY',
47
- unit: 'imperial',
47
+ units: 'imperial',
48
48
  language: 'fr',
49
49
  sensor: true
50
50
  )
51
51
  ```
52
52
 
53
- The `unit`, `language` and `sensor` parameters can be set globally or can be provided for every request if passed as parameters.
53
+ The `units`, `language` and `sensor` parameters can be set globally or can be provided for every request if passed as parameters.
54
54
 
55
55
  ## Authentication
56
56
 
@@ -22,9 +22,9 @@ Gem::Specification.new do |gem|
22
22
  gem.require_paths = ['lib']
23
23
  gem.test_files = Dir.glob('spec/**/*')
24
24
 
25
- gem.add_dependency 'faraday', '~> 0.8.9'
26
- gem.add_dependency 'faraday_middleware', '~> 0.9.0'
25
+ gem.add_dependency 'faraday', '~>0.9.1'
26
+ gem.add_dependency 'faraday_middleware', '~> 0.9.1'
27
27
  gem.add_dependency 'hashie', '~>2.0.5'
28
28
  gem.add_dependency 'json', '~>1.8.1'
29
- gem.add_dependency 'multi_json', '~>1.9.2'
29
+ gem.add_dependency 'multi_json', '~>1.11.0'
30
30
  end
@@ -6,7 +6,7 @@ module Gistance
6
6
  :api_endpoint,
7
7
  :api_key,
8
8
  :language,
9
- :unit,
9
+ :units,
10
10
  :sensor,
11
11
  :business
12
12
  ].freeze
@@ -36,7 +36,7 @@ module Gistance
36
36
  self.api_endpoint = DEFAULT_API_ENDPOINT
37
37
  self.api_key = nil
38
38
  self.language = 'en'
39
- self.unit = 'metric'
39
+ self.units = 'metric'
40
40
  self.sensor = false
41
41
  self.business = nil
42
42
  end
@@ -17,7 +17,7 @@ module Gistance
17
17
 
18
18
  def request(method, options)
19
19
  response = connection.send(method) do |request|
20
- [:language, :unit, :sensor].each do |option|
20
+ [:language, :units, :sensor].each do |option|
21
21
  request.params[option] = options.delete(option) || self.public_send(option)
22
22
  end
23
23
 
@@ -1,5 +1,5 @@
1
1
  module Gistance
2
2
  # Current version
3
3
  # @return [String]
4
- VERSION = '1.1.0'.freeze
4
+ VERSION = '1.2.0'.freeze
5
5
  end
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://maps.googleapis.com/maps/api/distancematrix/json?destinations=48.857066,%202.341138&language=en&origins=10%2BPlace%2Bde%2Bla%2BConcorde,%2B75008%2BParis,%2BFrance&sensor=false&unit=metric
5
+ uri: https://maps.googleapis.com/maps/api/distancematrix/json?destinations=48.857066,%202.341138&language=en&origins=10%2BPlace%2Bde%2Bla%2BConcorde,%2B75008%2BParis,%2BFrance&sensor=false&units=metric
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -61,6 +61,6 @@ http_interactions:
61
61
  ],
62
62
  "status" : "OK"
63
63
  }
64
- http_version:
64
+ http_version:
65
65
  recorded_at: Wed, 02 Apr 2014 22:24:10 GMT
66
66
  recorded_with: VCR 2.9.0
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://maps.googleapis.com/maps/api/distancematrix/json?destinations=48.857066,%202.341138&language=en&origins=10%2BPlace%2Bde%2Bla%2BConcorde,%2B75008%2BParis,%2BFrance&sensor=false&unit=metric
5
+ uri: https://maps.googleapis.com/maps/api/distancematrix/json?destinations=48.857066,%202.341138&language=en&origins=10%2BPlace%2Bde%2Bla%2BConcorde,%2B75008%2BParis,%2BFrance&sensor=false&units=metric
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -61,6 +61,6 @@ http_interactions:
61
61
  ],
62
62
  "status" : "OK"
63
63
  }
64
- http_version:
64
+ http_version:
65
65
  recorded_at: Wed, 02 Apr 2014 22:24:10 GMT
66
66
  recorded_with: VCR 2.9.0
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://maps.googleapis.com/maps/api/distancematrix/json?destinations=48.857066,%202.341138&language=en&origins=10%2BPlace%2Bde%2Bla%2BConcorde,%2B75008%2BParis,%2BFrance&sensor=false&unit=metric
5
+ uri: https://maps.googleapis.com/maps/api/distancematrix/json?destinations=48.857066,%202.341138&language=en&origins=10%2BPlace%2Bde%2Bla%2BConcorde,%2B75008%2BParis,%2BFrance&sensor=false&units=metric
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -61,6 +61,6 @@ http_interactions:
61
61
  ],
62
62
  "status" : "OK"
63
63
  }
64
- http_version:
64
+ http_version:
65
65
  recorded_at: Wed, 02 Apr 2014 22:24:11 GMT
66
66
  recorded_with: VCR 2.9.0
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://maps.googleapis.com/maps/api/distancematrix/json?destinations=48.857066,%202.341138&language=en&origins=10%2BPlace%2Bde%2Bla%2BConcorde,%2B75008%2BParis,%2BFrance&sensor=false&unit=metric
5
+ uri: https://maps.googleapis.com/maps/api/distancematrix/json?destinations=48.857066,%202.341138&language=en&origins=10%2BPlace%2Bde%2Bla%2BConcorde,%2B75008%2BParis,%2BFrance&sensor=false&units=metric
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -61,6 +61,6 @@ http_interactions:
61
61
  ],
62
62
  "status" : "OK"
63
63
  }
64
- http_version:
64
+ http_version:
65
65
  recorded_at: Wed, 02 Apr 2014 22:24:10 GMT
66
66
  recorded_with: VCR 2.9.0
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://maps.googleapis.com/maps/api/distancematrix/json?destinations=48.857066,%202.341138&language=en&origins=10%2BPlace%2Bde%2Bla%2BConcorde,%2B75008%2BParis,%2BFrance&sensor=false&unit=metric
5
+ uri: https://maps.googleapis.com/maps/api/distancematrix/json?destinations=48.857066,%202.341138&language=en&origins=10%2BPlace%2Bde%2Bla%2BConcorde,%2B75008%2BParis,%2BFrance&sensor=false&units=metric
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -61,6 +61,6 @@ http_interactions:
61
61
  ],
62
62
  "status" : "OK"
63
63
  }
64
- http_version:
64
+ http_version:
65
65
  recorded_at: Wed, 02 Apr 2014 22:24:09 GMT
66
66
  recorded_with: VCR 2.9.0
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://maps.googleapis.com/maps/api/distancematrix/json?destinations=48.857066,%202.341138&language=en&origins=10%2BPlace%2Bde%2Bla%2BConcorde,%2B75008%2BParis,%2BFrance&sensor=false&unit=metric
5
+ uri: https://maps.googleapis.com/maps/api/distancematrix/json?destinations=48.857066,%202.341138&language=en&origins=10%2BPlace%2Bde%2Bla%2BConcorde,%2B75008%2BParis,%2BFrance&sensor=false&units=metric
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -61,6 +61,6 @@ http_interactions:
61
61
  ],
62
62
  "status" : "OK"
63
63
  }
64
- http_version:
64
+ http_version:
65
65
  recorded_at: Wed, 02 Apr 2014 22:24:11 GMT
66
66
  recorded_with: VCR 2.9.0
@@ -52,17 +52,17 @@ describe Gistance::Client do
52
52
  end
53
53
  end
54
54
 
55
- describe 'unit' do
56
- it 'sets unit' do
55
+ describe 'units' do
56
+ it 'sets units' do
57
57
  client = Gistance::Client.new
58
58
 
59
- expect(client.unit).to eql 'metric'
59
+ expect(client.units).to eql 'metric'
60
60
  end
61
61
 
62
62
  it 'overrides module configuration' do
63
- client = Gistance::Client.new(unit: 'imperial')
63
+ client = Gistance::Client.new(units: 'imperial')
64
64
 
65
- expect(client.unit).to eql 'imperial'
65
+ expect(client.units).to eql 'imperial'
66
66
  end
67
67
  end
68
68
 
@@ -23,13 +23,28 @@ describe Gistance::Request do
23
23
 
24
24
  assert_requested :get, 'https://maps.googleapis.com/maps/api/distancematrix/json?'\
25
25
  'language=en&'\
26
- 'unit=metric&'\
26
+ 'units=metric&'\
27
27
  'sensor=false&'\
28
28
  'client=gme-fuubar&'\
29
29
  'channel=test&'\
30
- 'signature=wA6neJ6IkHTs6BxFt6ves7hxsZI%3D'
30
+ 'signature=JlBk9pESGAhVTtCZbidG8Ss2fbM%3D'
31
31
 
32
32
  VCR.turn_on!
33
33
  end
34
+
35
+ it 'respects overridden options' do
36
+ stub_request(:get, /.*maps.*/).to_return(body: { status: 'ok' }.to_json)
37
+
38
+ business_client.units = 'imperial'
39
+
40
+ business_client.get
41
+
42
+ expect(
43
+ a_request(:get, 'https://maps.googleapis.com/maps/api/distancematrix/json').
44
+ with(:query => hash_including("units" => "imperial"))
45
+ ).
46
+ to have_been_made
47
+
48
+ end
34
49
  end
35
50
  end
@@ -32,7 +32,7 @@ RSpec.configure do |c|
32
32
  end
33
33
 
34
34
  def google_distance_matrix_url
35
- "#{Gistance.api_endpoint}?language=en&sensor=false&unit=metric"
35
+ "#{Gistance.api_endpoint}?language=en&sensor=false&units=metric"
36
36
  end
37
37
 
38
38
  def client
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gistance
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aylic Petit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-03 00:00:00.000000000 Z
11
+ date: 2015-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.8.9
19
+ version: 0.9.1
20
20
  type: :runtime
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: 0.8.9
26
+ version: 0.9.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: faraday_middleware
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.9.0
33
+ version: 0.9.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.9.0
40
+ version: 0.9.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: hashie
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.9.2
75
+ version: 1.11.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.9.2
82
+ version: 1.11.0
83
83
  description: Simple Ruby wrapper for the Google Distance Matrix API.
84
84
  email:
85
85
  - sush@users.noreply.github.com
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  version: '0'
135
135
  requirements: []
136
136
  rubyforge_project:
137
- rubygems_version: 2.2.2
137
+ rubygems_version: 2.4.8
138
138
  signing_key:
139
139
  specification_version: 4
140
140
  summary: Google Distance Matrix API Ruby wrapper