my_john_deere_api 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +813 -0
- data/Rakefile +9 -0
- data/lib/my_john_deere_api.rb +17 -0
- data/lib/my_john_deere_api/authorize.rb +69 -0
- data/lib/my_john_deere_api/client.rb +151 -0
- data/lib/my_john_deere_api/consumer.rb +90 -0
- data/lib/my_john_deere_api/errors.rb +7 -0
- data/lib/my_john_deere_api/errors/invalid_record_error.rb +29 -0
- data/lib/my_john_deere_api/errors/missing_contribution_definition_id_error.rb +12 -0
- data/lib/my_john_deere_api/errors/not_yet_implemented_error.rb +12 -0
- data/lib/my_john_deere_api/errors/type_mismatch_error.rb +12 -0
- data/lib/my_john_deere_api/errors/unsupported_environment_error.rb +18 -0
- data/lib/my_john_deere_api/helpers.rb +6 -0
- data/lib/my_john_deere_api/helpers/case_conversion.rb +37 -0
- data/lib/my_john_deere_api/helpers/environment_helper.rb +25 -0
- data/lib/my_john_deere_api/helpers/uri_helpers.rb +19 -0
- data/lib/my_john_deere_api/helpers/validate_contribution_definition.rb +18 -0
- data/lib/my_john_deere_api/model.rb +10 -0
- data/lib/my_john_deere_api/model/asset.rb +69 -0
- data/lib/my_john_deere_api/model/asset_location.rb +19 -0
- data/lib/my_john_deere_api/model/base.rb +97 -0
- data/lib/my_john_deere_api/model/contribution_definition.rb +15 -0
- data/lib/my_john_deere_api/model/contribution_product.rb +33 -0
- data/lib/my_john_deere_api/model/field.rb +40 -0
- data/lib/my_john_deere_api/model/flag.rb +36 -0
- data/lib/my_john_deere_api/model/organization.rb +43 -0
- data/lib/my_john_deere_api/net_http_retry.rb +2 -0
- data/lib/my_john_deere_api/net_http_retry/decorator.rb +53 -0
- data/lib/my_john_deere_api/net_http_retry/max_retries_exceeded_error.rb +20 -0
- data/lib/my_john_deere_api/request.rb +6 -0
- data/lib/my_john_deere_api/request/collection.rb +10 -0
- data/lib/my_john_deere_api/request/collection/asset_locations.rb +27 -0
- data/lib/my_john_deere_api/request/collection/assets.rb +34 -0
- data/lib/my_john_deere_api/request/collection/base.rb +91 -0
- data/lib/my_john_deere_api/request/collection/contribution_definitions.rb +26 -0
- data/lib/my_john_deere_api/request/collection/contribution_products.rb +26 -0
- data/lib/my_john_deere_api/request/collection/fields.rb +26 -0
- data/lib/my_john_deere_api/request/collection/flags.rb +33 -0
- data/lib/my_john_deere_api/request/collection/organizations.rb +26 -0
- data/lib/my_john_deere_api/request/create.rb +5 -0
- data/lib/my_john_deere_api/request/create/asset.rb +57 -0
- data/lib/my_john_deere_api/request/create/asset_location.rb +110 -0
- data/lib/my_john_deere_api/request/create/base.rb +67 -0
- data/lib/my_john_deere_api/request/individual.rb +8 -0
- data/lib/my_john_deere_api/request/individual/asset.rb +19 -0
- data/lib/my_john_deere_api/request/individual/base.rb +52 -0
- data/lib/my_john_deere_api/request/individual/contribution_definition.rb +19 -0
- data/lib/my_john_deere_api/request/individual/contribution_product.rb +19 -0
- data/lib/my_john_deere_api/request/individual/field.rb +19 -0
- data/lib/my_john_deere_api/request/individual/organization.rb +19 -0
- data/lib/my_john_deere_api/request/update.rb +4 -0
- data/lib/my_john_deere_api/request/update/asset.rb +40 -0
- data/lib/my_john_deere_api/request/update/base.rb +67 -0
- data/lib/my_john_deere_api/validators.rb +5 -0
- data/lib/my_john_deere_api/validators/asset.rb +35 -0
- data/lib/my_john_deere_api/validators/asset_location.rb +34 -0
- data/lib/my_john_deere_api/validators/base.rb +67 -0
- data/lib/my_john_deere_api/version.rb +3 -0
- data/test/lib/my_john_deere_api/authorize_test.rb +81 -0
- data/test/lib/my_john_deere_api/client_test.rb +225 -0
- data/test/lib/my_john_deere_api/consumer_test.rb +58 -0
- data/test/lib/my_john_deere_api/errors/invalid_record_error_test.rb +26 -0
- data/test/lib/my_john_deere_api/errors/max_retries_exceeded_error_test.rb +13 -0
- data/test/lib/my_john_deere_api/errors/missing_contribution_definition_id_error_test.rb +14 -0
- data/test/lib/my_john_deere_api/errors/not_yet_implemented_error_test.rb +13 -0
- data/test/lib/my_john_deere_api/errors/type_mismatch_error_test.rb +13 -0
- data/test/lib/my_john_deere_api/errors/unsupported_environment_error_test.rb +18 -0
- data/test/lib/my_john_deere_api/errors_test.rb +25 -0
- data/test/lib/my_john_deere_api/helpers/case_conversion_test.rb +100 -0
- data/test/lib/my_john_deere_api/helpers/environment_helper_test.rb +67 -0
- data/test/lib/my_john_deere_api/helpers/uri_helpers_test.rb +58 -0
- data/test/lib/my_john_deere_api/helpers/validate_contribution_definition_test.rb +74 -0
- data/test/lib/my_john_deere_api/helpers_test.rb +21 -0
- data/test/lib/my_john_deere_api/model/asset_location_test.rb +38 -0
- data/test/lib/my_john_deere_api/model/asset_test.rb +133 -0
- data/test/lib/my_john_deere_api/model/base_test.rb +76 -0
- data/test/lib/my_john_deere_api/model/contribution_definition_test.rb +52 -0
- data/test/lib/my_john_deere_api/model/contribution_product_test.rb +82 -0
- data/test/lib/my_john_deere_api/model/field_test.rb +65 -0
- data/test/lib/my_john_deere_api/model/flag_test.rb +48 -0
- data/test/lib/my_john_deere_api/model/organization_test.rb +84 -0
- data/test/lib/my_john_deere_api/model_test.rb +37 -0
- data/test/lib/my_john_deere_api/net_http_retry/decorator_test.rb +163 -0
- data/test/lib/my_john_deere_api/request/collection/asset_locations_test.rb +102 -0
- data/test/lib/my_john_deere_api/request/collection/assets_test.rb +99 -0
- data/test/lib/my_john_deere_api/request/collection/base_test.rb +27 -0
- data/test/lib/my_john_deere_api/request/collection/contribution_definitions_test.rb +88 -0
- data/test/lib/my_john_deere_api/request/collection/contribution_products_test.rb +88 -0
- data/test/lib/my_john_deere_api/request/collection/fields_test.rb +86 -0
- data/test/lib/my_john_deere_api/request/collection/flags_test.rb +92 -0
- data/test/lib/my_john_deere_api/request/collection/organizations_test.rb +87 -0
- data/test/lib/my_john_deere_api/request/collection_test.rb +37 -0
- data/test/lib/my_john_deere_api/request/create/asset_location_test.rb +163 -0
- data/test/lib/my_john_deere_api/request/create/asset_test.rb +182 -0
- data/test/lib/my_john_deere_api/request/create/base_test.rb +29 -0
- data/test/lib/my_john_deere_api/request/create_test.rb +17 -0
- data/test/lib/my_john_deere_api/request/individual/asset_test.rb +33 -0
- data/test/lib/my_john_deere_api/request/individual/base_test.rb +18 -0
- data/test/lib/my_john_deere_api/request/individual/contribution_definition_test.rb +33 -0
- data/test/lib/my_john_deere_api/request/individual/contribution_product_test.rb +33 -0
- data/test/lib/my_john_deere_api/request/individual/field_test.rb +37 -0
- data/test/lib/my_john_deere_api/request/individual/organization_test.rb +33 -0
- data/test/lib/my_john_deere_api/request/individual_test.rb +29 -0
- data/test/lib/my_john_deere_api/request/update/asset_test.rb +99 -0
- data/test/lib/my_john_deere_api/request/update/base_test.rb +60 -0
- data/test/lib/my_john_deere_api/request/update_test.rb +13 -0
- data/test/lib/my_john_deere_api/request_test.rb +21 -0
- data/test/lib/my_john_deere_api/validators/asset_location_test.rb +61 -0
- data/test/lib/my_john_deere_api/validators/asset_test.rb +93 -0
- data/test/lib/my_john_deere_api/validators/base_test.rb +92 -0
- data/test/lib/my_john_deere_api/validators_test.rb +17 -0
- data/test/lib/my_john_deere_api/version_test.rb +9 -0
- data/test/my_john_deere_api_test.rb +37 -0
- data/test/support/helper.rb +97 -0
- data/test/support/vcr/accessor/delete_failed.yml +327 -0
- data/test/support/vcr/accessor/delete_max_failed.yml +615 -0
- data/test/support/vcr/accessor/delete_retry.yml +191 -0
- data/test/support/vcr/accessor/delete_retry_too_soon.yml +191 -0
- data/test/support/vcr/accessor/get_failed.yml +390 -0
- data/test/support/vcr/accessor/get_max_failed.yml +734 -0
- data/test/support/vcr/accessor/get_retry.yml +226 -0
- data/test/support/vcr/accessor/get_retry_too_soon.yml +226 -0
- data/test/support/vcr/accessor/post_failed.yml +417 -0
- data/test/support/vcr/accessor/post_max_failed.yml +785 -0
- data/test/support/vcr/accessor/post_retry.yml +241 -0
- data/test/support/vcr/accessor/post_retry_too_soon.yml +241 -0
- data/test/support/vcr/accessor/put_failed.yml +372 -0
- data/test/support/vcr/accessor/put_max_failed.yml +700 -0
- data/test/support/vcr/accessor/put_retry.yml +216 -0
- data/test/support/vcr/accessor/put_retry_too_soon.yml +216 -0
- data/test/support/vcr/catalog.yml +89 -0
- data/test/support/vcr/delete_asset.yml +82 -0
- data/test/support/vcr/get_access_token.yml +41 -0
- data/test/support/vcr/get_asset.yml +144 -0
- data/test/support/vcr/get_asset_locations.yml +196 -0
- data/test/support/vcr/get_assets.yml +152 -0
- data/test/support/vcr/get_contribution_definition.yml +90 -0
- data/test/support/vcr/get_contribution_definitions.yml +91 -0
- data/test/support/vcr/get_contribution_product.yml +91 -0
- data/test/support/vcr/get_contribution_products.yml +91 -0
- data/test/support/vcr/get_field.yml +144 -0
- data/test/support/vcr/get_fields.yml +146 -0
- data/test/support/vcr/get_flags.yml +47 -0
- data/test/support/vcr/get_organization.yml +90 -0
- data/test/support/vcr/get_organizations.yml +149 -0
- data/test/support/vcr/get_request_token.yml +83 -0
- data/test/support/vcr/post_asset_locations.yml +244 -0
- data/test/support/vcr/post_assets.yml +192 -0
- data/test/support/vcr/put_asset.yml +87 -0
- data/test/support/vcr/warning.txt +28 -0
- data/test/support/vcr_setup.rb +488 -0
- metadata +277 -0
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'support/helper'
|
2
|
+
|
3
|
+
class AssetValidatorTest
|
4
|
+
include JD::Validators::Asset
|
5
|
+
|
6
|
+
attr_reader :attributes
|
7
|
+
|
8
|
+
def initialize(attributes)
|
9
|
+
@attributes = attributes
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'MyJohnDeereApi::Validators::Asset' do
|
14
|
+
let(:klass) { AssetValidatorTest }
|
15
|
+
let(:object) { klass.new(attributes) }
|
16
|
+
let(:attributes) { valid_attributes }
|
17
|
+
|
18
|
+
let(:valid_attributes) do
|
19
|
+
{
|
20
|
+
organization_id: '000000',
|
21
|
+
title: "Bob's Stuff"
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'exists' do
|
26
|
+
assert JD::Validators::Asset
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'inherits from MyJohnDeereApi::Validators::Base' do
|
30
|
+
[:validate!, :valid?].each{ |method_name| assert object.respond_to?(method_name) }
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'requires several attributes' do
|
34
|
+
[:organization_id, :title].each do |attr|
|
35
|
+
object = klass.new(valid_attributes.merge(attr => nil))
|
36
|
+
|
37
|
+
refute object.valid?
|
38
|
+
exception = assert_raises(JD::InvalidRecordError) { object.validate! }
|
39
|
+
|
40
|
+
assert_includes exception.message, "#{attr} is required"
|
41
|
+
assert_includes object.errors[attr], 'is required'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'requires a valid combination of category/type/subtype' do
|
46
|
+
valid_combos = [
|
47
|
+
['DEVICE', 'SENSOR', 'ENVIRONMENTAL'],
|
48
|
+
['DEVICE', 'SENSOR', 'GRAIN_BIN'],
|
49
|
+
['DEVICE', 'SENSOR', 'IRRIGATION_PIVOT'],
|
50
|
+
['DEVICE', 'SENSOR', 'OTHER'],
|
51
|
+
['EQUIPMENT', 'MACHINE', 'PICKUP_TRUCK'],
|
52
|
+
['EQUIPMENT', 'MACHINE', 'UTILITY_VEHICLE'],
|
53
|
+
['EQUIPMENT', 'OTHER', 'ANHYDROUS_AMMONIA_TANK'],
|
54
|
+
['EQUIPMENT', 'OTHER', 'NURSE_TRUCK'],
|
55
|
+
['EQUIPMENT', 'OTHER', 'NURSE_WAGON'],
|
56
|
+
['EQUIPMENT', 'OTHER', 'TECHNICIAN_TRUCK']
|
57
|
+
]
|
58
|
+
|
59
|
+
error_message = 'requires valid combination of category/type/subtype'
|
60
|
+
|
61
|
+
# cycle through all possible permutations, only proving valid if
|
62
|
+
# listed above
|
63
|
+
|
64
|
+
['DEVICE', 'EQUIPMENT', 'RANDOM_INVALID'].each do |category|
|
65
|
+
['MACHINE', 'OTHER', 'SENSOR', 'RANDOM_INVALID'].each do |type|
|
66
|
+
[
|
67
|
+
'ANHYDROUS_AMMONIA_TANK', 'ENVIRONMENTAL', 'GRAIN_BIN',
|
68
|
+
'IRRIGATION_PIVOT', 'NURSE_TRUCK', 'NURSE_WAGON',
|
69
|
+
'OTHER', 'PICKUP_TRUCK', 'TECHNICIAN_TRUCK',
|
70
|
+
'UTILITY_VEHICLE', 'RANDOM_INVALID'
|
71
|
+
].each do |subtype|
|
72
|
+
categories = {
|
73
|
+
asset_category: category,
|
74
|
+
asset_type: type,
|
75
|
+
asset_sub_type: subtype
|
76
|
+
}
|
77
|
+
|
78
|
+
object = klass.new(valid_attributes.merge(categories))
|
79
|
+
|
80
|
+
if valid_combos.include?([category, type, subtype])
|
81
|
+
assert object.valid?
|
82
|
+
else
|
83
|
+
refute object.valid?
|
84
|
+
exception = assert_raises(JD::InvalidRecordError) { object.validate! }
|
85
|
+
|
86
|
+
assert_includes exception.message, "asset_category #{error_message}"
|
87
|
+
assert_includes object.errors[:asset_category], error_message
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'support/helper'
|
2
|
+
|
3
|
+
module BaseValidatorTest
|
4
|
+
class Base
|
5
|
+
include JD::Validators::Base
|
6
|
+
|
7
|
+
attr_reader :attributes
|
8
|
+
|
9
|
+
def initialize(attributes)
|
10
|
+
@attributes = attributes
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class Vanilla < Base
|
15
|
+
end
|
16
|
+
|
17
|
+
class WithRequiredAttributes < Base
|
18
|
+
def required_attributes
|
19
|
+
[:name]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class WithCustomValidations < Base
|
24
|
+
def validate_attributes
|
25
|
+
errors[:name] = 'is not Bob' unless attributes[:name] == 'Bob'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'MyJohnDeereApi::Validators::Base' do
|
31
|
+
let(:klass) { BaseValidatorTest::Vanilla }
|
32
|
+
let(:object) { klass.new(attributes) }
|
33
|
+
let(:valid_attributes) { {name: 'Bob'} }
|
34
|
+
let(:attributes) { valid_attributes }
|
35
|
+
|
36
|
+
it 'exists' do
|
37
|
+
assert klass
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '#validate!' do
|
41
|
+
it 'returns true when valid' do
|
42
|
+
assert object.validate!
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe 'with required attributes' do
|
47
|
+
let(:klass) { BaseValidatorTest::WithRequiredAttributes }
|
48
|
+
|
49
|
+
it 'returns true when valid' do
|
50
|
+
assert object.validate!
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'without required attribute' do
|
54
|
+
let(:attributes) { {} }
|
55
|
+
|
56
|
+
it 'raises an error' do
|
57
|
+
exception = assert_raises(JD::InvalidRecordError) { object.validate! }
|
58
|
+
|
59
|
+
assert_includes exception.message, 'name is required'
|
60
|
+
assert_includes object.errors[:name], 'is required'
|
61
|
+
end
|
62
|
+
|
63
|
+
describe 'with unrequired attributes' do
|
64
|
+
let(:attributes) { valid_attributes.merge(age: 101) }
|
65
|
+
|
66
|
+
it 'returns true' do
|
67
|
+
assert object.validate!
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe 'custom validations' do
|
74
|
+
let(:klass) { BaseValidatorTest::WithCustomValidations }
|
75
|
+
let(:attributes) { valid_attributes.merge(name: 'Bob') }
|
76
|
+
|
77
|
+
it 'returns true when valid' do
|
78
|
+
assert object.validate!
|
79
|
+
end
|
80
|
+
|
81
|
+
describe 'when custom validation fails' do
|
82
|
+
let(:attributes) { valid_attributes.merge(name: 'Turtles') }
|
83
|
+
|
84
|
+
it 'raises an error' do
|
85
|
+
exception = assert_raises(JD::InvalidRecordError) { object.validate! }
|
86
|
+
|
87
|
+
assert_includes exception.message, 'name is not Bob'
|
88
|
+
assert_includes object.errors[:name], 'is not Bob'
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'support/helper'
|
2
|
+
|
3
|
+
describe 'MyJohnDeereApi::Validators' do
|
4
|
+
describe 'loading dependencies' do
|
5
|
+
it 'loads Validators::Base' do
|
6
|
+
assert JD::Validators::Base
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'loads Validators::Asset' do
|
10
|
+
assert JD::Validators::Asset
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'loads Validators::AssetLocation' do
|
14
|
+
assert JD::Validators::AssetLocation
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'support/helper'
|
2
|
+
|
3
|
+
class MyJohnDeereApiTest < MiniTest::Test
|
4
|
+
describe 'loading dependencies' do
|
5
|
+
it 'loads VERSION' do
|
6
|
+
assert JD::VERSION
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'loads Authorize' do
|
10
|
+
assert JD::Authorize
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'loads Client' do
|
14
|
+
assert JD::Client
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'loads Consumer' do
|
18
|
+
assert JD::Consumer
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'loads Request' do
|
22
|
+
assert JD::Request
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'loads Model' do
|
26
|
+
assert JD::Model
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'loads Helpers' do
|
30
|
+
assert JD::Helpers
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'loads Validators' do
|
34
|
+
assert JD::Validators
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'webmock'
|
3
|
+
require 'dotenv/load'
|
4
|
+
require 'minitest/autorun'
|
5
|
+
require 'minitest/reporters'
|
6
|
+
require 'my_john_deere_api'
|
7
|
+
require 'mocha/minitest'
|
8
|
+
|
9
|
+
require 'support/vcr_setup'
|
10
|
+
|
11
|
+
Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(:color => true)]
|
12
|
+
|
13
|
+
# shortcut for long module name
|
14
|
+
JD = MyJohnDeereApi
|
15
|
+
|
16
|
+
TOKEN_PATTERN = /^[0-9a-z\-]+$/
|
17
|
+
SECRET_PATTERN = /^[0-9A-Za-z\-+=\/]+$/
|
18
|
+
|
19
|
+
CONFIG = VcrSetup.new
|
20
|
+
|
21
|
+
class Minitest::Spec
|
22
|
+
class << self
|
23
|
+
def inherits_from klass
|
24
|
+
it "inherits from #{klass}" do
|
25
|
+
public_methods = Hash.new([]).merge({
|
26
|
+
JD::Request::Create::Base => [:request, :object, :valid?, :validate!],
|
27
|
+
JD::Request::Collection::Base => [:each, :all, :count],
|
28
|
+
})
|
29
|
+
|
30
|
+
assert_kind_of klass, object
|
31
|
+
|
32
|
+
public_methods[klass].each do |method_name|
|
33
|
+
assert object.respond_to?(method_name)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Helpers from CONFIG
|
40
|
+
|
41
|
+
def client
|
42
|
+
@_client ||= CONFIG.client
|
43
|
+
end
|
44
|
+
|
45
|
+
def accessor
|
46
|
+
@_accessor ||= VCR.use_cassette('catalog') { client.accessor }
|
47
|
+
end
|
48
|
+
|
49
|
+
def base_url
|
50
|
+
@base_url ||= accessor.consumer.site
|
51
|
+
end
|
52
|
+
|
53
|
+
def api_key
|
54
|
+
CONFIG.api_key
|
55
|
+
end
|
56
|
+
|
57
|
+
def api_secret
|
58
|
+
CONFIG.api_secret
|
59
|
+
end
|
60
|
+
|
61
|
+
def access_token
|
62
|
+
CONFIG.access_token
|
63
|
+
end
|
64
|
+
|
65
|
+
def access_secret
|
66
|
+
CONFIG.access_secret
|
67
|
+
end
|
68
|
+
|
69
|
+
def contribution_product_id
|
70
|
+
CONFIG.contribution_product_id
|
71
|
+
end
|
72
|
+
|
73
|
+
def contribution_definition_id
|
74
|
+
CONFIG.contribution_definition_id
|
75
|
+
end
|
76
|
+
|
77
|
+
def organization_id
|
78
|
+
CONFIG.organization_id
|
79
|
+
end
|
80
|
+
|
81
|
+
def asset_id
|
82
|
+
CONFIG.asset_id
|
83
|
+
end
|
84
|
+
|
85
|
+
def field_id
|
86
|
+
CONFIG.field_id
|
87
|
+
end
|
88
|
+
|
89
|
+
def verify_code
|
90
|
+
CONFIG.verify_code
|
91
|
+
end
|
92
|
+
|
93
|
+
# pre-load the accessor so the info is available in all specs without
|
94
|
+
# a special call to accessor
|
95
|
+
before { accessor }
|
96
|
+
end
|
97
|
+
|
@@ -0,0 +1,327 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: delete
|
5
|
+
uri: https://sandboxapi.deere.com/platform/assets/00000000-0000-0000-0000-000000000000
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/vnd.deere.axiom.v3+json
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
User-Agent:
|
15
|
+
- OAuth gem v0.5.4
|
16
|
+
Authorization:
|
17
|
+
- OAuth oauth_consumer_key="johndeere-0000000000000000000000000000000000000000",
|
18
|
+
oauth_nonce="000000000000000000000000000000000000000000", oauth_signature="0000000000000000000000000000",
|
19
|
+
oauth_signature_method="HMAC-SHA1", oauth_timestamp="1581334172", oauth_token="00000000-0000-0000-0000-000000000000",
|
20
|
+
oauth_version="1.0"
|
21
|
+
response:
|
22
|
+
status:
|
23
|
+
code: 429
|
24
|
+
message: Too Many Requests
|
25
|
+
headers:
|
26
|
+
Date:
|
27
|
+
- Mon, 10 Feb 2020 17:29:36 GMT
|
28
|
+
X-Deere-Handling-Server:
|
29
|
+
- ip-10-214-45-99
|
30
|
+
X-Frame-Options:
|
31
|
+
- SAMEORIGIN
|
32
|
+
X-Deere-Elapsed-Ms:
|
33
|
+
- '96'
|
34
|
+
body:
|
35
|
+
encoding: UTF-8
|
36
|
+
string: ''
|
37
|
+
http_version:
|
38
|
+
recorded_at: Mon, 10 Feb 2020 17:29:36 GMT
|
39
|
+
- request:
|
40
|
+
method: delete
|
41
|
+
uri: https://sandboxapi.deere.com/platform/assets/00000000-0000-0000-0000-000000000000
|
42
|
+
body:
|
43
|
+
encoding: US-ASCII
|
44
|
+
string: ''
|
45
|
+
headers:
|
46
|
+
Accept:
|
47
|
+
- application/vnd.deere.axiom.v3+json
|
48
|
+
Accept-Encoding:
|
49
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
50
|
+
User-Agent:
|
51
|
+
- OAuth gem v0.5.4
|
52
|
+
Authorization:
|
53
|
+
- OAuth oauth_consumer_key="johndeere-0000000000000000000000000000000000000000",
|
54
|
+
oauth_nonce="000000000000000000000000000000000000000000", oauth_signature="0000000000000000000000000000",
|
55
|
+
oauth_signature_method="HMAC-SHA1", oauth_timestamp="1581334172", oauth_token="00000000-0000-0000-0000-000000000000",
|
56
|
+
oauth_version="1.0"
|
57
|
+
response:
|
58
|
+
status:
|
59
|
+
code: 429
|
60
|
+
message: Too Many Requests
|
61
|
+
headers:
|
62
|
+
Date:
|
63
|
+
- Mon, 10 Feb 2020 17:29:36 GMT
|
64
|
+
X-Deere-Handling-Server:
|
65
|
+
- ip-10-214-45-99
|
66
|
+
X-Frame-Options:
|
67
|
+
- SAMEORIGIN
|
68
|
+
X-Deere-Elapsed-Ms:
|
69
|
+
- '96'
|
70
|
+
body:
|
71
|
+
encoding: UTF-8
|
72
|
+
string: ''
|
73
|
+
http_version:
|
74
|
+
recorded_at: Mon, 10 Feb 2020 17:29:36 GMT
|
75
|
+
- request:
|
76
|
+
method: delete
|
77
|
+
uri: https://sandboxapi.deere.com/platform/assets/00000000-0000-0000-0000-000000000000
|
78
|
+
body:
|
79
|
+
encoding: US-ASCII
|
80
|
+
string: ''
|
81
|
+
headers:
|
82
|
+
Accept:
|
83
|
+
- application/vnd.deere.axiom.v3+json
|
84
|
+
Accept-Encoding:
|
85
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
86
|
+
User-Agent:
|
87
|
+
- OAuth gem v0.5.4
|
88
|
+
Authorization:
|
89
|
+
- OAuth oauth_consumer_key="johndeere-0000000000000000000000000000000000000000",
|
90
|
+
oauth_nonce="000000000000000000000000000000000000000000", oauth_signature="0000000000000000000000000000",
|
91
|
+
oauth_signature_method="HMAC-SHA1", oauth_timestamp="1581334172", oauth_token="00000000-0000-0000-0000-000000000000",
|
92
|
+
oauth_version="1.0"
|
93
|
+
response:
|
94
|
+
status:
|
95
|
+
code: 503
|
96
|
+
message: Service Unavailable
|
97
|
+
headers:
|
98
|
+
Date:
|
99
|
+
- Mon, 10 Feb 2020 17:29:36 GMT
|
100
|
+
X-Deere-Handling-Server:
|
101
|
+
- ip-10-214-45-99
|
102
|
+
X-Frame-Options:
|
103
|
+
- SAMEORIGIN
|
104
|
+
X-Deere-Elapsed-Ms:
|
105
|
+
- '96'
|
106
|
+
body:
|
107
|
+
encoding: UTF-8
|
108
|
+
string: ''
|
109
|
+
http_version:
|
110
|
+
recorded_at: Mon, 10 Feb 2020 17:29:36 GMT
|
111
|
+
- request:
|
112
|
+
method: delete
|
113
|
+
uri: https://sandboxapi.deere.com/platform/assets/00000000-0000-0000-0000-000000000000
|
114
|
+
body:
|
115
|
+
encoding: US-ASCII
|
116
|
+
string: ''
|
117
|
+
headers:
|
118
|
+
Accept:
|
119
|
+
- application/vnd.deere.axiom.v3+json
|
120
|
+
Accept-Encoding:
|
121
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
122
|
+
User-Agent:
|
123
|
+
- OAuth gem v0.5.4
|
124
|
+
Authorization:
|
125
|
+
- OAuth oauth_consumer_key="johndeere-0000000000000000000000000000000000000000",
|
126
|
+
oauth_nonce="000000000000000000000000000000000000000000", oauth_signature="0000000000000000000000000000",
|
127
|
+
oauth_signature_method="HMAC-SHA1", oauth_timestamp="1581334172", oauth_token="00000000-0000-0000-0000-000000000000",
|
128
|
+
oauth_version="1.0"
|
129
|
+
response:
|
130
|
+
status:
|
131
|
+
code: 503
|
132
|
+
message: Service Unavailable
|
133
|
+
headers:
|
134
|
+
Date:
|
135
|
+
- Mon, 10 Feb 2020 17:29:36 GMT
|
136
|
+
X-Deere-Handling-Server:
|
137
|
+
- ip-10-214-45-99
|
138
|
+
X-Frame-Options:
|
139
|
+
- SAMEORIGIN
|
140
|
+
X-Deere-Elapsed-Ms:
|
141
|
+
- '96'
|
142
|
+
body:
|
143
|
+
encoding: UTF-8
|
144
|
+
string: ''
|
145
|
+
http_version:
|
146
|
+
recorded_at: Mon, 10 Feb 2020 17:29:36 GMT
|
147
|
+
- request:
|
148
|
+
method: delete
|
149
|
+
uri: https://sandboxapi.deere.com/platform/assets/00000000-0000-0000-0000-000000000000
|
150
|
+
body:
|
151
|
+
encoding: US-ASCII
|
152
|
+
string: ''
|
153
|
+
headers:
|
154
|
+
Accept:
|
155
|
+
- application/vnd.deere.axiom.v3+json
|
156
|
+
Accept-Encoding:
|
157
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
158
|
+
User-Agent:
|
159
|
+
- OAuth gem v0.5.4
|
160
|
+
Authorization:
|
161
|
+
- OAuth oauth_consumer_key="johndeere-0000000000000000000000000000000000000000",
|
162
|
+
oauth_nonce="000000000000000000000000000000000000000000", oauth_signature="0000000000000000000000000000",
|
163
|
+
oauth_signature_method="HMAC-SHA1", oauth_timestamp="1581334172", oauth_token="00000000-0000-0000-0000-000000000000",
|
164
|
+
oauth_version="1.0"
|
165
|
+
response:
|
166
|
+
status:
|
167
|
+
code: 429
|
168
|
+
message: Too Many Requests
|
169
|
+
headers:
|
170
|
+
Date:
|
171
|
+
- Mon, 10 Feb 2020 17:29:36 GMT
|
172
|
+
X-Deere-Handling-Server:
|
173
|
+
- ip-10-214-45-99
|
174
|
+
X-Frame-Options:
|
175
|
+
- SAMEORIGIN
|
176
|
+
X-Deere-Elapsed-Ms:
|
177
|
+
- '96'
|
178
|
+
body:
|
179
|
+
encoding: UTF-8
|
180
|
+
string: ''
|
181
|
+
http_version:
|
182
|
+
recorded_at: Mon, 10 Feb 2020 17:29:36 GMT
|
183
|
+
- request:
|
184
|
+
method: delete
|
185
|
+
uri: https://sandboxapi.deere.com/platform/assets/00000000-0000-0000-0000-000000000000
|
186
|
+
body:
|
187
|
+
encoding: US-ASCII
|
188
|
+
string: ''
|
189
|
+
headers:
|
190
|
+
Accept:
|
191
|
+
- application/vnd.deere.axiom.v3+json
|
192
|
+
Accept-Encoding:
|
193
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
194
|
+
User-Agent:
|
195
|
+
- OAuth gem v0.5.4
|
196
|
+
Authorization:
|
197
|
+
- OAuth oauth_consumer_key="johndeere-0000000000000000000000000000000000000000",
|
198
|
+
oauth_nonce="000000000000000000000000000000000000000000", oauth_signature="0000000000000000000000000000",
|
199
|
+
oauth_signature_method="HMAC-SHA1", oauth_timestamp="1581334172", oauth_token="00000000-0000-0000-0000-000000000000",
|
200
|
+
oauth_version="1.0"
|
201
|
+
response:
|
202
|
+
status:
|
203
|
+
code: 429
|
204
|
+
message: Too Many Requests
|
205
|
+
headers:
|
206
|
+
Date:
|
207
|
+
- Mon, 10 Feb 2020 17:29:36 GMT
|
208
|
+
X-Deere-Handling-Server:
|
209
|
+
- ip-10-214-45-99
|
210
|
+
X-Frame-Options:
|
211
|
+
- SAMEORIGIN
|
212
|
+
X-Deere-Elapsed-Ms:
|
213
|
+
- '96'
|
214
|
+
body:
|
215
|
+
encoding: UTF-8
|
216
|
+
string: ''
|
217
|
+
http_version:
|
218
|
+
recorded_at: Mon, 10 Feb 2020 17:29:36 GMT
|
219
|
+
- request:
|
220
|
+
method: delete
|
221
|
+
uri: https://sandboxapi.deere.com/platform/assets/00000000-0000-0000-0000-000000000000
|
222
|
+
body:
|
223
|
+
encoding: US-ASCII
|
224
|
+
string: ''
|
225
|
+
headers:
|
226
|
+
Accept:
|
227
|
+
- application/vnd.deere.axiom.v3+json
|
228
|
+
Accept-Encoding:
|
229
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
230
|
+
User-Agent:
|
231
|
+
- OAuth gem v0.5.4
|
232
|
+
Authorization:
|
233
|
+
- OAuth oauth_consumer_key="johndeere-0000000000000000000000000000000000000000",
|
234
|
+
oauth_nonce="000000000000000000000000000000000000000000", oauth_signature="0000000000000000000000000000",
|
235
|
+
oauth_signature_method="HMAC-SHA1", oauth_timestamp="1581334172", oauth_token="00000000-0000-0000-0000-000000000000",
|
236
|
+
oauth_version="1.0"
|
237
|
+
response:
|
238
|
+
status:
|
239
|
+
code: 503
|
240
|
+
message: Service Unavailable
|
241
|
+
headers:
|
242
|
+
Date:
|
243
|
+
- Mon, 10 Feb 2020 17:29:36 GMT
|
244
|
+
X-Deere-Handling-Server:
|
245
|
+
- ip-10-214-45-99
|
246
|
+
X-Frame-Options:
|
247
|
+
- SAMEORIGIN
|
248
|
+
X-Deere-Elapsed-Ms:
|
249
|
+
- '96'
|
250
|
+
body:
|
251
|
+
encoding: UTF-8
|
252
|
+
string: ''
|
253
|
+
http_version:
|
254
|
+
recorded_at: Mon, 10 Feb 2020 17:29:36 GMT
|
255
|
+
- request:
|
256
|
+
method: delete
|
257
|
+
uri: https://sandboxapi.deere.com/platform/assets/00000000-0000-0000-0000-000000000000
|
258
|
+
body:
|
259
|
+
encoding: US-ASCII
|
260
|
+
string: ''
|
261
|
+
headers:
|
262
|
+
Accept:
|
263
|
+
- application/vnd.deere.axiom.v3+json
|
264
|
+
Accept-Encoding:
|
265
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
266
|
+
User-Agent:
|
267
|
+
- OAuth gem v0.5.4
|
268
|
+
Authorization:
|
269
|
+
- OAuth oauth_consumer_key="johndeere-0000000000000000000000000000000000000000",
|
270
|
+
oauth_nonce="000000000000000000000000000000000000000000", oauth_signature="0000000000000000000000000000",
|
271
|
+
oauth_signature_method="HMAC-SHA1", oauth_timestamp="1581334172", oauth_token="00000000-0000-0000-0000-000000000000",
|
272
|
+
oauth_version="1.0"
|
273
|
+
response:
|
274
|
+
status:
|
275
|
+
code: 503
|
276
|
+
message: Service Unavailable
|
277
|
+
headers:
|
278
|
+
Date:
|
279
|
+
- Mon, 10 Feb 2020 17:29:36 GMT
|
280
|
+
X-Deere-Handling-Server:
|
281
|
+
- ip-10-214-45-99
|
282
|
+
X-Frame-Options:
|
283
|
+
- SAMEORIGIN
|
284
|
+
X-Deere-Elapsed-Ms:
|
285
|
+
- '96'
|
286
|
+
body:
|
287
|
+
encoding: UTF-8
|
288
|
+
string: ''
|
289
|
+
http_version:
|
290
|
+
recorded_at: Mon, 10 Feb 2020 17:29:36 GMT
|
291
|
+
- request:
|
292
|
+
method: delete
|
293
|
+
uri: https://sandboxapi.deere.com/platform/assets/00000000-0000-0000-0000-000000000000
|
294
|
+
body:
|
295
|
+
encoding: US-ASCII
|
296
|
+
string: ''
|
297
|
+
headers:
|
298
|
+
Accept:
|
299
|
+
- application/vnd.deere.axiom.v3+json
|
300
|
+
Accept-Encoding:
|
301
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
302
|
+
User-Agent:
|
303
|
+
- OAuth gem v0.5.4
|
304
|
+
Authorization:
|
305
|
+
- OAuth oauth_consumer_key="johndeere-0000000000000000000000000000000000000000",
|
306
|
+
oauth_nonce="000000000000000000000000000000000000000000", oauth_signature="0000000000000000000000000000",
|
307
|
+
oauth_signature_method="HMAC-SHA1", oauth_timestamp="1581334172", oauth_token="00000000-0000-0000-0000-000000000000",
|
308
|
+
oauth_version="1.0"
|
309
|
+
response:
|
310
|
+
status:
|
311
|
+
code: 204
|
312
|
+
message: No Content
|
313
|
+
headers:
|
314
|
+
Date:
|
315
|
+
- Mon, 10 Feb 2020 17:29:36 GMT
|
316
|
+
X-Deere-Handling-Server:
|
317
|
+
- ip-10-214-45-99
|
318
|
+
X-Frame-Options:
|
319
|
+
- SAMEORIGIN
|
320
|
+
X-Deere-Elapsed-Ms:
|
321
|
+
- '96'
|
322
|
+
body:
|
323
|
+
encoding: UTF-8
|
324
|
+
string: ''
|
325
|
+
http_version:
|
326
|
+
recorded_at: Mon, 10 Feb 2020 17:29:36 GMT
|
327
|
+
recorded_with: VCR 5.0.0
|