my_john_deere_api 2.1.0 → 2.1.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 +25 -13
- 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: b404eb35593809c27e7f5932317e89a182416efbbf5c9ab017a2eb98a0a2b28a
|
4
|
+
data.tar.gz: 6b051603fecfa6893230de4fb2a4e5828b4e42ebd4ed59709e46e5681888964a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b46d15e4f6e5321eed51f4855a10aa618c3637dc7179faae2e4545d7dc3eec41aceaf4f5c08642257f550b60ae2bdfd44d6161be4bd97ae7be150c7eb0617e6
|
7
|
+
data.tar.gz: 05faaa3f5d5784797a53a96c2dea408fdc844b8c14120054c6ff9f6e594de3a1278aece5fc3ac13e03bc3e7a4290f381131a4e3f28bd2dd3fe0f2e9795e5ab09
|
data/README.md
CHANGED
@@ -113,6 +113,10 @@ client = JD::Client.new(
|
|
113
113
|
# the chosen environment (:sandbox or :live)
|
114
114
|
environment: :sandbox,
|
115
115
|
|
116
|
+
# optional contribution_definition_id. This is needed for some requests,
|
117
|
+
# but the client can be created without it, in order to find it.
|
118
|
+
contribution_definition_id: CONTRIBUTION_DEFINITION_ID,
|
119
|
+
|
116
120
|
# the user's access credentials
|
117
121
|
access: [ACCESS_TOKEN, ACCESS_SECRET]
|
118
122
|
)
|
@@ -145,16 +149,17 @@ client
|
|
145
149
|
├── first
|
146
150
|
└── find(organization_id)
|
147
151
|
├── assets(attributes)
|
152
|
+
| ├── create(attributes)
|
148
153
|
| ├── count
|
149
154
|
| ├── all
|
150
155
|
| ├── first
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
| └── find(asset_id)
|
157
|
+
| ├── update(attributes)
|
158
|
+
| └── locations
|
159
|
+
| ├── create(attributes)
|
160
|
+
| ├── count
|
161
|
+
| ├── all
|
162
|
+
| └── first
|
158
163
|
└── fields
|
159
164
|
├── count
|
160
165
|
├── all
|
@@ -170,7 +175,7 @@ client
|
|
170
175
|
#### [Contribution Products](https://developer.deere.com/#!documentation&doc=.%2Fmyjohndeere%2Fproducts.htm)
|
171
176
|
|
172
177
|
Contribution Product collections act like a list. In addition to all the methods included via Ruby's
|
173
|
-
[Enumerable Module](https://ruby-doc.org/core-2.7.0/Enumerable.html), contribution product
|
178
|
+
[Enumerable Module](https://ruby-doc.org/core-2.7.0/Enumerable.html), contribution product
|
174
179
|
collections support the following methods:
|
175
180
|
|
176
181
|
* all
|
@@ -310,11 +315,11 @@ organization.fields
|
|
310
315
|
|
311
316
|
Handles an organization's assets. Asset collections support the following methods:
|
312
317
|
|
318
|
+
* create(attributes)
|
313
319
|
* all
|
314
320
|
* count
|
315
321
|
* first
|
316
322
|
* find(asset\_id)
|
317
|
-
* create(attributes)
|
318
323
|
|
319
324
|
An individual asset supports the following methods and associations:
|
320
325
|
|
@@ -324,6 +329,7 @@ An individual asset supports the following methods and associations:
|
|
324
329
|
* type
|
325
330
|
* sub\_type
|
326
331
|
* links
|
332
|
+
* update(attributes)
|
327
333
|
* location (collection of this asset's locations)
|
328
334
|
|
329
335
|
```ruby
|
@@ -352,13 +358,10 @@ asset.links
|
|
352
358
|
# => a hash of API urls related to this asset
|
353
359
|
```
|
354
360
|
|
355
|
-
|
356
|
-
[John Deere API docs](https://developer.deere.com/#!documentation). This method creates the asset in
|
357
|
-
the John Deere platform, and returns the newly created record.
|
361
|
+
The `create` method creates the asset in the John Deere platform, and returns the newly created record.
|
358
362
|
|
359
363
|
```ruby
|
360
364
|
asset = organization.assets.create(
|
361
|
-
contribution_definition_id: ENV['CONTRIBUTION_DEFINITION_ID'],
|
362
365
|
title: 'Asset Title',
|
363
366
|
asset_category: 'DEVICE',
|
364
367
|
asset_type: 'SENSOR',
|
@@ -369,6 +372,15 @@ asset.title
|
|
369
372
|
# => 'Asset Title'
|
370
373
|
```
|
371
374
|
|
375
|
+
The `update` method updates the local object, and also the asset on the John Deere platform.
|
376
|
+
Only the title of an asset can be updated.
|
377
|
+
|
378
|
+
```ruby
|
379
|
+
asset.update(title: 'New Title')
|
380
|
+
asset.title
|
381
|
+
# => 'New Title', also John Deere record is updated
|
382
|
+
```
|
383
|
+
|
372
384
|
|
373
385
|
### Direct API Requests
|
374
386
|
|