myjohndeere 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/myjohndeere/field.rb +3 -2
- data/lib/myjohndeere/file_resource.rb +1 -1
- data/lib/myjohndeere/version.rb +1 -1
- data/spec/fixtures.json +1 -1
- data/test/test_field.rb +7 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6f1396f290f034c7d9bc96100a798d5e3a653e7
|
4
|
+
data.tar.gz: f0815526e2742dae974c1ed89745265e60a5a433
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e09bf7d4e04d3a9d2b2093fdff043d5653c86d246fe5db098b6fc117db90f111cbf240b99a56f63ef41b81decae090338689843ec953a08ac66b34e283c4d05
|
7
|
+
data.tar.gz: ae920d40bdcb973f0fa8ecfe7a5bf3c8185f212c80578a0ccb975f6e1e6925183a63501d4c16a01a71e512766fdd2a28223c744fdead6df105cfbf80dd5fba37
|
data/Gemfile.lock
CHANGED
data/lib/myjohndeere/field.rb
CHANGED
@@ -36,9 +36,10 @@ module MyJohnDeere
|
|
36
36
|
|
37
37
|
private
|
38
38
|
def find_first_active_boundary(possible_boundaries)
|
39
|
-
active_boundaries = possible_boundaries.select { |b| b.active && !b.deleted }
|
39
|
+
active_boundaries = possible_boundaries.select { |b| b.active && !b.deleted }.
|
40
|
+
uniq { |b| b.id }
|
40
41
|
if active_boundaries.count > 1 then
|
41
|
-
raise MyJohnDeereError.new("There was more than one boundary in the field, this is currently unexpected")
|
42
|
+
raise MyJohnDeereError.new("There was more than one boundary in the field ID: #{self.id}, this is currently unexpected")
|
42
43
|
elsif active_boundaries.count == 1 then
|
43
44
|
return active_boundaries.first
|
44
45
|
else
|
@@ -46,7 +46,7 @@ module MyJohnDeere
|
|
46
46
|
"#{self.base_jd_resource}/#{file_resource_id}",
|
47
47
|
body: body,
|
48
48
|
headers: {
|
49
|
-
'accept'=>
|
49
|
+
'accept'=> JSON_CONTENT_HEADER_VALUE,
|
50
50
|
"Content-Type"=>'application/octet-stream' ,
|
51
51
|
"Content-Length" => body.bytesize.to_s
|
52
52
|
})
|
data/lib/myjohndeere/version.rb
CHANGED
data/spec/fixtures.json
CHANGED
data/test/test_field.rb
CHANGED
@@ -63,11 +63,12 @@ class TestField < Minitest::Test
|
|
63
63
|
with(query: {embed: "boundaries"}).
|
64
64
|
to_return(status: 200, body: fixture.to_json)
|
65
65
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
66
|
+
field = MyJohnDeere::Field.retrieve(default_access_token,
|
67
|
+
fixture["id"], organization_id: ORGANIZATION_FIXTURE["id"],
|
68
|
+
body: {embed: "boundaries"})
|
69
|
+
|
70
|
+
assert field.boundary.is_a?(MyJohnDeere::Boundary),
|
71
|
+
"There should be only one boundary since the request returned 2 boundaries with the same id"
|
71
72
|
end
|
72
73
|
|
73
74
|
def test_list()
|
@@ -83,6 +84,6 @@ class TestField < Minitest::Test
|
|
83
84
|
|
84
85
|
fields.next_page!
|
85
86
|
|
86
|
-
assert_equal 1, fields.data
|
87
|
+
assert_equal 1, fields.data.count
|
87
88
|
end
|
88
89
|
end
|