my_john_deere_api 0.12.3 → 0.12.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3237e5669c2065e7cad92bef10e67a23a92ff1c8ae77dc9d8108034d1e903d5
4
- data.tar.gz: 94a533836b5a55c9626640b3bfce071e34b579c9ae3ad9794cab85cf93c6db93
3
+ metadata.gz: 272b78cd5d3c194ea5ca6362a9a8f64b1d5be22b4ec79968c4575d7be5497699
4
+ data.tar.gz: 7b77df8259ab5c41696339835f4c3cdcea26ebf6e0473936f18348a14ca675d1
5
5
  SHA512:
6
- metadata.gz: cd988f0992634f6b0ed2f22cf68c055e73c78ba1a9f0cbfaeb42f9ad81d8394dccb3271b0ad006951d04236645a3c8b57cec67f72215252e56556f0514eeb277
7
- data.tar.gz: 7f5d2d31cb5f13c3cfbbfb5d075ed12e6c634d68b95a82fbba8885bf56fef273ee9e16b239f69bf5a63d20bc2f611df9c68bb9027b42c119136579833b947948
6
+ metadata.gz: 8b4b8aef5761dff7936fe113a44af60b53182e28c907b07bd37444ede8461ea9439ccd53c39b7e9ad177ff2723069d475fc7964f6343f8004fd75ba3d159c7f8
7
+ data.tar.gz: 937e79548f856c03aac06bed21986590ff24cda529284d43763ae5b1784926b614476d53a10ebe85b0cdec8abce63bc1506f038017919144cce985a026001fb3
data/README.md CHANGED
@@ -83,4 +83,76 @@ that contains the verification code so the user doesn't have to provide it.
83
83
  authorize.verify(params[:oauth_verifier])
84
84
 
85
85
 
86
+ ### Interacting with the user's John Deere account
87
+
88
+ After authorization is complete, the `Client` object will provide most of the interface for this library. A client can
89
+ be used with or without user credentials, because some API calls are specific to your application's relationship
90
+ with John Deere, not your user's. But most interactions will involve user data. Here's how to instantiate a client:
91
+
92
+ client = JD::Client.new(
93
+ # the application's API key
94
+ API_KEY,
95
+
96
+ # the application's API secret
97
+ API_SECRET,
98
+
99
+ # the chosen environment (:sandbox or :live)
100
+ environment: :sandbox,
101
+
102
+ # the user's access credentials
103
+ access: [ACCESS_TOKEN, ACCESS_SECRET]
104
+ )
105
+
106
+
107
+ #### Arbitrary GET requests
108
+
109
+ While the goal of the client is to eliminate the need to make/interpret calls to the John Deere API, it's important
110
+ to be able to make calls that are not yet fully supported by the client. Or sometimes, you need to troubleshoot.
111
+ You can pass any path to the get method, and receive the JSON-parsed response.
112
+
113
+ client.get('/organizations')
114
+
115
+ # Abbreviated sample response:
116
+ {
117
+ "links": [...],
118
+ "total": 1,
119
+ "values": [
120
+ {
121
+ "@type": "Organization",
122
+ "name": "ABC Farms",
123
+ "type": "customer",
124
+ "member": true,
125
+ "id": "123123",
126
+ "links": [...]
127
+ },
128
+ ]
129
+ }
130
+
131
+ This won't provide any client goodies like pagination, validation or weeding out the stuff you don't need (like the nifty client methods).
132
+
133
+
134
+ #### Arbitrary POST requests
135
+
136
+ You can also make arbitrary POST requests. This method takes a required resource path, and a hash for the request body that
137
+ the client will convert to JSON.
138
+
139
+ client.post(
140
+ '/organizations/123123/assets',
141
+ {
142
+ "title"=>"i like turtles",
143
+ "assetCategory"=>"DEVICE",
144
+ "assetType"=>"SENSOR",
145
+ "assetSubType"=>"ENVIRONMENTAL",
146
+ "links"=>[
147
+ {
148
+ "@type"=>"Link",
149
+ "rel"=>"contributionDefinition",
150
+ "uri"=>"https://sandboxapi.deere.com/platform/contributionDefinitions/CONTRIBUTION_DEFINITION_ID"
151
+ }
152
+ ]
153
+ }
154
+ )
155
+
156
+ The response for most requests is just an HTTP status code, with no body. If a body is provided, it will be JSON-parsed and returned.
157
+
86
158
  More details coming soon.
@@ -1,3 +1,3 @@
1
1
  module MyJohnDeereApi
2
- VERSION='0.12.3'
2
+ VERSION='0.12.4'
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.3
4
+ version: 0.12.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaime Bellmyer