my_john_deere_api 1.3.6 → 1.3.7
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 +4 -4
- data/lib/my_john_deere_api/client.rb +11 -11
- data/lib/my_john_deere_api/model/asset.rb +1 -1
- data/lib/my_john_deere_api/model/base.rb +15 -6
- data/lib/my_john_deere_api/model/contribution_product.rb +1 -1
- data/lib/my_john_deere_api/model/field.rb +1 -1
- data/lib/my_john_deere_api/model/organization.rb +2 -2
- data/lib/my_john_deere_api/request/collection/asset_locations.rb +1 -1
- data/lib/my_john_deere_api/request/collection/assets.rb +2 -2
- data/lib/my_john_deere_api/request/collection/base.rb +16 -8
- data/lib/my_john_deere_api/request/collection/contribution_definitions.rb +1 -1
- data/lib/my_john_deere_api/request/collection/contribution_products.rb +1 -1
- data/lib/my_john_deere_api/request/collection/fields.rb +1 -1
- data/lib/my_john_deere_api/request/collection/organizations.rb +1 -1
- data/lib/my_john_deere_api/request/create/base.rb +12 -4
- data/lib/my_john_deere_api/request/individual/base.rb +13 -5
- data/lib/my_john_deere_api/request/update/base.rb +11 -3
- data/lib/my_john_deere_api/version.rb +1 -1
- data/test/lib/my_john_deere_api/client_test.rb +0 -3
- data/test/lib/my_john_deere_api/model/asset_location_test.rb +6 -6
- data/test/lib/my_john_deere_api/model/asset_test.rb +8 -9
- data/test/lib/my_john_deere_api/model/base_test.rb +8 -7
- data/test/lib/my_john_deere_api/model/contribution_definition_test.rb +3 -5
- data/test/lib/my_john_deere_api/model/contribution_product_test.rb +8 -8
- data/test/lib/my_john_deere_api/model/field_test.rb +8 -9
- data/test/lib/my_john_deere_api/model/flag_test.rb +6 -6
- data/test/lib/my_john_deere_api/model/organization_test.rb +9 -11
- data/test/lib/my_john_deere_api/request/collection/asset_locations_test.rb +6 -5
- data/test/lib/my_john_deere_api/request/collection/assets_test.rb +6 -5
- data/test/lib/my_john_deere_api/request/collection/base_test.rb +8 -6
- data/test/lib/my_john_deere_api/request/collection/contribution_definitions_test.rb +5 -5
- data/test/lib/my_john_deere_api/request/collection/contribution_products_test.rb +5 -5
- data/test/lib/my_john_deere_api/request/collection/fields_test.rb +6 -5
- data/test/lib/my_john_deere_api/request/collection/flags_test.rb +6 -5
- data/test/lib/my_john_deere_api/request/collection/organizations_test.rb +7 -6
- data/test/lib/my_john_deere_api/request/create/asset_location_test.rb +15 -13
- data/test/lib/my_john_deere_api/request/create/asset_test.rb +16 -14
- data/test/lib/my_john_deere_api/request/create/base_test.rb +6 -4
- data/test/lib/my_john_deere_api/request/individual/asset_test.rb +4 -3
- data/test/lib/my_john_deere_api/request/individual/base_test.rb +4 -3
- data/test/lib/my_john_deere_api/request/individual/contribution_definition_test.rb +4 -3
- data/test/lib/my_john_deere_api/request/individual/contribution_product_test.rb +4 -3
- data/test/lib/my_john_deere_api/request/individual/field_test.rb +4 -3
- data/test/lib/my_john_deere_api/request/individual/organization_test.rb +4 -3
- data/test/lib/my_john_deere_api/request/update/asset_test.rb +6 -5
- data/test/lib/my_john_deere_api/request/update/base_test.rb +6 -4
- data/test/support/helper.rb +7 -2
- metadata +1 -1
@@ -3,12 +3,13 @@ require 'yaml'
|
|
3
3
|
require 'json'
|
4
4
|
|
5
5
|
describe 'MyJohnDeereApi::Request::Individual::ContributionDefinition' do
|
6
|
-
let(:object) { JD::Request::Individual::ContributionDefinition.new(
|
6
|
+
let(:object) { JD::Request::Individual::ContributionDefinition.new(client, contribution_definition_id) }
|
7
7
|
|
8
8
|
inherits_from JD::Request::Individual::Base
|
9
9
|
|
10
|
-
describe '#initialize(
|
11
|
-
it 'accepts
|
10
|
+
describe '#initialize(client, contribution_definition_id)' do
|
11
|
+
it 'accepts a client' do
|
12
|
+
assert_equal client, object.client
|
12
13
|
assert_equal accessor, object.accessor
|
13
14
|
end
|
14
15
|
|
@@ -3,12 +3,13 @@ require 'yaml'
|
|
3
3
|
require 'json'
|
4
4
|
|
5
5
|
describe 'MyJohnDeereApi::Request::Individual::ContributionProduct' do
|
6
|
-
let(:object) { JD::Request::Individual::ContributionProduct.new(
|
6
|
+
let(:object) { JD::Request::Individual::ContributionProduct.new(client, contribution_product_id) }
|
7
7
|
|
8
8
|
inherits_from JD::Request::Individual::Base
|
9
9
|
|
10
|
-
describe '#initialize(
|
11
|
-
it 'accepts
|
10
|
+
describe '#initialize(client, contribution_product_id)' do
|
11
|
+
it 'accepts a client' do
|
12
|
+
assert_equal client, object.client
|
12
13
|
assert_equal accessor, object.accessor
|
13
14
|
end
|
14
15
|
|
@@ -3,12 +3,13 @@ require 'yaml'
|
|
3
3
|
require 'json'
|
4
4
|
|
5
5
|
describe 'MyJohnDeereApi::Request::Individual::Field' do
|
6
|
-
let(:object) { JD::Request::Individual::Field.new(
|
6
|
+
let(:object) { JD::Request::Individual::Field.new(client, field_id, organization: organization_id) }
|
7
7
|
|
8
8
|
inherits_from JD::Request::Individual::Base
|
9
9
|
|
10
|
-
describe '#initialize(
|
11
|
-
it 'accepts
|
10
|
+
describe '#initialize(client, organization_id, field_id)' do
|
11
|
+
it 'accepts a client' do
|
12
|
+
assert_equal client, object.client
|
12
13
|
assert_equal accessor, object.accessor
|
13
14
|
end
|
14
15
|
|
@@ -3,12 +3,13 @@ require 'yaml'
|
|
3
3
|
require 'json'
|
4
4
|
|
5
5
|
describe 'MyJohnDeereApi::Request::Individual::Organization' do
|
6
|
-
let(:object) { JD::Request::Individual::Organization.new(
|
6
|
+
let(:object) { JD::Request::Individual::Organization.new(client, organization_id) }
|
7
7
|
|
8
8
|
inherits_from JD::Request::Individual::Base
|
9
9
|
|
10
|
-
describe '#initialize(
|
11
|
-
it 'accepts
|
10
|
+
describe '#initialize(client, asset_id)' do
|
11
|
+
it 'accepts a client' do
|
12
|
+
assert_equal client, object.client
|
12
13
|
assert_equal accessor, object.accessor
|
13
14
|
end
|
14
15
|
|
@@ -2,8 +2,8 @@ require 'support/helper'
|
|
2
2
|
|
3
3
|
describe 'MyJohnDeereApi::Request::Update::Asset' do
|
4
4
|
let(:klass) { JD::Request::Update::Asset }
|
5
|
-
let(:object) { klass.new(
|
6
|
-
let(:item) { JD::Model::Asset.new(record,
|
5
|
+
let(:object) { klass.new(client, item, attributes) }
|
6
|
+
let(:item) { JD::Model::Asset.new(record, client) }
|
7
7
|
|
8
8
|
let(:attributes) do
|
9
9
|
{
|
@@ -27,8 +27,9 @@ describe 'MyJohnDeereApi::Request::Update::Asset' do
|
|
27
27
|
|
28
28
|
inherits_from MyJohnDeereApi::Request::Update::Base
|
29
29
|
|
30
|
-
describe '#initialize(
|
31
|
-
it 'accepts
|
30
|
+
describe '#initialize(client, item, attributes)' do
|
31
|
+
it 'accepts a client, item and attributes' do
|
32
|
+
assert_equal client, object.client
|
32
33
|
assert_equal accessor, object.accessor
|
33
34
|
assert_equal item, object.item
|
34
35
|
assert_equal item.attributes.merge(attributes), object.attributes
|
@@ -49,7 +50,7 @@ describe 'MyJohnDeereApi::Request::Update::Asset' do
|
|
49
50
|
|
50
51
|
describe '#headers' do
|
51
52
|
it 'sets the accept and content-type headers' do
|
52
|
-
object =
|
53
|
+
object = klass.new(client, item, attributes)
|
53
54
|
headers = object.send(:headers)
|
54
55
|
|
55
56
|
expected = 'application/vnd.deere.axiom.v3+json'
|
@@ -14,12 +14,14 @@ class UpdateBaseItem
|
|
14
14
|
end
|
15
15
|
|
16
16
|
describe 'MyJohnDeereApi::Request::Update::Base' do
|
17
|
-
let(:
|
17
|
+
let(:klass) { JD::Request::Update::Base }
|
18
|
+
let(:object) { klass.new(client, item, attributes) }
|
18
19
|
let(:item) { UpdateBaseItem.new }
|
19
20
|
let(:attributes) { {} }
|
20
21
|
|
21
|
-
describe '#initialize(
|
22
|
-
it 'accepts
|
22
|
+
describe '#initialize(client, item, attributes)' do
|
23
|
+
it 'accepts a client, item and attributes' do
|
24
|
+
assert_equal client, object.client
|
23
25
|
assert_equal accessor, object.accessor
|
24
26
|
assert_equal item, object.item
|
25
27
|
end
|
@@ -45,7 +47,7 @@ describe 'MyJohnDeereApi::Request::Update::Base' do
|
|
45
47
|
|
46
48
|
describe '#headers' do
|
47
49
|
it 'sets the accept and content-type headers' do
|
48
|
-
object =
|
50
|
+
object = klass.new(client, item, attributes)
|
49
51
|
headers = object.send(:headers)
|
50
52
|
|
51
53
|
expected = 'application/vnd.deere.axiom.v3+json'
|
data/test/support/helper.rb
CHANGED
@@ -42,7 +42,7 @@ class Minitest::Spec
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def accessor
|
45
|
-
@_accessor ||= VCR.use_cassette('catalog') { client.
|
45
|
+
@_accessor ||= VCR.use_cassette('catalog') { client.accessor }
|
46
46
|
end
|
47
47
|
|
48
48
|
def base_url
|
@@ -88,4 +88,9 @@ class Minitest::Spec
|
|
88
88
|
def verify_code
|
89
89
|
CONFIG.verify_code
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
|
+
# pre-load the accessor so the info is available in all specs without
|
93
|
+
# a special call to accessor
|
94
|
+
before { accessor }
|
95
|
+
end
|
96
|
+
|