my_john_deere_api 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +112 -37
- 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: 5c3847859a2d14a7a9f7b2a7a3bd24dcd1f8a75a46e025c856df025ae8cda773
|
4
|
+
data.tar.gz: ee6697cc5dbcfd946deacb535b6eafe417b6bb5c4bd705bcc797b1ad434975b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9c3426b893a24e62caff5bd56847b350e38020ddd910d481ec7ebf84b2be019dd573a1a0638819277e6327a11969818a666628bed64071c9296c46e3d6cd987
|
7
|
+
data.tar.gz: 11dd36324795e0c3942a02d58fe6efab452d4be514be7e01e8a83eb98bae16488b1967c67eafa3b55fb567166144f0db87e4396645ee1a17f84aefe3fca53204
|
data/README.md
CHANGED
@@ -165,15 +165,103 @@ client
|
|
165
165
|
```
|
166
166
|
|
167
167
|
|
168
|
+
#### [Contribution Products](https://developer.deere.com/#!documentation&doc=.%2Fmyjohndeere%2Fproducts.htm)
|
169
|
+
|
170
|
+
Contribution Product collections act like a list. In addition to all the methods included via Ruby's
|
171
|
+
[Enumerable Module](https://ruby-doc.org/core-2.7.0/Enumerable.html), contribution product
|
172
|
+
collections support the following methods:
|
173
|
+
|
174
|
+
* all
|
175
|
+
* count
|
176
|
+
* first
|
177
|
+
* find(contribution\_product\_id)
|
178
|
+
|
179
|
+
An individual contribution product supports the following methods and associations:
|
180
|
+
|
181
|
+
* id
|
182
|
+
* market_place_name
|
183
|
+
* market_place_description
|
184
|
+
* default\_locale
|
185
|
+
* current\_status
|
186
|
+
* activation\_callback
|
187
|
+
* preview\_images
|
188
|
+
* supported\_regions
|
189
|
+
* supported\_operation\_centers
|
190
|
+
* links
|
191
|
+
* contribution\_definitions (collection of this contribution product's contribution definitions)
|
192
|
+
|
193
|
+
```ruby
|
194
|
+
client.contribution_products
|
195
|
+
# => collection of contribution products under this client
|
196
|
+
|
197
|
+
client.contribution_products.count
|
198
|
+
# => 1
|
199
|
+
|
200
|
+
client.contribution_products.first
|
201
|
+
# => an individual contribution product
|
202
|
+
|
203
|
+
contribution_product = client.contribution_products.find(1234)
|
204
|
+
# => an individual contribution product, fetched by ID
|
205
|
+
|
206
|
+
contribution_product.market_place_name
|
207
|
+
# => 'Market Place Name'
|
208
|
+
|
209
|
+
contribution_product.contribution_definitions
|
210
|
+
# => collection of contribution definitions belonging to this contribution product
|
211
|
+
```
|
212
|
+
|
213
|
+
|
214
|
+
#### [Contribution Definitions](https://developer.deere.com/#!documentation&doc=.%2Fmyjohndeere%2Fproducts.htm)
|
215
|
+
|
216
|
+
Handles a contribution product's contribution definitions. Contribution definition collections support the following methods:
|
217
|
+
|
218
|
+
* all
|
219
|
+
* count
|
220
|
+
* first
|
221
|
+
* find(contribution\_definition\_id)
|
222
|
+
|
223
|
+
An individual contribution definition supports the following methods and associations:
|
224
|
+
|
225
|
+
* id
|
226
|
+
* name
|
227
|
+
* links
|
228
|
+
|
229
|
+
```ruby
|
230
|
+
contribution_product.contribution_definitions
|
231
|
+
# => collection of contribution definitions under this contribution product
|
232
|
+
|
233
|
+
client.contribution_definitions.count
|
234
|
+
# => 1
|
235
|
+
|
236
|
+
client.contribution_definitions.first
|
237
|
+
# => an individual contribution definition
|
238
|
+
|
239
|
+
contribution_definition = contribution_product.contribution_definitions.find(1234)
|
240
|
+
# => an individual contribution definition, fetched by ID
|
241
|
+
|
242
|
+
contribution_definition.name
|
243
|
+
# => 'Contribution Definition Name'
|
244
|
+
```
|
245
|
+
|
246
|
+
|
168
247
|
#### [Organizations](https://developer.deere.com/#!documentation&doc=myjohndeere%2Forganizations.htm)
|
169
248
|
|
170
|
-
|
171
|
-
[Enumerable Module](https://ruby-doc.org/core-2.7.0/Enumerable.html), organization collections support:
|
249
|
+
Handles an account's organizations. Organization collections support the following methods:
|
172
250
|
|
173
251
|
* all
|
174
252
|
* count
|
175
253
|
* first
|
176
|
-
* find
|
254
|
+
* find(organization\_id)
|
255
|
+
|
256
|
+
An individual organization supports the following methods and associations:
|
257
|
+
|
258
|
+
* id
|
259
|
+
* name
|
260
|
+
* type
|
261
|
+
* member?
|
262
|
+
* links
|
263
|
+
* assets (collection of this organization's assets)
|
264
|
+
* fields (collection of this organization's fields)
|
177
265
|
|
178
266
|
The `count` method only requires loading the first page of results, so it's a relatively cheap call. On the other hand,
|
179
267
|
`all` forces the entire collection to be loaded from John Deere's API, so use with caution. Organizations cannot be
|
@@ -187,10 +275,10 @@ client.organizations.count
|
|
187
275
|
# => 15
|
188
276
|
|
189
277
|
client.organizations.first
|
190
|
-
# =>
|
278
|
+
# => an individual organization object
|
191
279
|
|
192
280
|
organization = client.organizations.find(1234)
|
193
|
-
# =>
|
281
|
+
# => an individual organization object, fetched by ID
|
194
282
|
|
195
283
|
organization.name
|
196
284
|
# => 'Smith Farms'
|
@@ -208,56 +296,43 @@ organization.links
|
|
208
296
|
# 'wdtCapableMachines' => 'ttps://sandboxapi.deere.com/platform/organizations/1234/machines?capability=wdt'
|
209
297
|
# }
|
210
298
|
|
211
|
-
|
212
|
-
|
213
|
-
This is much nicer than working with the raw API response:
|
299
|
+
organization.assets
|
300
|
+
# => collection of assets belonging to this organization
|
214
301
|
|
215
|
-
|
216
|
-
|
217
|
-
"links": [
|
218
|
-
{
|
219
|
-
"rel": "self",
|
220
|
-
"uri": "https://sandboxapi.deere.com/platform/organizations/1234"
|
221
|
-
},
|
222
|
-
{
|
223
|
-
"rel": "machines",
|
224
|
-
"uri": "https://sandboxapi.deere.com/platform/organizations/1234/machines"
|
225
|
-
},
|
226
|
-
{
|
227
|
-
"rel": "wdtCapableMachines",
|
228
|
-
"uri": "https://sandboxapi.deere.com/platform/organizations/1234/machines?capability=wdt"
|
229
|
-
}
|
230
|
-
],
|
231
|
-
"id": "1234",
|
232
|
-
"name": "Smith Farms",
|
233
|
-
"type": "customer",
|
234
|
-
"partnerships": [],
|
235
|
-
"member": true
|
236
|
-
}
|
302
|
+
organization.fields
|
303
|
+
# => collection of fields belonging to this organization
|
237
304
|
```
|
238
305
|
|
239
|
-
But the real power comes from daisy-chaining associations together.
|
240
|
-
|
241
306
|
|
242
307
|
#### [Assets](https://developer.deere.com/#!documentation&doc=.%2Fmyjohndeere%2Fassets.htm)
|
243
308
|
|
244
|
-
Handles an organization's assets.
|
309
|
+
Handles an organization's assets. Asset collections support the following methods:
|
245
310
|
|
246
311
|
* all
|
247
312
|
* count
|
248
313
|
* first
|
249
|
-
* find
|
250
|
-
* create
|
314
|
+
* find(asset\_id)
|
315
|
+
* create(attributes)
|
316
|
+
|
317
|
+
An individual asset supports the following methods and associations:
|
318
|
+
|
319
|
+
* id
|
320
|
+
* title
|
321
|
+
* category
|
322
|
+
* type
|
323
|
+
* sub\_type
|
324
|
+
* links
|
325
|
+
* location (collection of this asset's locations)
|
251
326
|
|
252
327
|
```ruby
|
253
328
|
organization = client.organizations.first
|
254
329
|
# => the first organization returned by the client
|
255
330
|
|
256
331
|
organization.assets
|
257
|
-
# => collection of assets
|
332
|
+
# => collection of assets belonging to this organization
|
258
333
|
|
259
334
|
asset = organization.assets.find(123)
|
260
|
-
# => asset object, fetched by ID
|
335
|
+
# => an individual asset object, fetched by ID
|
261
336
|
|
262
337
|
asset.title
|
263
338
|
# => 'AgThing Water Device'
|