my_john_deere_api 1.1.0 → 1.2.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: 73e95842d21ef2ed1ebf798feb07b69328e1554f42695b60c4caa755da34ee7f
4
- data.tar.gz: 5c438391b2565e2c050abdbbd6b04610f7427141c3d1eb3115a616dfdf649784
3
+ metadata.gz: 1841ed9de4f3726461e96a055c41eafabd02f3dbbcb095517c010e07bd10c5fb
4
+ data.tar.gz: a33dd588075ddf1b2e861ad7e732883a8eb3c06dbb79a9b3dd6de748411285f4
5
5
  SHA512:
6
- metadata.gz: b09a10a8add71b254f67864f04e472cce3c6c72db7805e152f64967e14ae20f36327c686560ab5e7e7d8686860290b2b2b17cd350ce164c2008f47f669e38b97
7
- data.tar.gz: 9e8fadcf86385d040574343441a724d21db5e408381b55045149b459a76e3d8da6c482c4850787564866200a17da63922169e01cb80392cc31c3b7ca750cbadb
6
+ metadata.gz: 0effad463f6fb6fdc658f4669209167be8f117e1a5ea0b798386fa80f3cc875678072b417564560ac7114a5d11550695bdeb0d243e1a416745031e2389cc43e2
7
+ data.tar.gz: 65aaf8a469a137c8a59bdb66ebe18ada13e5bf557f64ec1b25306088e933b30bf7f359e441d59f6feb9d82d48c0a126eb59a1d96a2b95b70b66db85f3145259d
data/README.md CHANGED
@@ -128,10 +128,15 @@ This client is a work in progress. You can currently do the following things wit
128
128
  ```
129
129
  client
130
130
  ├── contribution_products
131
- ├── count
132
- ├── all
133
- ├── first
134
- └── find(contribution_product_id)
131
+ | ├── count
132
+ | ├── all
133
+ | ├── first
134
+ | └── find(contribution_product_id)
135
+ | └── contribution_definitions
136
+ | ├── count
137
+ | ├── all
138
+ | ├── first
139
+ | └── find(contribution_definition_id)
135
140
  └── organizations
136
141
  ├── count
137
142
  ├── all
@@ -1,9 +1,10 @@
1
1
  module MyJohnDeereApi::Model
2
- autoload :Base, 'my_john_deere_api/model/base'
3
- autoload :Asset, 'my_john_deere_api/model/asset'
4
- autoload :AssetLocation, 'my_john_deere_api/model/asset_location'
5
- autoload :ContributionProduct, 'my_john_deere_api/model/contribution_product'
6
- autoload :Organization, 'my_john_deere_api/model/organization'
7
- autoload :Field, 'my_john_deere_api/model/field'
8
- autoload :Flag, 'my_john_deere_api/model/flag'
2
+ autoload :Base, 'my_john_deere_api/model/base'
3
+ autoload :Asset, 'my_john_deere_api/model/asset'
4
+ autoload :AssetLocation, 'my_john_deere_api/model/asset_location'
5
+ autoload :ContributionProduct, 'my_john_deere_api/model/contribution_product'
6
+ autoload :ContributionDefinition, 'my_john_deere_api/model/contribution_definition'
7
+ autoload :Organization, 'my_john_deere_api/model/organization'
8
+ autoload :Field, 'my_john_deere_api/model/field'
9
+ autoload :Flag, 'my_john_deere_api/model/flag'
9
10
  end
@@ -0,0 +1,15 @@
1
+ module MyJohnDeereApi
2
+ class Model::ContributionDefinition < Model::Base
3
+ attr_reader :name
4
+
5
+ private
6
+
7
+ def map_attributes(record)
8
+ @name = record['name']
9
+ end
10
+
11
+ def expected_record_type
12
+ 'ContributionDefinition'
13
+ end
14
+ end
15
+ end
@@ -4,6 +4,15 @@ module MyJohnDeereApi
4
4
  :current_status, :activation_callback, :preview_images,
5
5
  :supported_regions, :supported_operation_centers
6
6
 
7
+
8
+ ##
9
+ # contribution definitions associated with this contribution product
10
+
11
+ def contribution_definitions
12
+ return @contribution_definitions if defined?(@contribution_definitions)
13
+ @contribution_definitions = Request::Collection::ContributionDefinitions.new(accessor, contribution_product: id)
14
+ end
15
+
7
16
  private
8
17
 
9
18
  def map_attributes(record)
@@ -1,9 +1,10 @@
1
1
  module MyJohnDeereApi::Request::Collection
2
- autoload :Base, 'my_john_deere_api/request/collection/base'
3
- autoload :Assets, 'my_john_deere_api/request/collection/assets'
4
- autoload :AssetLocations, 'my_john_deere_api/request/collection/asset_locations'
5
- autoload :ContributionProducts, 'my_john_deere_api/request/collection/contribution_products'
6
- autoload :Organizations, 'my_john_deere_api/request/collection/organizations'
7
- autoload :Fields, 'my_john_deere_api/request/collection/fields'
8
- autoload :Flags, 'my_john_deere_api/request/collection/flags'
2
+ autoload :Base, 'my_john_deere_api/request/collection/base'
3
+ autoload :Assets, 'my_john_deere_api/request/collection/assets'
4
+ autoload :AssetLocations, 'my_john_deere_api/request/collection/asset_locations'
5
+ autoload :ContributionProducts, 'my_john_deere_api/request/collection/contribution_products'
6
+ autoload :ContributionDefinitions, 'my_john_deere_api/request/collection/contribution_definitions'
7
+ autoload :Organizations, 'my_john_deere_api/request/collection/organizations'
8
+ autoload :Fields, 'my_john_deere_api/request/collection/fields'
9
+ autoload :Flags, 'my_john_deere_api/request/collection/flags'
9
10
  end
@@ -0,0 +1,26 @@
1
+ require 'json'
2
+
3
+ module MyJohnDeereApi::Request
4
+ class Collection::ContributionDefinitions < Collection::Base
5
+ ##
6
+ # The resource path for the first page in the collection
7
+
8
+ def resource
9
+ "/contributionProducts/#{associations[:contribution_product]}/contributionDefinitions"
10
+ end
11
+
12
+ ##
13
+ # This is the class used to model the data
14
+
15
+ def model
16
+ MyJohnDeereApi::Model::ContributionDefinition
17
+ end
18
+
19
+ ##
20
+ # Retrieve an item from JD
21
+
22
+ def find(item_id)
23
+ Individual::ContributionDefinition.new(accessor, item_id).object
24
+ end
25
+ end
26
+ end
@@ -1,7 +1,8 @@
1
1
  module MyJohnDeereApi::Request::Individual
2
- autoload :Base, 'my_john_deere_api/request/individual/base'
3
- autoload :Asset, 'my_john_deere_api/request/individual/asset'
4
- autoload :ContributionProduct, 'my_john_deere_api/request/individual/contribution_product'
5
- autoload :Field, 'my_john_deere_api/request/individual/field'
6
- autoload :Organization, 'my_john_deere_api/request/individual/organization'
2
+ autoload :Base, 'my_john_deere_api/request/individual/base'
3
+ autoload :Asset, 'my_john_deere_api/request/individual/asset'
4
+ autoload :ContributionProduct, 'my_john_deere_api/request/individual/contribution_product'
5
+ autoload :ContributionDefinition, 'my_john_deere_api/request/individual/contribution_definition'
6
+ autoload :Field, 'my_john_deere_api/request/individual/field'
7
+ autoload :Organization, 'my_john_deere_api/request/individual/organization'
7
8
  end
@@ -0,0 +1,19 @@
1
+ require 'json'
2
+
3
+ module MyJohnDeereApi::Request
4
+ class Individual::ContributionDefinition < Individual::Base
5
+ ##
6
+ # The resource path for the first page in the collection
7
+
8
+ def resource
9
+ "/contributionDefinitions/#{id}"
10
+ end
11
+
12
+ ##
13
+ # This is the class used to model the data
14
+
15
+ def model
16
+ MyJohnDeereApi::Model::ContributionDefinition
17
+ end
18
+ end
19
+ end
@@ -1,3 +1,3 @@
1
1
  module MyJohnDeereApi
2
- VERSION='1.1.0'
2
+ VERSION='1.2.0'
3
3
  end
@@ -0,0 +1,56 @@
1
+ require 'support/helper'
2
+
3
+ describe 'MyJohnDeereApi::Model::ContributionDefinition' do
4
+ let(:klass) { JD::Model::ContributionDefinition }
5
+
6
+ let(:record) do
7
+ {
8
+ "@type" => "ContributionDefinition",
9
+ "name" => "Definition Name",
10
+ "actionDefinitions" => [],
11
+ "id" => "00000000-0000-0000-0000-000000000000",
12
+ "links" => [
13
+ {
14
+ "@type" => "Link",
15
+ "rel" => "self",
16
+ "uri" => "https://sandboxapi.deere.com/platform/contributionDefinitions/00000000-0000-0000-0000-000000000000"
17
+ },
18
+ {
19
+ "@type" => "Link",
20
+ "rel" => "contributionProduct",
21
+ "uri" => "https://sandboxapi.deere.com/platform/contributionProducts/00000000-0000-0000-0000-000000000000"
22
+ }
23
+ ]
24
+ }
25
+ end
26
+
27
+ describe '#initialize' do
28
+ def link_for label
29
+ camel_label = label.gsub(/_(.)/){|m| m[1].upcase}
30
+ record['links'].detect{|link| link['rel'] == camel_label}['uri'].gsub('https://sandboxapi.deere.com/platform', '')
31
+ end
32
+
33
+ it 'sets the attributes from the given record' do
34
+ definition = klass.new(record)
35
+
36
+ # basic attributes
37
+ assert_equal record['id'], definition.id
38
+ assert_equal record['name'], definition.name
39
+ end
40
+
41
+ it 'links to other things' do
42
+ product = klass.new(record)
43
+
44
+ ['self', 'contribution_product'].each do |association|
45
+ assert_equal link_for(association), product.links[association]
46
+ end
47
+ end
48
+
49
+ it 'accepts an optional accessor' do
50
+ mock_accessor = 'mock-accessor'
51
+
52
+ asset = klass.new(record, mock_accessor)
53
+ assert_equal mock_accessor, asset.accessor
54
+ end
55
+ end
56
+ end
@@ -65,4 +65,20 @@ describe 'MyJohnDeereApi::Model::ContributionProduct' do
65
65
  assert_equal mock_accessor, asset.accessor
66
66
  end
67
67
  end
68
+
69
+ describe '#contribution_definitions' do
70
+ it 'returns a collection of contribution definitions for this contributon product' do
71
+ product = JD::Model::ContributionProduct.new(record, accessor)
72
+
73
+ contribution_definitions = VCR.use_cassette('get_contribution_definitions') do
74
+ product.contribution_definitions.all; product.contribution_definitions
75
+ end
76
+
77
+ assert_kind_of JD::Request::Collection::ContributionDefinitions, contribution_definitions
78
+
79
+ contribution_definitions.each do |contribution_definition|
80
+ assert_kind_of JD::Model::ContributionDefinition, contribution_definition
81
+ end
82
+ end
83
+ end
68
84
  end
@@ -18,6 +18,10 @@ describe 'MyJohnDeereApi::Model' do
18
18
  assert JD::Model::ContributionProduct
19
19
  end
20
20
 
21
+ it 'loads Model::ContributionDefinition' do
22
+ assert JD::Model::ContributionDefinition
23
+ end
24
+
21
25
  it 'loads Model::Organization' do
22
26
  assert JD::Model::Organization
23
27
  end
@@ -0,0 +1,88 @@
1
+ require 'support/helper'
2
+ require 'yaml'
3
+ require 'json'
4
+
5
+ describe 'MyJohnDeereApi::Request::Collection::ContributionDefinitions' do
6
+ let(:klass) { MyJohnDeereApi::Request::Collection::ContributionDefinitions }
7
+
8
+ let(:collection) { klass.new(accessor, contribution_product: contribution_product_id) }
9
+ let(:object) { collection }
10
+
11
+ inherits_from JD::Request::Collection::Base
12
+
13
+ describe '#initialize(access_token)' do
14
+ it 'accepts an access token' do
15
+ assert_kind_of OAuth::AccessToken, collection.accessor
16
+ end
17
+
18
+ it 'accepts associations' do
19
+ collection = klass.new(accessor, something: 123)
20
+
21
+ assert_kind_of Hash, collection.associations
22
+ assert_equal 123, collection.associations[:something]
23
+ end
24
+ end
25
+
26
+ describe '#resource' do
27
+ it 'returns /contributionProducts/<contribution_product_id>/contributionDefinitions' do
28
+ assert_equal "/contributionProducts/#{contribution_product_id}/contributionDefinitions", collection.resource
29
+ end
30
+ end
31
+
32
+ describe '#all' do
33
+ it 'returns all records' do
34
+ all = VCR.use_cassette('get_contribution_definitions') { collection.all }
35
+
36
+ assert_kind_of Array, all
37
+ assert_equal collection.count, all.size
38
+
39
+ all.each do |item|
40
+ assert_kind_of JD::Model::ContributionDefinition, item
41
+ end
42
+ end
43
+ end
44
+
45
+ describe '#count' do
46
+ let(:server_response) do
47
+ contents = File.read('test/support/vcr/get_contribution_definitions.yml')
48
+ body = YAML.load(contents)['http_interactions'].last['response']['body']['string']
49
+ JSON.parse(body)
50
+ end
51
+
52
+ let(:server_count) { server_response['total'] }
53
+
54
+ it 'returns the total count of records in the collection' do
55
+ count = VCR.use_cassette('get_contribution_definitions') { collection.count }
56
+
57
+ assert_equal server_count, count
58
+ end
59
+ end
60
+
61
+ describe 'results' do
62
+ let(:definition_names) do
63
+ contents = File.read('test/support/vcr/get_contribution_definitions.yml')
64
+ body = YAML.load(contents)['http_interactions'].last['response']['body']['string']
65
+
66
+ JSON.parse(body)['values'].map{|v| v['name']}
67
+ end
68
+
69
+ it 'returns all records as a single enumerator' do
70
+ count = VCR.use_cassette('get_contribution_definitions') { collection.count }
71
+ names = VCR.use_cassette('get_contribution_definitions') { collection.map(&:name) }
72
+
73
+ assert_kind_of Array, names
74
+ assert_equal count, names.size
75
+
76
+ definition_names.each do |expected_name|
77
+ assert_includes names, expected_name
78
+ end
79
+ end
80
+ end
81
+
82
+ describe '#find(contribution_definition_id)' do
83
+ it 'retrieves the asset' do
84
+ definition = VCR.use_cassette('get_contribution_definition') { collection.find(contribution_definition_id) }
85
+ assert_kind_of JD::Model::ContributionDefinition, definition
86
+ end
87
+ end
88
+ end
@@ -5,7 +5,7 @@ require 'json'
5
5
  describe 'MyJohnDeereApi::Request::Collection::ContributionProducts' do
6
6
  let(:klass) { MyJohnDeereApi::Request::Collection::ContributionProducts }
7
7
 
8
- let(:collection) { klass.new(accessor, organization: organization_id) }
8
+ let(:collection) { klass.new(accessor) }
9
9
  let(:object) { collection }
10
10
 
11
11
  inherits_from JD::Request::Collection::Base
@@ -16,10 +16,10 @@ describe 'MyJohnDeereApi::Request::Collection::ContributionProducts' do
16
16
  end
17
17
 
18
18
  it 'accepts associations' do
19
- collection = klass.new(accessor, organization: organization_id)
19
+ collection = klass.new(accessor, something: 123)
20
20
 
21
21
  assert_kind_of Hash, collection.associations
22
- assert_equal organization_id, collection.associations[:organization]
22
+ assert_equal 123, collection.associations[:something]
23
23
  end
24
24
  end
25
25
 
@@ -18,6 +18,10 @@ describe 'MyJohnDeereApi::Request::Collection' do
18
18
  assert JD::Request::Collection::ContributionProducts
19
19
  end
20
20
 
21
+ it 'loads Request::Collection::ContributionDefinitions' do
22
+ assert JD::Request::Collection::ContributionDefinitions
23
+ end
24
+
21
25
  it 'loads Request::Collection::Organizations' do
22
26
  assert JD::Request::Collection::Organizations
23
27
  end
@@ -0,0 +1,32 @@
1
+ require 'support/helper'
2
+ require 'yaml'
3
+ require 'json'
4
+
5
+ describe 'MyJohnDeereApi::Request::Individual::ContributionDefinition' do
6
+ let(:object) { JD::Request::Individual::ContributionDefinition.new(accessor, contribution_definition_id) }
7
+
8
+ inherits_from JD::Request::Individual::Base
9
+
10
+ describe '#initialize(access_token, contribution_definition_id)' do
11
+ it 'accepts an access token' do
12
+ assert_equal accessor, object.accessor
13
+ end
14
+
15
+ it 'accepts contribution_definition_id as id' do
16
+ assert_equal contribution_definition_id, object.id
17
+ end
18
+ end
19
+
20
+ describe '#resource' do
21
+ it 'returns /contributionDefinitions/<definition_id>' do
22
+ assert_equal "/contributionDefinitions/#{contribution_definition_id}", object.resource
23
+ end
24
+ end
25
+
26
+ describe '#object' do
27
+ it 'returns all records' do
28
+ definition = VCR.use_cassette('get_contribution_definition') { object.object }
29
+ assert_kind_of JD::Model::ContributionDefinition, definition
30
+ end
31
+ end
32
+ end
@@ -7,7 +7,7 @@ describe 'MyJohnDeereApi::Request::Individual::ContributionProduct' do
7
7
 
8
8
  inherits_from JD::Request::Individual::Base
9
9
 
10
- describe '#initialize(access_token, asset_id)' do
10
+ describe '#initialize(access_token, contribution_product_id)' do
11
11
  it 'accepts an access token' do
12
12
  assert_equal accessor, object.accessor
13
13
  end
@@ -14,6 +14,10 @@ describe 'MyJohnDeereApi::Request::Individual' do
14
14
  assert JD::Request::Individual::ContributionProduct
15
15
  end
16
16
 
17
+ it 'loads Request::Individual::ContributionDefinition' do
18
+ assert JD::Request::Individual::ContributionDefinition
19
+ end
20
+
17
21
  it 'loads Request::Individual::Field' do
18
22
  assert JD::Request::Individual::Field
19
23
  end
@@ -0,0 +1,90 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://sandboxapi.deere.com/platform/
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="1581028214", oauth_version="1.0"
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Date:
26
+ - Fri, 07 Feb 2020 21:29:20 GMT
27
+ Content-Type:
28
+ - application/vnd.deere.axiom.v3+json;charset=UTF-8
29
+ X-Deere-Handling-Server:
30
+ - ip-10-214-45-79
31
+ X-Frame-Options:
32
+ - SAMEORIGIN
33
+ X-Deere-Elapsed-Ms:
34
+ - '15'
35
+ Cache-Control:
36
+ - no-store
37
+ Content-Language:
38
+ - en-US
39
+ Transfer-Encoding:
40
+ - chunked
41
+ body:
42
+ encoding: ASCII-8BIT
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
+ http_version:
45
+ recorded_at: Fri, 07 Feb 2020 21:29:20 GMT
46
+ - request:
47
+ method: get
48
+ uri: https://sandboxapi.deere.com/platform/contributionDefinitions/00000000-0000-0000-0000-000000000000
49
+ body:
50
+ encoding: US-ASCII
51
+ string: ''
52
+ headers:
53
+ Accept:
54
+ - application/vnd.deere.axiom.v3+json
55
+ Accept-Encoding:
56
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
57
+ User-Agent:
58
+ - OAuth gem v0.5.4
59
+ Authorization:
60
+ - OAuth oauth_consumer_key="johndeere-0000000000000000000000000000000000000000",
61
+ oauth_nonce="000000000000000000000000000000000000000000", oauth_signature="0000000000000000000000000000",
62
+ oauth_signature_method="HMAC-SHA1", oauth_timestamp="1581028214", oauth_token="00000000-0000-0000-0000-000000000000",
63
+ oauth_version="1.0"
64
+ response:
65
+ status:
66
+ code: 200
67
+ message: OK
68
+ headers:
69
+ Date:
70
+ - Fri, 07 Feb 2020 21:29:21 GMT
71
+ Content-Type:
72
+ - application/vnd.deere.axiom.v3+json;charset=UTF-8
73
+ X-Deere-Handling-Server:
74
+ - ip-10-214-45-140
75
+ X-Frame-Options:
76
+ - SAMEORIGIN
77
+ X-Deere-Elapsed-Ms:
78
+ - '25'
79
+ Cache-Control:
80
+ - no-store
81
+ Content-Language:
82
+ - en-US
83
+ Transfer-Encoding:
84
+ - chunked
85
+ body:
86
+ encoding: ASCII-8BIT
87
+ string: '{"@type":"ContributionDefinition","name":"Definition Name","actionDefinitions":[],"id":"00000000-0000-0000-0000-000000000000","links":[{"@type":"Link","rel":"self","uri":"https://sandboxapi.deere.com/platform/contributionDefinitions/00000000-0000-0000-0000-000000000000"},{"@type":"Link","rel":"contributionProduct","uri":"https://sandboxapi.deere.com/platform/contributionProducts/00000000-0000-0000-0000-000000000000"}]}'
88
+ http_version:
89
+ recorded_at: Fri, 07 Feb 2020 21:29:21 GMT
90
+ recorded_with: VCR 5.0.0
@@ -0,0 +1,91 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://sandboxapi.deere.com/platform/
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="1581028214", oauth_version="1.0"
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Date:
26
+ - Fri, 07 Feb 2020 21:29:19 GMT
27
+ Content-Type:
28
+ - application/vnd.deere.axiom.v3+json;charset=UTF-8
29
+ X-Deere-Handling-Server:
30
+ - ip-10-214-45-140
31
+ X-Frame-Options:
32
+ - SAMEORIGIN
33
+ X-Deere-Elapsed-Ms:
34
+ - '14'
35
+ Cache-Control:
36
+ - no-store
37
+ Content-Language:
38
+ - en-US
39
+ Transfer-Encoding:
40
+ - chunked
41
+ body:
42
+ encoding: ASCII-8BIT
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
+ http_version:
45
+ recorded_at: Fri, 07 Feb 2020 21:29:19 GMT
46
+ - request:
47
+ method: get
48
+ uri: https://sandboxapi.deere.com/platform/contributionProducts/00000000-0000-0000-0000-000000000000/contributionDefinitions
49
+ body:
50
+ encoding: US-ASCII
51
+ string: ''
52
+ headers:
53
+ Accept:
54
+ - application/vnd.deere.axiom.v3+json
55
+ Accept-Encoding:
56
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
57
+ User-Agent:
58
+ - OAuth gem v0.5.4
59
+ Authorization:
60
+ - OAuth oauth_consumer_key="johndeere-0000000000000000000000000000000000000000",
61
+ oauth_nonce="000000000000000000000000000000000000000000", oauth_signature="0000000000000000000000000000",
62
+ oauth_signature_method="HMAC-SHA1", oauth_timestamp="1581028214", oauth_token="00000000-0000-0000-0000-000000000000",
63
+ oauth_version="1.0"
64
+ response:
65
+ status:
66
+ code: 200
67
+ message: OK
68
+ headers:
69
+ Date:
70
+ - Fri, 07 Feb 2020 21:29:20 GMT
71
+ Content-Type:
72
+ - application/vnd.deere.axiom.v3+json;charset=UTF-8
73
+ X-Deere-Handling-Server:
74
+ - ip-10-214-45-86
75
+ X-Frame-Options:
76
+ - SAMEORIGIN
77
+ X-Deere-Elapsed-Ms:
78
+ - '32'
79
+ Cache-Control:
80
+ - no-store
81
+ Content-Language:
82
+ - en-US
83
+ Transfer-Encoding:
84
+ - chunked
85
+ body:
86
+ encoding: ASCII-8BIT
87
+ string: '{"links":[{"rel":"self","uri":"https://sandboxapi.deere.com/platform/contributionProducts/00000000-0000-0000-0000-000000000000/contributionDefinitions"}],"total":1,"values":[{"@type":"ContributionDefinition","name":"Definition
88
+ Name","actionDefinitions":[],"id":"00000000-0000-0000-0000-000000000000","links":[{"@type":"Link","rel":"self","uri":"https://sandboxapi.deere.com/platform/contributionDefinitions/00000000-0000-0000-0000-000000000000"},{"@type":"Link","rel":"contributionProduct","uri":"https://sandboxapi.deere.com/platform/contributionProducts/00000000-0000-0000-0000-000000000000"}]}]}'
89
+ http_version:
90
+ recorded_at: Fri, 07 Feb 2020 21:29:20 GMT
91
+ recorded_with: VCR 5.0.0
@@ -19,6 +19,7 @@ class VcrSetup
19
19
  GENERATED_CASSETTES = [
20
20
  :catalog, :get_request_token, :get_access_token,
21
21
  :get_contribution_products, :get_contribution_product,
22
+ :get_contribution_definitions, :get_contribution_definition,
22
23
  :get_organizations, :get_organization,
23
24
  :get_fields, :get_field, :get_flags,
24
25
  :post_assets, :get_assets, :get_asset, :put_asset,
@@ -198,6 +199,14 @@ class VcrSetup
198
199
  new_client.get("/contributionProducts/#{ENV['CONTRIBUTION_PRODUCT_ID']}")
199
200
  end
200
201
 
202
+ def get_contribution_definitions
203
+ new_client.get("/contributionProducts/#{ENV['CONTRIBUTION_PRODUCT_ID']}/contributionDefinitions")
204
+ end
205
+
206
+ def get_contribution_definition
207
+ new_client.get("/contributionDefinitions/#{ENV['CONTRIBUTION_DEFINITION_ID']}")
208
+ end
209
+
201
210
  def get_organizations
202
211
  new_client.organizations.all
203
212
  end
@@ -355,6 +364,8 @@ class VcrSetup
355
364
  'marketPlaceName' => 'Market Place Name',
356
365
  'marketPlaceDescription' => 'Market Place Description'
357
366
  }
367
+ when 'ContributionDefinition'
368
+ {'name' => 'Definition Name'}
358
369
  when 'ContributedAsset'
359
370
  {
360
371
  'title' => 'Asset Title',
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.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaime Bellmyer
@@ -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_definition.rb
122
123
  - lib/my_john_deere_api/model/contribution_product.rb
123
124
  - lib/my_john_deere_api/model/field.rb
124
125
  - lib/my_john_deere_api/model/flag.rb
@@ -128,6 +129,7 @@ files:
128
129
  - lib/my_john_deere_api/request/collection/asset_locations.rb
129
130
  - lib/my_john_deere_api/request/collection/assets.rb
130
131
  - lib/my_john_deere_api/request/collection/base.rb
132
+ - lib/my_john_deere_api/request/collection/contribution_definitions.rb
131
133
  - lib/my_john_deere_api/request/collection/contribution_products.rb
132
134
  - lib/my_john_deere_api/request/collection/fields.rb
133
135
  - lib/my_john_deere_api/request/collection/flags.rb
@@ -139,6 +141,7 @@ files:
139
141
  - lib/my_john_deere_api/request/individual.rb
140
142
  - lib/my_john_deere_api/request/individual/asset.rb
141
143
  - lib/my_john_deere_api/request/individual/base.rb
144
+ - lib/my_john_deere_api/request/individual/contribution_definition.rb
142
145
  - lib/my_john_deere_api/request/individual/contribution_product.rb
143
146
  - lib/my_john_deere_api/request/individual/field.rb
144
147
  - lib/my_john_deere_api/request/individual/organization.rb
@@ -158,6 +161,7 @@ files:
158
161
  - test/lib/my_john_deere_api/model/asset_location_test.rb
159
162
  - test/lib/my_john_deere_api/model/asset_test.rb
160
163
  - test/lib/my_john_deere_api/model/base_test.rb
164
+ - test/lib/my_john_deere_api/model/contribution_definition_test.rb
161
165
  - test/lib/my_john_deere_api/model/contribution_product_test.rb
162
166
  - test/lib/my_john_deere_api/model/field_test.rb
163
167
  - test/lib/my_john_deere_api/model/flag_test.rb
@@ -166,6 +170,7 @@ files:
166
170
  - test/lib/my_john_deere_api/request/collection/asset_locations_test.rb
167
171
  - test/lib/my_john_deere_api/request/collection/assets_test.rb
168
172
  - test/lib/my_john_deere_api/request/collection/base_test.rb
173
+ - test/lib/my_john_deere_api/request/collection/contribution_definitions_test.rb
169
174
  - test/lib/my_john_deere_api/request/collection/contribution_products_test.rb
170
175
  - test/lib/my_john_deere_api/request/collection/fields_test.rb
171
176
  - test/lib/my_john_deere_api/request/collection/flags_test.rb
@@ -177,6 +182,7 @@ files:
177
182
  - test/lib/my_john_deere_api/request/create_test.rb
178
183
  - test/lib/my_john_deere_api/request/individual/asset_test.rb
179
184
  - test/lib/my_john_deere_api/request/individual/base_test.rb
185
+ - test/lib/my_john_deere_api/request/individual/contribution_definition_test.rb
180
186
  - test/lib/my_john_deere_api/request/individual/contribution_product_test.rb
181
187
  - test/lib/my_john_deere_api/request/individual/field_test.rb
182
188
  - test/lib/my_john_deere_api/request/individual/organization_test.rb
@@ -191,6 +197,8 @@ files:
191
197
  - test/support/vcr/get_asset.yml
192
198
  - test/support/vcr/get_asset_locations.yml
193
199
  - test/support/vcr/get_assets.yml
200
+ - test/support/vcr/get_contribution_definition.yml
201
+ - test/support/vcr/get_contribution_definitions.yml
194
202
  - test/support/vcr/get_contribution_product.yml
195
203
  - test/support/vcr/get_contribution_products.yml
196
204
  - test/support/vcr/get_field.yml