my_john_deere_api 0.9.0 → 0.9.1

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
  SHA256:
3
- metadata.gz: 41fea97474f3ff4ef830cfdd646087d1fa57e693f0da95075639da8c0ca83adf
4
- data.tar.gz: 24afb45536681d94ddbd90d560090b4864e3bb4b839824a6247634eeb33641c4
3
+ metadata.gz: e8956e299401f734af29fd95e23dd07305030940f4c37330ffe6b526783d3ecb
4
+ data.tar.gz: 3dfe23a403c6710384785805739d173a7f6099111e32bc7973a98d9114931e8d
5
5
  SHA512:
6
- metadata.gz: ab7e7b57cd96c8e8bcc895e5ea275ac1afd56659b9bf74bb3f848acb15e4a5c7c77f1d979508ad606e0cb55ddefc8d30aa2748bfd9364f82149674572d1bcf5c
7
- data.tar.gz: 0a5fb27c9d4206ecaad1b80e037d37d229dcd4be26cd3b8b3ed19937ce561e3d2b79bb0ed5edfb5e1c724dae4301556d3486d486bf2aef90cd49f2902e8de50f
6
+ metadata.gz: 29f2d83a263206d8b4fb5f076ce0cc63d7306edf05a4294e6fb195b15b55af1575e52a6c80c5610094144f2b8aca45119e31e81182e09d5823ef25b42069f0c7
7
+ data.tar.gz: e17007f771e70709d3e07c6c56017475def8b52a373dda9ef452864347a19cf1e94c0087eb4dc0d4870218639c02ad68f0f06975c35b192f7c463e0c5209a87c
@@ -19,7 +19,7 @@ class MyJohnDeereApi::Authorize
19
19
 
20
20
  @api_key = api_key
21
21
  @api_secret = api_secret
22
- @environment = options[:environment]
22
+ @environment = @options[:environment].to_sym
23
23
  end
24
24
 
25
25
  ##
@@ -20,7 +20,7 @@ module MyJohnDeereApi
20
20
  @api_key = api_key
21
21
  @api_secret = api_secret
22
22
 
23
- @environment = options[:environment]
23
+ @environment = options[:environment].to_sym
24
24
  @base_url = options[:base_url] || URLS[@environment]
25
25
  end
26
26
 
@@ -1,3 +1,3 @@
1
1
  module MyJohnDeereApi
2
- VERSION='0.9.0'
2
+ VERSION='0.9.1'
3
3
  end
@@ -30,6 +30,13 @@ describe 'MyJohnDeereApi::Authorize' do
30
30
  assert_equal environment, authorize.environment
31
31
  end
32
32
 
33
+ it 'converts environment to symbol' do
34
+ environment = 'sandbox'
35
+
36
+ authorize = VCR.use_cassette('catalog') { JD::Authorize.new(API_KEY, API_SECRET, environment: environment) }
37
+ assert_equal environment.to_sym, authorize.environment
38
+ end
39
+
33
40
  it 'defaults the environment to production' do
34
41
  environment = :production
35
42
 
@@ -55,7 +62,7 @@ describe 'MyJohnDeereApi::Authorize' do
55
62
  url = VCR.use_cassette('get_request_token') { authorize.authorize_url }
56
63
  links = VCR.use_cassette('catalog') { JD::Consumer.new(API_KEY, API_SECRET, environment: :sandbox).send(:links) }
57
64
 
58
- assert_includes url, "#{links[:authorize_request_token]}?oauth_token="
65
+ assert_includes url, "#{links[:authorize_request_token]}"
59
66
 
60
67
  query = URI.parse(url).query
61
68
  params = CGI::parse(query)
@@ -33,6 +33,14 @@ describe 'JD::Consumer' do
33
33
  assert_equal JD::Consumer::URLS[default_environment], consumer.base_url
34
34
  end
35
35
 
36
+ it 'converts environment string to symbol' do
37
+ environment = 'sandbox'
38
+ consumer = JD::Consumer.new(API_KEY, API_SECRET, environment: environment)
39
+
40
+ assert_equal environment.to_sym, consumer.environment
41
+ assert_equal JD::Consumer::URLS[environment.to_sym], consumer.base_url
42
+ end
43
+
36
44
  it 'accepts an arbitrary base_url' do
37
45
  base_url = 'https://example.com'
38
46
  consumer = JD::Consumer.new(API_KEY, API_SECRET, base_url: base_url)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: my_john_deere_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaime. Bellmyer