my_john_deere_api 0.12.4 → 0.12.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/lib/my_john_deere_api/client.rb +10 -3
  3. data/lib/my_john_deere_api/model/contribution_product.rb +24 -0
  4. data/lib/my_john_deere_api/model/field.rb +1 -1
  5. data/lib/my_john_deere_api/model/organization.rb +1 -1
  6. data/lib/my_john_deere_api/model.rb +1 -0
  7. data/lib/my_john_deere_api/request/collection/asset_locations.rb +2 -2
  8. data/lib/my_john_deere_api/request/collection/assets.rb +2 -2
  9. data/lib/my_john_deere_api/request/collection/contribution_products.rb +26 -0
  10. data/lib/my_john_deere_api/request/collection.rb +1 -0
  11. data/lib/my_john_deere_api/request/individual/contribution_product.rb +19 -0
  12. data/lib/my_john_deere_api/request/individual.rb +3 -2
  13. data/lib/my_john_deere_api/version.rb +1 -1
  14. data/test/lib/my_john_deere_api/authorize_test.rb +6 -6
  15. data/test/lib/my_john_deere_api/client_test.rb +31 -70
  16. data/test/lib/my_john_deere_api/consumer_test.rb +14 -14
  17. data/test/lib/my_john_deere_api/model/asset_location_test.rb +8 -23
  18. data/test/lib/my_john_deere_api/model/asset_test.rb +6 -9
  19. data/test/lib/my_john_deere_api/model/base_test.rb +3 -4
  20. data/test/lib/my_john_deere_api/model/contribution_product_test.rb +68 -0
  21. data/test/lib/my_john_deere_api/model/field_test.rb +8 -11
  22. data/test/lib/my_john_deere_api/model/flag_test.rb +1 -1
  23. data/test/lib/my_john_deere_api/model/organization_test.rb +19 -22
  24. data/test/lib/my_john_deere_api/model_test.rb +4 -0
  25. data/test/lib/my_john_deere_api/request/collection/asset_locations_test.rb +9 -48
  26. data/test/lib/my_john_deere_api/request/collection/assets_test.rb +9 -31
  27. data/test/lib/my_john_deere_api/request/collection/base_test.rb +2 -5
  28. data/test/lib/my_john_deere_api/request/collection/contribution_products_test.rb +88 -0
  29. data/test/lib/my_john_deere_api/request/collection/fields_test.rb +4 -12
  30. data/test/lib/my_john_deere_api/request/collection/flags_test.rb +5 -19
  31. data/test/lib/my_john_deere_api/request/collection/organizations_test.rb +2 -4
  32. data/test/lib/my_john_deere_api/request/collection_test.rb +4 -0
  33. data/test/lib/my_john_deere_api/request/create/asset_location_test.rb +20 -50
  34. data/test/lib/my_john_deere_api/request/create/asset_test.rb +10 -24
  35. data/test/lib/my_john_deere_api/request/create/base_test.rb +0 -2
  36. data/test/lib/my_john_deere_api/request/individual/asset_test.rb +0 -3
  37. data/test/lib/my_john_deere_api/request/individual/base_test.rb +0 -3
  38. data/test/lib/my_john_deere_api/request/individual/contribution_product_test.rb +32 -0
  39. data/test/lib/my_john_deere_api/request/individual_test.rb +4 -0
  40. data/test/support/helper.rb +56 -5
  41. data/test/support/vcr/catalog.yml +51 -7
  42. data/test/support/vcr/delete_asset.yml +51 -10
  43. data/test/support/vcr/get_access_token.yml +8 -8
  44. data/test/support/vcr/get_asset.yml +107 -10
  45. data/test/support/vcr/get_asset_locations.yml +154 -17
  46. data/test/support/vcr/get_assets.yml +110 -10
  47. data/test/support/vcr/get_contribution_product.yml +91 -0
  48. data/test/support/vcr/get_contribution_products.yml +91 -0
  49. data/test/support/vcr/get_fields.yml +108 -11
  50. data/test/support/vcr/get_flags.yml +11 -11
  51. data/test/support/vcr/get_organization.yml +90 -0
  52. data/test/support/vcr/get_organizations.yml +73 -30
  53. data/test/support/vcr/get_request_token.yml +14 -14
  54. data/test/support/vcr/post_asset_locations.yml +165 -20
  55. data/test/support/vcr/post_assets.yml +119 -22
  56. data/test/support/vcr/{app_consumer.yml → url.yml} +7 -7
  57. data/test/support/vcr/warning.txt +24 -0
  58. data/test/support/vcr_setup.rb +420 -0
  59. metadata +14 -4
  60. data/test/support/vcr/post_flag_categories.yml +0 -49
@@ -14,24 +14,24 @@ http_interactions:
14
14
  User-Agent:
15
15
  - OAuth gem v0.5.4
16
16
  Authorization:
17
- - OAuth oauth_consumer_key="johndeere-wgmADngYCRmfpEbVgSyc709wnyRux5J7PAv8SE7B",
18
- oauth_nonce="hLAsNSIk6Q2d3ULD6bT6rVf10km1qN5edh9HvNUgSc", oauth_signature="wjrjTVSXWY3uanxn69Y251jDFn8%3D",
19
- oauth_signature_method="HMAC-SHA1", oauth_timestamp="1578174980", oauth_version="1.0"
17
+ - OAuth oauth_consumer_key="johndeere-0000000000000000000000000000000000000000",
18
+ oauth_nonce="000000000000000000000000000000000000000000", oauth_signature="0000000000000000000000000000",
19
+ oauth_signature_method="HMAC-SHA1", oauth_timestamp="1581028214", oauth_version="1.0"
20
20
  response:
21
21
  status:
22
22
  code: 200
23
23
  message: OK
24
24
  headers:
25
25
  Date:
26
- - Sat, 04 Jan 2020 21:56:21 GMT
26
+ - Fri, 07 Feb 2020 04:28:52 GMT
27
27
  Content-Type:
28
28
  - application/vnd.deere.axiom.v3+json;charset=UTF-8
29
29
  X-Deere-Handling-Server:
30
- - ip-10-214-44-80
30
+ - ip-10-214-44-29
31
31
  X-Frame-Options:
32
32
  - SAMEORIGIN
33
33
  X-Deere-Elapsed-Ms:
34
- - '16'
34
+ - '19'
35
35
  Cache-Control:
36
36
  - no-store
37
37
  Content-Language:
@@ -42,5 +42,5 @@ http_interactions:
42
42
  encoding: ASCII-8BIT
43
43
  string: '{"@type":"ApiCatalog","links":[{"@type":"Link","rel":"oauthRequestToken","uri":"https://sandboxapi.deere.com/platform/oauth/request_token"},{"@type":"Link","rel":"oauthAuthorizeRequestToken","uri":"https://my.deere.com/consentToUseOfData?oauth_token={token}"},{"@type":"Link","rel":"oauthAccessToken","uri":"https://sandboxapi.deere.com/platform/oauth/access_token"},{"@type":"Link","rel":"agencies","uri":"https://sandboxapi.deere.com/platform/agencies"}]}'
44
44
  http_version:
45
- recorded_at: Sat, 04 Jan 2020 21:56:21 GMT
45
+ recorded_at: Fri, 07 Feb 2020 04:28:53 GMT
46
46
  recorded_with: VCR 5.0.0
@@ -0,0 +1,24 @@
1
+ -------------------------------------------------------------------------------
2
+ WARNING: Generating VCR cassettes requires the following in your John Deere
3
+ API sandbox account:
4
+
5
+ - You must have asset creation/deletion enabled in your account.
6
+ - You must have at least one organization created.
7
+ - The organization must have at least one field.
8
+ - The field must have at least one flag.
9
+
10
+ By default, this setup will use the first organization returned from the API.
11
+ If this is not the organization you wish to use, you can create an environment
12
+ variable ORGANIZATION_ID which contains the id of the organization you wish to
13
+ use. This organization must contain a field, which contains a flag.
14
+
15
+ This is required because organizations cannot be created via the API, and
16
+ fields and flags can be created but not destroyed via the API. We don't create
17
+ anything during VCR cassette recording that we can't undo. This process will
18
+ leave your sandbox environment in the exact state it was before the cassettes
19
+ were generated.
20
+
21
+ If you don't meet the above requirements, you will be unable to successfully
22
+ generate the VCR cassettes.
23
+ -------------------------------------------------------------------------------
24
+
@@ -0,0 +1,420 @@
1
+ require 'vcr'
2
+ require 'yaml'
3
+ require 'json'
4
+ require 'date'
5
+
6
+ ##########################################################################
7
+ # We're going to make a bunch of requests upfront so we can create/delete
8
+ # things in the correct order, and end up with no permanent changes to the
9
+ # sandbox environment. We only need to do this pre-emptively for resources
10
+ # where we create/delete. We build the client from scratch to get the full
11
+ # interaction history recorded.
12
+ ##########################################################################
13
+
14
+ class VcrSetup
15
+ attr_reader :api_key, :api_secret, :access_token, :access_secret, :verify_code,
16
+ :contribution_product_id, :contribution_definition_id,
17
+ :placeholders, :organization_id, :asset_id, :field_id, :flag_id
18
+
19
+ GENERATED_CASSETTES = [
20
+ :catalog, :get_request_token, :get_access_token,
21
+ :get_contribution_products, :get_contribution_product,
22
+ :get_organizations, :get_organization,
23
+ :get_fields, :get_flags,
24
+ :post_assets, :get_assets, :get_asset,
25
+ :post_asset_locations, :get_asset_locations,
26
+ :delete_asset
27
+ ]
28
+
29
+ def initialize
30
+ @vcr_dir = File.dirname(__FILE__) + '/vcr'
31
+
32
+ # Before we configure VCR, we want to make a few requests to set some constants
33
+ @client = new_client
34
+
35
+ # placeholders
36
+ @uuid = '00000000-0000-0000-0000-000000000000'
37
+ @api_key = 'johndeere-0000000000000000000000000000000000000000'
38
+ @api_secret = '0' * 64
39
+ @access_token = @uuid
40
+ @access_secret = '0' * 107 + '='
41
+ @contribution_product_id = @uuid
42
+ @contribution_definition_id = @uuid
43
+ @organization_id = '000000'
44
+ @asset_id = @uuid
45
+ @field_id = @uuid
46
+ @flag_id = @uuid
47
+ @verify_code = 'VERIFY'
48
+
49
+ @placeholders = {
50
+ API_KEY => @api_key,
51
+ API_SECRET => @api_secret,
52
+ ACCESS_TOKEN => @access_token,
53
+ ACCESS_SECRET => @access_secret
54
+ }
55
+
56
+ unless all_cassettes_generated? || meets_vcr_requirements?
57
+ raise "Cannot continue until VCR cassettes can be generated."
58
+ end
59
+
60
+ set_contribution_product_id
61
+ set_contribution_definition_id
62
+ set_organization_id
63
+
64
+ configure_vcr
65
+
66
+ url
67
+
68
+ # create and retrieve things
69
+ unless all_cassettes_generated?
70
+ puts "\ngenerating:"
71
+
72
+ GENERATED_CASSETTES.each do |method_name|
73
+ filename = "#{method_name}.yml"
74
+
75
+ if File.exist?("#{@vcr_dir}/#{filename}")
76
+ puts " - using #{filename}"
77
+ else
78
+ puts " - generating #{filename}"
79
+ VCR.use_cassette(method_name) { send(method_name) }
80
+ end
81
+ end
82
+ end
83
+
84
+ sanitize_files
85
+ end
86
+
87
+ # provide a client with sanitized credentials
88
+ def client
89
+ JD::Client.new(api_key, api_secret, environment: :sandbox, access: [access_token, access_secret])
90
+ end
91
+
92
+ def timestamp
93
+ return @timestamp if defined?(@timestamp)
94
+
95
+ filename = "#{@vcr_dir}/get_asset_locations.yml"
96
+
97
+ @timestamp = if File.exist?(filename)
98
+ contents = File.read('test/support/vcr/get_asset_locations.yml')
99
+ body = YAML.load(contents)['http_interactions'].last['response']['body']['string']
100
+ JSON.parse(body)['values'].last['timestamp']
101
+ else
102
+ Time.now.strftime('%Y-%m-%dT%H:%M:%S.000Z')
103
+ end
104
+ end
105
+
106
+ def epoch_timestamp
107
+ return @epoch_timestamp if defined?(@epoch_timestamp)
108
+ @epoch_timestamp = DateTime.parse(timestamp).to_time.to_i
109
+ end
110
+
111
+ def coordinates
112
+ @coordinates ||= [-96.668978, 40.865984]
113
+ end
114
+
115
+ def geometry
116
+ @geometry ||= {
117
+ type: 'Feature',
118
+ geometry: {
119
+ geometries: [
120
+ coordinates: coordinates,
121
+ type: 'Point'
122
+ ],
123
+ type: 'GeometryCollection'
124
+ }
125
+ }
126
+ end
127
+
128
+ def measurement_data
129
+ @measurement_data ||= [
130
+ {
131
+ name: 'Temperature',
132
+ value: '68.0',
133
+ unit: 'F'
134
+ }
135
+ ]
136
+ end
137
+
138
+ def asset_attributes
139
+ @asset_attributes ||= {
140
+ contribution_definition_id: ENV['CONTRIBUTION_DEFINITION_ID'],
141
+ title: 'Asset Title',
142
+ asset_category: 'DEVICE',
143
+ asset_type: 'SENSOR',
144
+ asset_sub_type: 'ENVIRONMENTAL',
145
+ links: [
146
+ {
147
+ '@type' => 'Link',
148
+ 'rel' => 'contributionDefinition',
149
+ 'uri' => "#{url}/contributionDefinitions/#{ENV['CONTRIBUTION_DEFINITION_ID']}"
150
+ }
151
+ ]
152
+ }.freeze
153
+ end
154
+
155
+ def asset_location_attributes
156
+ @asset_location_attributes ||= {
157
+ timestamp: timestamp,
158
+ geometry: geometry,
159
+ measurement_data: measurement_data
160
+ }.freeze
161
+ end
162
+
163
+ private
164
+
165
+ def all_cassettes_generated?
166
+ return @all_cassettes_generated if defined?(@all_cassettes_generated)
167
+ @all_cassettes_generated = GENERATED_CASSETTES.all?{|cassette| File.exist?("#{@vcr_dir}/#{cassette}.yml") }
168
+ end
169
+
170
+ # provide a fresh client with no memoized requests
171
+ def new_client
172
+ JD::Client.new(API_KEY, API_SECRET, environment: :sandbox, access: [ACCESS_TOKEN, ACCESS_SECRET])
173
+ end
174
+
175
+ def url
176
+ return @url if defined?(@url)
177
+ @url = VCR.use_cassette('url'){ new_client.send(:accessor).consumer.site }
178
+ end
179
+
180
+ def catalog
181
+ new_client.get('/')
182
+ end
183
+
184
+ def get_request_token
185
+ @temporary_authorize = JD::Authorize.new(API_KEY, API_SECRET, environment: :sandbox)
186
+ @temporary_authorize_url = @temporary_authorize.authorize_url
187
+ end
188
+
189
+ def get_access_token
190
+ puts "\n\n----\nFOLLOW THIS LINK, AND ENTER THE VERIFICATION CODE:\n#{@temporary_authorize_url}\n----\n\n"
191
+ $stdout.print 'Verification Code: '; $stdout.flush
192
+ code = $stdin.gets.chomp
193
+ puts
194
+
195
+ placeholders[code] = verify_code
196
+
197
+ @temporary_authorize.verify(code)
198
+ end
199
+
200
+ def get_contribution_products
201
+ new_client.get('/contributionProducts?clientControlled=true')
202
+ end
203
+
204
+ def get_organizations
205
+ new_client.organizations.all
206
+ end
207
+
208
+ def get_organization
209
+ new_client.get("/organizations/#{ENV['ORGANIZATION_ID']}")
210
+ end
211
+
212
+ def get_fields
213
+ @temporary_field = find_organization(ENV['ORGANIZATION_ID']).fields.all.first
214
+ end
215
+
216
+ def get_flags
217
+ @temporary_field.flags.all
218
+ end
219
+
220
+ def get_contribution_product
221
+ new_client.get("/contributionProducts/#{ENV['CONTRIBUTION_PRODUCT_ID']}")
222
+ end
223
+
224
+ def post_assets
225
+ @temporary_asset_id = find_organization(ENV['ORGANIZATION_ID']).assets.create(asset_attributes).id
226
+ placeholders[@temporary_asset_id] = asset_id
227
+ end
228
+
229
+ def get_assets
230
+ find_organization(ENV['ORGANIZATION_ID']).assets.all
231
+ end
232
+
233
+ def get_asset
234
+ find_organization(ENV['ORGANIZATION_ID']).assets.find(@temporary_asset_id)
235
+ end
236
+
237
+ def delete_asset
238
+ new_client.delete("/assets/#{@temporary_asset_id}")
239
+ end
240
+
241
+ def post_asset_locations
242
+ find_asset(ENV['ORGANIZATION_ID'], @temporary_asset_id).locations.create(asset_location_attributes)
243
+ end
244
+
245
+ def get_asset_locations
246
+ find_asset(ENV['ORGANIZATION_ID'], @temporary_asset_id).locations.all
247
+ end
248
+
249
+ def configure_vcr
250
+ VCR.configure do |config|
251
+ config.cassette_library_dir = 'test/support/vcr'
252
+ config.hook_into :webmock
253
+ config.default_cassette_options = {record: :once}
254
+ end
255
+ end
256
+
257
+ def sanitize_files
258
+ Dir[File.dirname(__FILE__) + "/vcr/**/*.yml"].each do |filename|
259
+ text = sanitize_text(File.read(filename))
260
+
261
+ data = YAML.load(text)
262
+ sanitize_yaml!(data)
263
+
264
+ File.write(filename, data.to_yaml)
265
+ end
266
+ end
267
+
268
+ def sanitize_text(text)
269
+ data = text
270
+
271
+ placeholders.each do |value, placeholder|
272
+ data.gsub!(value, placeholder)
273
+ end
274
+
275
+ # organization links
276
+ data.gsub!(/\/organizations\/[0-9]+/, "/organizations/#{organization_id}")
277
+
278
+ # random ids
279
+ data.gsub!(/"id":"[0-9]+"/, '"id":"000000"')
280
+
281
+ # uuids
282
+ data.gsub!(/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/, @uuid)
283
+
284
+ # timestamps
285
+ data.gsub!(/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}Z/, timestamp)
286
+ data.gsub!(/1[4567][0-9]{8}/, epoch_timestamp.to_s)
287
+
288
+ # geo coordinates
289
+ data.gsub!(/\[-{0,1}[0-9]{1,3}\.[0-9]{6},-{0,1}[0-9]{1,3}\.[0-9]{6}\]/, coordinates.to_s.gsub(' ', ''))
290
+
291
+ # oauth headers
292
+ data.gsub!(/oauth_nonce="[0-9a-zA-Z]+"/, 'oauth_nonce="000000000000000000000000000000000000000000"')
293
+ data.gsub!(/oauth_signature="[0-9a-zA-Z%]+"/, 'oauth_signature="0000000000000000000000000000"')
294
+ data.gsub!(/oauth_token_secret=[0-9a-zA-Z%]+/, 'oauth_token_secret=000000000000000000000000000000000000000000')
295
+ data.gsub!(/oauth_verifier="[0-9A-Za-z]{6}"/, 'oauth_verifier="VERIFY"')
296
+
297
+ data
298
+ end
299
+
300
+ def sanitize_yaml!(data)
301
+ if data.is_a?(Array)
302
+ data.each { |item| sanitize_yaml!(item) }
303
+ elsif data.is_a?(Hash)
304
+ data.each do |key, value|
305
+ if key == 'string'
306
+ data[key] = sanitize_response_body(value)
307
+ else
308
+ sanitize_yaml!(value)
309
+ end
310
+ end
311
+ end
312
+ end
313
+
314
+ def sanitize_response_body(string)
315
+ data = nil
316
+
317
+ # if this isn't JSON, just return the original string
318
+ begin
319
+ data = JSON.parse(string)
320
+ rescue JSON::ParserError
321
+ return string
322
+ end
323
+
324
+ # various response body attributes
325
+ if data.is_a?(Hash)
326
+ if data['values']
327
+ data['values'].each do |value|
328
+ value = sanitize_value(value)
329
+ end
330
+ elsif data['@type']
331
+ data = sanitize_value(data)
332
+ end
333
+ elsif data.is_a?(Array)
334
+ data.each do |value|
335
+ # nothing yet
336
+ end
337
+ end
338
+
339
+ data.to_json
340
+ end
341
+
342
+ def sanitize_value(value)
343
+ merge_hash = case value['@type']
344
+ when 'Organization'
345
+ {'name' => 'Organization Name'}
346
+ when 'ContributionProduct'
347
+ {
348
+ 'marketPlaceName' => 'Market Place Name',
349
+ 'marketPlaceDescription' => 'Market Place Description'
350
+ }
351
+ when 'ContributedAsset'
352
+ {
353
+ 'title' => 'Asset Title',
354
+ 'assetCategory' => 'DEVICE',
355
+ 'assetType' => 'SENSOR',
356
+ 'assetSubType' => 'ENVIRONMENTAL'
357
+ }
358
+ when 'Field'
359
+ {'name' => 'Field Name'}
360
+ else
361
+ {}
362
+ end
363
+
364
+ value.merge!(merge_hash)
365
+ end
366
+
367
+ def set_contribution_product_id
368
+ unless ENV['CONTRIBUTION_PRODUCT_ID']
369
+ set_env(
370
+ 'CONTRIBUTION_PRODUCT_ID',
371
+ client.get('/contributionProducts?clientControlled=true')['values'].first['id']
372
+ )
373
+ end
374
+
375
+ placeholders[ENV['CONTRIBUTION_PRODUCT_ID']] = contribution_product_id
376
+ end
377
+
378
+ def set_contribution_definition_id
379
+ unless ENV['CONTRIBUTION_DEFINITION_ID']
380
+ set_env(
381
+ 'CONTRIBUTION_DEFINITION_ID',
382
+ client.get("/contributionProducts/#{ENV['CONTRIBUTION_PRODUCT_ID']}/contributionDefinitions")['values'].first['id']
383
+ )
384
+ end
385
+
386
+ placeholders[ENV['CONTRIBUTION_DEFINITION_ID']] = contribution_definition_id
387
+ end
388
+
389
+ def set_organization_id
390
+ unless ENV['ORGANIZATION_ID']
391
+ set_env(
392
+ 'ORGANIZATION_ID',
393
+ client.get("/organizations")['values'].first['id']
394
+ )
395
+ end
396
+
397
+ placeholders[ENV['ORGANIZATION_ID']] = organization_id
398
+ end
399
+
400
+ def set_env(name, value)
401
+ ENV[name] = value
402
+ File.open('.env', 'a') { |f| f.puts "#{name}=#{value}"}
403
+ end
404
+
405
+ def find_organization(id)
406
+ new_client.organizations.detect{|org| org.id == id}
407
+ end
408
+
409
+ def find_asset(org_id, id)
410
+ find_organization(org_id).assets.detect{|asset| asset.id == id}
411
+ end
412
+
413
+ def meets_vcr_requirements?
414
+ puts File.read("#{@vcr_dir}/warning.txt")
415
+ $stdout.print("Do you meet the requirements? [y/N]: "); $stdout.flush
416
+
417
+ answer = $stdin.gets.chomp
418
+ answer.downcase == 'y'
419
+ end
420
+ 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.4
4
+ version: 0.12.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaime Bellmyer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-01-29 00:00:00.000000000 Z
12
+ date: 2020-02-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: vcr
@@ -119,6 +119,7 @@ files:
119
119
  - lib/my_john_deere_api/model/asset.rb
120
120
  - lib/my_john_deere_api/model/asset_location.rb
121
121
  - lib/my_john_deere_api/model/base.rb
122
+ - lib/my_john_deere_api/model/contribution_product.rb
122
123
  - lib/my_john_deere_api/model/field.rb
123
124
  - lib/my_john_deere_api/model/flag.rb
124
125
  - lib/my_john_deere_api/model/organization.rb
@@ -127,6 +128,7 @@ files:
127
128
  - lib/my_john_deere_api/request/collection/asset_locations.rb
128
129
  - lib/my_john_deere_api/request/collection/assets.rb
129
130
  - lib/my_john_deere_api/request/collection/base.rb
131
+ - lib/my_john_deere_api/request/collection/contribution_products.rb
130
132
  - lib/my_john_deere_api/request/collection/fields.rb
131
133
  - lib/my_john_deere_api/request/collection/flags.rb
132
134
  - lib/my_john_deere_api/request/collection/organizations.rb
@@ -137,6 +139,7 @@ files:
137
139
  - lib/my_john_deere_api/request/individual.rb
138
140
  - lib/my_john_deere_api/request/individual/asset.rb
139
141
  - lib/my_john_deere_api/request/individual/base.rb
142
+ - lib/my_john_deere_api/request/individual/contribution_product.rb
140
143
  - lib/my_john_deere_api/version.rb
141
144
  - test/lib/my_john_deere_api/authorize_test.rb
142
145
  - test/lib/my_john_deere_api/client_test.rb
@@ -153,6 +156,7 @@ files:
153
156
  - test/lib/my_john_deere_api/model/asset_location_test.rb
154
157
  - test/lib/my_john_deere_api/model/asset_test.rb
155
158
  - test/lib/my_john_deere_api/model/base_test.rb
159
+ - test/lib/my_john_deere_api/model/contribution_product_test.rb
156
160
  - test/lib/my_john_deere_api/model/field_test.rb
157
161
  - test/lib/my_john_deere_api/model/flag_test.rb
158
162
  - test/lib/my_john_deere_api/model/organization_test.rb
@@ -160,6 +164,7 @@ files:
160
164
  - test/lib/my_john_deere_api/request/collection/asset_locations_test.rb
161
165
  - test/lib/my_john_deere_api/request/collection/assets_test.rb
162
166
  - test/lib/my_john_deere_api/request/collection/base_test.rb
167
+ - test/lib/my_john_deere_api/request/collection/contribution_products_test.rb
163
168
  - test/lib/my_john_deere_api/request/collection/fields_test.rb
164
169
  - test/lib/my_john_deere_api/request/collection/flags_test.rb
165
170
  - test/lib/my_john_deere_api/request/collection/organizations_test.rb
@@ -170,25 +175,30 @@ files:
170
175
  - test/lib/my_john_deere_api/request/create_test.rb
171
176
  - test/lib/my_john_deere_api/request/individual/asset_test.rb
172
177
  - test/lib/my_john_deere_api/request/individual/base_test.rb
178
+ - test/lib/my_john_deere_api/request/individual/contribution_product_test.rb
173
179
  - test/lib/my_john_deere_api/request/individual_test.rb
174
180
  - test/lib/my_john_deere_api/request_test.rb
175
181
  - test/lib/my_john_deere_api/version_test.rb
176
182
  - test/my_john_deere_api_test.rb
177
183
  - test/support/helper.rb
178
- - test/support/vcr/app_consumer.yml
179
184
  - test/support/vcr/catalog.yml
180
185
  - test/support/vcr/delete_asset.yml
181
186
  - test/support/vcr/get_access_token.yml
182
187
  - test/support/vcr/get_asset.yml
183
188
  - test/support/vcr/get_asset_locations.yml
184
189
  - test/support/vcr/get_assets.yml
190
+ - test/support/vcr/get_contribution_product.yml
191
+ - test/support/vcr/get_contribution_products.yml
185
192
  - test/support/vcr/get_fields.yml
186
193
  - test/support/vcr/get_flags.yml
194
+ - test/support/vcr/get_organization.yml
187
195
  - test/support/vcr/get_organizations.yml
188
196
  - test/support/vcr/get_request_token.yml
189
197
  - test/support/vcr/post_asset_locations.yml
190
198
  - test/support/vcr/post_assets.yml
191
- - test/support/vcr/post_flag_categories.yml
199
+ - test/support/vcr/url.yml
200
+ - test/support/vcr/warning.txt
201
+ - test/support/vcr_setup.rb
192
202
  homepage: https://github.com/Intellifarm/my_john_deere_api
193
203
  licenses:
194
204
  - MIT
@@ -1,49 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: https://sandboxapi.deere.com/platform/organizations/444563/flagCategories
6
- body:
7
- encoding: UTF-8
8
- string: '{"@type":"FlagCategory","categoryTitle":"Mountain Dew","sourceNode":"7ba95d7a-f798-46d0-9bf9-c39c31bcf984","links":[{"rel":"contributionDefinition","uri":"https://sandboxapi.deere.com/platform/contributionDefinitions/d93611c7-6f74-474f-9569-2cf88f866a32"}],"preferred":true}'
9
- headers:
10
- Accept:
11
- - application/vnd.deere.axiom.v3+json
12
- Content-Type:
13
- - application/vnd.deere.axiom.v3+json
14
- Accept-Encoding:
15
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
- User-Agent:
17
- - OAuth gem v0.5.4
18
- Content-Length:
19
- - '274'
20
- Authorization:
21
- - OAuth oauth_body_hash="aNgumBwEzeKYfLOtt5eKxESOxZw%3D", oauth_consumer_key="johndeere-wgmADngYCRmfpEbVgSyc709wnyRux5J7PAv8SE7B",
22
- oauth_nonce="wTCf5Hv2r9t83Zfm7DkZaRQleb9TAz5Y1aeVElSU08", oauth_signature="arrFHdesSS315MPGWJWz%2FCYbrLE%3D",
23
- oauth_signature_method="HMAC-SHA1", oauth_timestamp="1579215133", oauth_token="47bbb9c9-41a8-4bec-8127-e3c5760af2f6",
24
- oauth_version="1.0"
25
- response:
26
- status:
27
- code: 409
28
- message: Conflict
29
- headers:
30
- Date:
31
- - Thu, 16 Jan 2020 22:52:13 GMT
32
- X-Deere-Handling-Server:
33
- - ip-10-214-45-154
34
- X-Frame-Options:
35
- - SAMEORIGIN
36
- Location:
37
- - https://sandboxapi.deere.com/platform/flagCategories/b57110f3-0297-461c-81aa-d3b16e111d4d
38
- X-Deere-Elapsed-Ms:
39
- - '420'
40
- Content-Length:
41
- - '0'
42
- Connection:
43
- - close
44
- body:
45
- encoding: UTF-8
46
- string: ''
47
- http_version:
48
- recorded_at: Thu, 16 Jan 2020 22:52:14 GMT
49
- recorded_with: VCR 5.0.0