my_john_deere_api 2.3.1 → 2.3.2
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 +39 -18
- 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: da3d6b3ad58337a3842a1789a14401a2511de3a5fa0afddfe97dc6160d966c2b
|
|
4
|
+
data.tar.gz: d71594d268b6afcd7c4d949ead108815201b717ba63b5f435666b6775c4b6d6e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7f407f316f53015f4ce095a851fbd10e7e07a4d0e6c348e5a528aa5dbb89d6faa17978b500071b5d5c601b0bd294f63bd121f658096e3bb9eefe61a8c649aefe
|
|
7
|
+
data.tar.gz: baeb71aa75157da5f550e4f7532294fbbdcb79d348491191893433365996605124174e885792979fb29b9b73c15373068e2d74eede9d944da7d5f0b5bb3fd76c
|
data/README.md
CHANGED
|
@@ -12,7 +12,28 @@ without having to code your own oauth process, API requests, and pagination.
|
|
|
12
12
|
* Provides `get`, `create`, `put`, and `delete` methods to make easy, authenticated, direct API calls
|
|
13
13
|
* Uses ruby enumerables to handle pagination behind the scenes. Calls like `each`, `map`, etc will fetch new pages of data as needed.
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## Table of Contents
|
|
16
|
+
|
|
17
|
+
* [How to Read This Documentation](#how-to-read-this-documentation)
|
|
18
|
+
* [Authorizing with John Deere via oAuth 1.0](#authorizing-with-john-deere-via-oauth-10)
|
|
19
|
+
* [Interacting with the User's John Deere Account](#interacting-with-the-users-john-deere-account)
|
|
20
|
+
* [Using the Client to Do Stuff](#using-the-client-to-do-stuff)
|
|
21
|
+
* [Contribution Products](#contribution-products)
|
|
22
|
+
* [Contribution Definitions](#contribution-definitions)
|
|
23
|
+
* [Organizations](#organizations)
|
|
24
|
+
* [Assets](#assets)
|
|
25
|
+
* [Direct API Requests](#direct-api-requests)
|
|
26
|
+
* [GET](#get)
|
|
27
|
+
* [POST](#post)
|
|
28
|
+
* [PUT](#put)
|
|
29
|
+
* [DELETE](#delete)
|
|
30
|
+
* [Errors](#errors)
|
|
31
|
+
* [How Can I Help?](#how-can-i-help)
|
|
32
|
+
* [Give Us a Star!](#give-us-a-star)
|
|
33
|
+
* [Contribute to This Gem](#contribute-to-this-gem)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## How To Read This Documentation
|
|
16
37
|
|
|
17
38
|
We provide RDoc documentation, but here is a helpful guide for getting started. Because the gem name is long, all examples are going
|
|
18
39
|
to assume this shortcut:
|
|
@@ -32,7 +53,7 @@ It really means:
|
|
|
32
53
|
MyJohnDeereApi::Authorize
|
|
33
54
|
```
|
|
34
55
|
|
|
35
|
-
|
|
56
|
+
## Authorizing with John Deere via oAuth 1.0
|
|
36
57
|
|
|
37
58
|
This is the simplest path to authorization, though your user has to jump through an extra hoop of giving you the verification code:
|
|
38
59
|
|
|
@@ -96,7 +117,7 @@ authorize = JD::Authorize.new(API_KEY, API_SECRET, environment: :sandbox)
|
|
|
96
117
|
authorize.verify(params[:oauth_verifier])
|
|
97
118
|
```
|
|
98
119
|
|
|
99
|
-
|
|
120
|
+
## Interacting with the User's John Deere Account
|
|
100
121
|
|
|
101
122
|
After authorization is complete, the `Client` object will provide most of the interface for this library. A client can
|
|
102
123
|
be used with or without user credentials, because some API calls are specific to your application's relationship
|
|
@@ -123,7 +144,7 @@ client = JD::Client.new(
|
|
|
123
144
|
```
|
|
124
145
|
|
|
125
146
|
|
|
126
|
-
|
|
147
|
+
## Using the Client to Do Stuff
|
|
127
148
|
|
|
128
149
|
Once you're connected, the client works like a simplified version of ActiveRecord. JSON hashes from the API are
|
|
129
150
|
converted into objects to be easier to work with. Collections of things, like organizations, handle pagination
|
|
@@ -173,7 +194,7 @@ client
|
|
|
173
194
|
```
|
|
174
195
|
|
|
175
196
|
|
|
176
|
-
|
|
197
|
+
### [Contribution Products](https://developer.deere.com/#!documentation&doc=.%2Fmyjohndeere%2Fproducts.htm)
|
|
177
198
|
|
|
178
199
|
Contribution Product collections act like a list. In addition to all the methods included via Ruby's
|
|
179
200
|
[Enumerable Module](https://ruby-doc.org/core-2.7.0/Enumerable.html), contribution product
|
|
@@ -219,7 +240,7 @@ contribution_product.contribution_definitions
|
|
|
219
240
|
```
|
|
220
241
|
|
|
221
242
|
|
|
222
|
-
|
|
243
|
+
### [Contribution Definitions](https://developer.deere.com/#!documentation&doc=.%2Fmyjohndeere%2Fproducts.htm)
|
|
223
244
|
|
|
224
245
|
Handles a contribution product's contribution definitions. Contribution definition collections support the following methods:
|
|
225
246
|
|
|
@@ -252,7 +273,7 @@ contribution_definition.name
|
|
|
252
273
|
```
|
|
253
274
|
|
|
254
275
|
|
|
255
|
-
|
|
276
|
+
### [Organizations](https://developer.deere.com/#!documentation&doc=myjohndeere%2Forganizations.htm)
|
|
256
277
|
|
|
257
278
|
Handles an account's organizations. Organization collections support the following methods:
|
|
258
279
|
|
|
@@ -312,7 +333,7 @@ organization.fields
|
|
|
312
333
|
```
|
|
313
334
|
|
|
314
335
|
|
|
315
|
-
|
|
336
|
+
### [Assets](https://developer.deere.com/#!documentation&doc=.%2Fmyjohndeere%2Fassets.htm)
|
|
316
337
|
|
|
317
338
|
Handles an organization's assets. Asset collections support the following methods:
|
|
318
339
|
|
|
@@ -331,7 +352,7 @@ An individual asset supports the following methods and associations:
|
|
|
331
352
|
* sub\_type
|
|
332
353
|
* links
|
|
333
354
|
* update(attributes)
|
|
334
|
-
*
|
|
355
|
+
* locations (collection of this asset's locations)
|
|
335
356
|
|
|
336
357
|
```ruby
|
|
337
358
|
organization = client.organizations.first
|
|
@@ -391,13 +412,13 @@ asset.save
|
|
|
391
412
|
```
|
|
392
413
|
|
|
393
414
|
|
|
394
|
-
|
|
415
|
+
## Direct API Requests
|
|
395
416
|
|
|
396
417
|
While the goal of the client is to eliminate the need to make/interpret calls to the John Deere API, it's important
|
|
397
418
|
to be able to make calls that are not yet fully supported by the client. Or sometimes, you need to troubleshoot.
|
|
398
419
|
|
|
399
420
|
|
|
400
|
-
|
|
421
|
+
### GET
|
|
401
422
|
|
|
402
423
|
|
|
403
424
|
GET requests require only a resource path.
|
|
@@ -428,7 +449,7 @@ Abbreviated sample response:
|
|
|
428
449
|
This won't provide any client goodies like pagination or validation, but it does parse the returned JSON.
|
|
429
450
|
|
|
430
451
|
|
|
431
|
-
|
|
452
|
+
### POST
|
|
432
453
|
|
|
433
454
|
POST requests require a resource path, and a hash for the request body. The client will camelize the keys, and convert to JSON.
|
|
434
455
|
|
|
@@ -454,7 +475,7 @@ client.post(
|
|
|
454
475
|
John Deere's standard response is a 201 HTTP status code, with the message "Created". This method returns the full Net::HTTP response.
|
|
455
476
|
|
|
456
477
|
|
|
457
|
-
|
|
478
|
+
### PUT
|
|
458
479
|
|
|
459
480
|
PUT requests require a resource path, and a hash for the request body. The client will camelize the keys, and convert to JSON.
|
|
460
481
|
|
|
@@ -480,7 +501,7 @@ client.put(
|
|
|
480
501
|
John Deere's standard response is a 204 HTTP status code, with the message "No Content". This method returns the full Net::HTTP response.
|
|
481
502
|
|
|
482
503
|
|
|
483
|
-
|
|
504
|
+
### DELETE
|
|
484
505
|
|
|
485
506
|
DELETE requests require only a resource path.
|
|
486
507
|
|
|
@@ -491,7 +512,7 @@ client.delete('/assets/123123')
|
|
|
491
512
|
John Deere's standard response is a 204 HTTP status code, with the message "No Content". This method returns the full Net::HTTP response.
|
|
492
513
|
|
|
493
514
|
|
|
494
|
-
|
|
515
|
+
## Errors
|
|
495
516
|
|
|
496
517
|
Custom errors help clearly identify problems when using the client:
|
|
497
518
|
|
|
@@ -511,16 +532,16 @@ Custom errors help clearly identify problems when using the client:
|
|
|
511
532
|
to this gem!
|
|
512
533
|
|
|
513
534
|
|
|
514
|
-
|
|
535
|
+
## How Can I Help?
|
|
515
536
|
|
|
516
|
-
|
|
537
|
+
### Give Us a Star!
|
|
517
538
|
|
|
518
539
|
*Star* this gem on [GitHub](https://github.com/Intellifarm/my_john_deere_api). It helps developers
|
|
519
540
|
find and choose this gem over others that may be out there. To our knowledge, there are no other
|
|
520
541
|
John Deere gems that are being actively maintained.
|
|
521
542
|
|
|
522
543
|
|
|
523
|
-
|
|
544
|
+
### Contribute to This Gem
|
|
524
545
|
|
|
525
546
|
The easiest way to contribute is:
|
|
526
547
|
|