my_john_deere_api 0.15.5 → 0.15.6
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 +4 -4
- data/README.md +27 -24
- data/lib/my_john_deere_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c2ff16197daa2884314b0295473059c263ad769ba4bcf0ee51d02f30926017c
|
4
|
+
data.tar.gz: b817faad358cc21d56082a3dc9b76a61c1a27f27c1f8d769fd0d5cd94dbec8af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f392df59c2d25fabd118e499362b066d870f84f0f1456ec199934ef70f4fa244a9b5912b9b3e4fffd78c945b4a6ba95db4f167ab0c9d93abc12becf925b1f7c
|
7
|
+
data.tar.gz: 612a6f44aff7efa4811cb968101e235b052c035bcbb2ad5d13816c0455a5513bc08950d00d82ce017ee19733c7241fd2fea6c57a98e7e34399ac961ff78cd09f
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[](https://circleci.com/gh/Intellifarm/my_john_deere_api)
|
4
4
|
|
5
|
-
This client allows you to connect the MyJohnDeere API without having to code your own oauth process, API requests, and pagination.
|
5
|
+
This client allows you to connect the MyJohnDeere API without having to code your own oauth process, API requests, and pagination.
|
6
6
|
|
7
7
|
* Supports both sandbox and live mode
|
8
8
|
* Simplifies the oAuth negotiation process
|
@@ -31,7 +31,7 @@ MyJohnDeereApi::Authorize
|
|
31
31
|
### Authorizing with John Deere via Auth 1.0
|
32
32
|
|
33
33
|
This is the simplest path to authorization, though your user has to jump through an extra hoop of giving you the verification code:
|
34
|
-
|
34
|
+
|
35
35
|
```ruby
|
36
36
|
# Create an authorize object, using your app's API key and secret. You can
|
37
37
|
# pass an environment (`:live` or `:sandbox`), which default to `:live`.
|
@@ -43,7 +43,7 @@ url = authorize.authorize_url
|
|
43
43
|
|
44
44
|
# Verify the code given to the user during the authorization process, and
|
45
45
|
# turn this into access credentials for your user.
|
46
|
-
authorize.verify(code)
|
46
|
+
authorize.verify(code)
|
47
47
|
```
|
48
48
|
|
49
49
|
In reality, you will likely need to re-instantiate the authorize object when the user returns, and that works without issue:
|
@@ -71,8 +71,8 @@ that contains the verification code so the user doesn't have to provide it.
|
|
71
71
|
```ruby
|
72
72
|
# Create an authorize object, using your app's API key and secret.
|
73
73
|
authorize = JD::Authorize.new(
|
74
|
-
API_KEY,
|
75
|
-
API_SECRET,
|
74
|
+
API_KEY,
|
75
|
+
API_SECRET,
|
76
76
|
environment: :sandbox,
|
77
77
|
oauth_callback: 'https://example.com'
|
78
78
|
)
|
@@ -102,13 +102,13 @@ with John Deere, not your user's. But most interactions will involve user data.
|
|
102
102
|
client = JD::Client.new(
|
103
103
|
# the application's API key
|
104
104
|
API_KEY,
|
105
|
-
|
105
|
+
|
106
106
|
# the application's API secret
|
107
107
|
API_SECRET,
|
108
|
-
|
108
|
+
|
109
109
|
# the chosen environment (:sandbox or :live)
|
110
110
|
environment: :sandbox,
|
111
|
-
|
111
|
+
|
112
112
|
# the user's access credentials
|
113
113
|
access: [ACCESS_TOKEN, ACCESS_SECRET]
|
114
114
|
)
|
@@ -127,10 +127,13 @@ GET requests require only a resource path.
|
|
127
127
|
|
128
128
|
```ruby
|
129
129
|
client.get('/organizations')
|
130
|
+
```
|
131
|
+
|
132
|
+
Abbreviated sample response:
|
130
133
|
|
131
|
-
|
134
|
+
```json
|
132
135
|
{
|
133
|
-
"links": [...],
|
136
|
+
"links": ["..."],
|
134
137
|
"total": 1,
|
135
138
|
"values": [
|
136
139
|
{
|
@@ -139,8 +142,8 @@ client.get('/organizations')
|
|
139
142
|
"type": "customer",
|
140
143
|
"member": true,
|
141
144
|
"id": "123123",
|
142
|
-
"links": [...]
|
143
|
-
}
|
145
|
+
"links": ["..."]
|
146
|
+
}
|
144
147
|
]
|
145
148
|
}
|
146
149
|
```
|
@@ -156,14 +159,14 @@ POST requests require a resource path, and a hash for the request body. The clie
|
|
156
159
|
client.post(
|
157
160
|
'/organizations/123123/assets',
|
158
161
|
{
|
159
|
-
"title"=>"i like turtles",
|
160
|
-
"assetCategory"=>"DEVICE",
|
161
|
-
"assetType"=>"SENSOR",
|
162
|
-
"assetSubType"=>"ENVIRONMENTAL",
|
162
|
+
"title"=>"i like turtles",
|
163
|
+
"assetCategory"=>"DEVICE",
|
164
|
+
"assetType"=>"SENSOR",
|
165
|
+
"assetSubType"=>"ENVIRONMENTAL",
|
163
166
|
"links"=>[
|
164
167
|
{
|
165
|
-
"@type"=>"Link",
|
166
|
-
"rel"=>"contributionDefinition",
|
168
|
+
"@type"=>"Link",
|
169
|
+
"rel"=>"contributionDefinition",
|
167
170
|
"uri"=>"https://sandboxapi.deere.com/platform/contributionDefinitions/CONTRIBUTION_DEFINITION_ID"
|
168
171
|
}
|
169
172
|
]
|
@@ -182,14 +185,14 @@ PUT requests require a resource path, and a hash for the request body. The clien
|
|
182
185
|
client.put(
|
183
186
|
'/assets/123123',
|
184
187
|
{
|
185
|
-
"title"=>"i REALLY like turtles",
|
186
|
-
"assetCategory"=>"DEVICE",
|
187
|
-
"assetType"=>"SENSOR",
|
188
|
-
"assetSubType"=>"ENVIRONMENTAL",
|
188
|
+
"title"=>"i REALLY like turtles",
|
189
|
+
"assetCategory"=>"DEVICE",
|
190
|
+
"assetType"=>"SENSOR",
|
191
|
+
"assetSubType"=>"ENVIRONMENTAL",
|
189
192
|
"links"=>[
|
190
193
|
{
|
191
|
-
"@type"=>"Link",
|
192
|
-
"rel"=>"contributionDefinition",
|
194
|
+
"@type"=>"Link",
|
195
|
+
"rel"=>"contributionDefinition",
|
193
196
|
"uri"=>"https://sandboxapi.deere.com/platform/contributionDefinitions/CONTRIBUTION_DEFINITION_ID"
|
194
197
|
}
|
195
198
|
]
|