my_john_deere_api 1.0.3 → 1.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a102c3adce407338232eacc4660b0dd77cfa6c3de5df8b9b685128ddec54177
4
- data.tar.gz: 89fa527b141905f0d338be9c1046877ebf11e4ce40bb6b60870a53f076e1cccf
3
+ metadata.gz: 73e95842d21ef2ed1ebf798feb07b69328e1554f42695b60c4caa755da34ee7f
4
+ data.tar.gz: 5c438391b2565e2c050abdbbd6b04610f7427141c3d1eb3115a616dfdf649784
5
5
  SHA512:
6
- metadata.gz: a69fa01f798ab1f313d04cc1bae801a5034d1137f94af51c00b0a888ffc2a5c1049ba47b39682d4fbb1cb753bf9c94375ca647965680d748e6985be16f1d9d9c
7
- data.tar.gz: 26a3b54145b35dfd48f167c69b85bb1349a41451b007d54cc8204c1d952eafd2ceb98d43dce4054974e0d88c6b76a466492b91fd8cc811ee37830060981e016a
6
+ metadata.gz: b09a10a8add71b254f67864f04e472cce3c6c72db7805e152f64967e14ae20f36327c686560ab5e7e7d8686860290b2b2b17cd350ce164c2008f47f669e38b97
7
+ data.tar.gz: 9e8fadcf86385d040574343441a724d21db5e408381b55045149b459a76e3d8da6c482c4850787564866200a17da63922169e01cb80392cc31c3b7ca750cbadb
data/README.md CHANGED
@@ -127,6 +127,11 @@ This client is a work in progress. You can currently do the following things wit
127
127
 
128
128
  ```
129
129
  client
130
+ ├── contribution_products
131
+ ├── count
132
+ ├── all
133
+ ├── first
134
+ └── find(contribution_product_id)
130
135
  └── organizations
131
136
  ├── count
132
137
  ├── all
@@ -154,6 +159,7 @@ client
154
159
  └── first
155
160
  ```
156
161
 
162
+
157
163
  #### [Organizations](https://developer.deere.com/#!documentation&doc=myjohndeere%2Forganizations.htm)
158
164
 
159
165
  Organization collections act like a list. In addition to all the methods included via Ruby's
@@ -228,7 +234,7 @@ This is much nicer than working with the raw API response:
228
234
  But the real power comes from daisy-chaining associations together.
229
235
 
230
236
 
231
- ### [Assets](https://developer.deere.com/#!documentation&doc=.%2Fmyjohndeere%2Fassets.htm)
237
+ #### [Assets](https://developer.deere.com/#!documentation&doc=.%2Fmyjohndeere%2Fassets.htm)
232
238
 
233
239
  Handles an organization's assets. Supported methods:
234
240
 
@@ -102,7 +102,8 @@ module MyJohnDeereApi
102
102
  # contribution products associated with this app (not user-specific)
103
103
 
104
104
  def contribution_products
105
- []
105
+ return @contribution_products if defined?(@contribution_products)
106
+ @contribution_products = MyJohnDeereApi::Request::Collection::ContributionProducts.new(accessor)
106
107
  end
107
108
 
108
109
  private
@@ -1,3 +1,3 @@
1
1
  module MyJohnDeereApi
2
- VERSION='1.0.3'
2
+ VERSION='1.1.0'
3
3
  end
@@ -140,6 +140,18 @@ describe 'MyJohnDeereApi::Client' do
140
140
  end
141
141
  end
142
142
 
143
+ describe '#contribution_products' do
144
+ it 'returns a collection of contribution products for this account' do
145
+ contribution_products = VCR.use_cassette('get_contribution_products') { client.contribution_products.all; client.contribution_products }
146
+
147
+ assert_kind_of JD::Request::Collection::ContributionProducts, contribution_products
148
+
149
+ contribution_products.each do |contribution_product|
150
+ assert_kind_of JD::Model::ContributionProduct, contribution_product
151
+ end
152
+ end
153
+ end
154
+
143
155
  describe '#consumer' do
144
156
  it 'receives the api key/secret and environment of the client' do
145
157
  environment = :sandbox
@@ -194,6 +194,10 @@ class VcrSetup
194
194
  new_client.get('/contributionProducts?clientControlled=true')
195
195
  end
196
196
 
197
+ def get_contribution_product
198
+ new_client.get("/contributionProducts/#{ENV['CONTRIBUTION_PRODUCT_ID']}")
199
+ end
200
+
197
201
  def get_organizations
198
202
  new_client.organizations.all
199
203
  end
@@ -214,10 +218,6 @@ class VcrSetup
214
218
  @temporary_field.flags.all
215
219
  end
216
220
 
217
- def get_contribution_product
218
- new_client.get("/contributionProducts/#{ENV['CONTRIBUTION_PRODUCT_ID']}")
219
- end
220
-
221
221
  def post_assets
222
222
  @temporary_asset_id = find_organization(ENV['ORGANIZATION_ID']).assets.create(asset_attributes).id
223
223
  placeholders[@temporary_asset_id] = asset_id
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: 1.0.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaime Bellmyer