my_john_deere_api 0.12.2 → 0.12.3

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: 19b47734d5e6b4ad385e8ab7a23f2335da7a55cd615e9b893e7a01d32594cedf
4
- data.tar.gz: 409d9106defce29a80ef99b98bb958cada379df66c4e01a1c81d44d47b2e96fc
3
+ metadata.gz: e3237e5669c2065e7cad92bef10e67a23a92ff1c8ae77dc9d8108034d1e903d5
4
+ data.tar.gz: 94a533836b5a55c9626640b3bfce071e34b579c9ae3ad9794cab85cf93c6db93
5
5
  SHA512:
6
- metadata.gz: 8d0133e30516d2a70e9fbd466ed74b2a6aefc8dbcbf69cd84cf935742e682d4077571db4839bcfd49ee2a707f901bfa87012b3c49e07f5d3176a36f7277de490
7
- data.tar.gz: e3e87c29522b6e70fca48b612ac13a19d78abcfc9c27f2f755f8a601630f336092dc325f932b98db7985755f931a6d1041fb9df6a437e58c6aba6c0bb7c67183
6
+ metadata.gz: cd988f0992634f6b0ed2f22cf68c055e73c78ba1a9f0cbfaeb42f9ad81d8394dccb3271b0ad006951d04236645a3c8b57cec67f72215252e56556f0514eeb277
7
+ data.tar.gz: 7f5d2d31cb5f13c3cfbbfb5d075ed12e6c634d68b95a82fbba8885bf56fef273ee9e16b239f69bf5a63d20bc2f611df9c68bb9027b42c119136579833b947948
data/README.md CHANGED
@@ -8,4 +8,79 @@ This client allows you to connect the MyJohnDeere API without having to code you
8
8
  * Simplifies the oAuth negotiation process
9
9
  * Uses ruby enumerables to handle pagination behind the scenes. Calls like `each`, `map`, etc will fetch new pages of data as needed.
10
10
 
11
+ ## Documentation
12
+
13
+ We provide RDoc documentation, but here is a helpful guide for getting started. Because the gem name is long, all examples are going
14
+ to assume this shortcut:
15
+
16
+ JD = MyJohnDeereApi
17
+
18
+ So that when you see:
19
+
20
+ JD::Authorize
21
+
22
+ It really means:
23
+
24
+ MyJohnDeereApi::Authorize
25
+
26
+
27
+ ### Authorizing with John Deere via Auth 1.0
28
+
29
+ This is the simplest path to authorization, though your user has to jump through an extra hoop of giving you the verification code:
30
+
31
+ # Create an authorize object, using your app's API key and secret. You can
32
+ # pass an environment (`:live` or `:sandbox`), which default to `:live`.
33
+ authorize = JD::Authorize.new(API_KEY, API_SECRET, environment: :sandbox)
34
+
35
+ # Retrieve a valid authorization url from John Deere, where you can send
36
+ # your user for authorizing your app to the JD platform.
37
+ url = authorize.authorize_url
38
+
39
+ # Verify the code given to the user during the authorization process, and
40
+ # turn this into access credentials for your user.
41
+ authorize.verify(code)
42
+
43
+ In reality, you will likely need to re-instantiate the authorize object when the user returns, and that works without issue:
44
+
45
+ # Create an authorize object, using your app's API key and secret.
46
+ authorize = JD::Authorize.new(API_KEY, API_SECRET, environment: :sandbox)
47
+
48
+ # Retrieve a valid authorization url from John Deere.
49
+ url = authorize.authorize_url
50
+
51
+ # Queue elevator music while your app serves other users...
52
+
53
+ # Re-create the authorize instance in a different process
54
+ authorize = JD::Authorize.new(API_KEY, API_SECRET, environment: :sandbox)
55
+
56
+ # Proceed as normal
57
+ authorize.verify(code)
58
+
59
+ In a web app, you're prefer that your user doesn't have to copy/paste verification codes. So you can pass in an :oauth_callback url.
60
+ When the user authorizes your app with John Deere, they are redirected to the url you provide, with the paraameter 'oauth_verifier'
61
+ that contains the verification code so the user doesn't have to provide it.
62
+
63
+ # Create an authorize object, using your app's API key and secret.
64
+ authorize = JD::Authorize.new(
65
+ API_KEY,
66
+ API_SECRET,
67
+ environment: :sandbox,
68
+ oauth_callback: 'https://example.com'
69
+ )
70
+
71
+ # Retrieve a valid authorization url from John Deere.
72
+ # This will contain the callback url encoded into the
73
+ # query string for you.
74
+ url = authorize.authorize_url
75
+
76
+ # Queue elevator music while your app serves other users...
77
+
78
+ # Re-create the authorize instance in a different process.
79
+ # It's not necessary to re-initialize with the callback url.
80
+ authorize = JD::Authorize.new(API_KEY, API_SECRET, environment: :sandbox)
81
+
82
+ # Inside a Rails controller, you might do this:
83
+ authorize.verify(params[:oauth_verifier])
84
+
85
+
11
86
  More details coming soon.
@@ -26,7 +26,7 @@ module MyJohnDeereApi
26
26
  end
27
27
 
28
28
  ##
29
- # Option a url which may be used to obtain a verification
29
+ # Url which may be used to obtain a verification
30
30
  # code from the oauth server.
31
31
 
32
32
  def authorize_url
@@ -1,3 +1,3 @@
1
1
  module MyJohnDeereApi
2
- VERSION='0.12.2'
2
+ VERSION='0.12.3'
3
3
  end
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.12.2
4
+ version: 0.12.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaime Bellmyer