myjohndeere 0.1.0 → 0.1.1

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
  SHA1:
3
- metadata.gz: 7e6813bb496ffe2d2a5d24c26c9255d554675184
4
- data.tar.gz: 9da19d2acb3e3fdad3b8d08c138e333ee5019f69
3
+ metadata.gz: 88190ee84652334c16e9feabec2d7b247fab5d50
4
+ data.tar.gz: 74175a45f890e7676e087291de5648b5ee829c6b
5
5
  SHA512:
6
- metadata.gz: 3c0d1f7ffd65f2b0c3f1b806d1282f2df3c84c807a4d2ab2c6689af54eaecab6c3cb901d5d5826f227e730bd812bbb2885a73c54fe369eb5ef5d4c73c5f09a35
7
- data.tar.gz: 39b995dbdcbfa0af60fd5a2d0cc3b9ce6d6a97c1a7c616f4b79f15ed5d3e38a474a7c2ebf39b09cb5087b3f1b149134a6171a59c68c3aebe5e22e5605e397a40
6
+ metadata.gz: 1c8818275027188a03e60fce2703553d8533ff85455ee25fe033feb84dda1c682f62e539531bbb2898d81588876efaa83a1d7bb01b74e08b9177b0c37947f877
7
+ data.tar.gz: 29f2ff820b98ab782ebccda2ccf6a7a76559d18bc6dc26bc8aa62f2284df847a5276f9e98590d8b240fea979a7c9ab5514bd6f4b9b873e372d9da3ccf6b12f4e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- myjohndeere (0.1.0)
4
+ myjohndeere (0.1.1)
5
5
  oauth (>= 0.5.3)
6
6
 
7
7
  GEM
@@ -6,6 +6,7 @@ module MyJohnDeere
6
6
  attributes_to_pull_from_json(:id, :name, :boundaries)
7
7
 
8
8
  def initialize(json_object, access_token = nil)
9
+ @boundary = nil
9
10
  super(json_object, access_token)
10
11
  boundaries = json_object["boundaries"]
11
12
  if boundaries && boundaries.length > 0 then
@@ -14,8 +15,14 @@ module MyJohnDeere
14
15
  end
15
16
  end
16
17
 
18
+ # Will return whether or not the boundary has been set,
19
+ # useful if you're expecting embedded boundaries
20
+ def boundary_unset?
21
+ return @boundary.nil?
22
+ end
23
+
17
24
  def boundary
18
- if @boundary.nil? then
25
+ if self.boundary_unset? then
19
26
  @boundary = Boundary.retrieve(self.access_token, field_id: self.id, organization_id: self.organization_id)
20
27
  end
21
28
  return @boundary
@@ -1,3 +1,3 @@
1
1
  module MyJohnDeere
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
data/test/test_field.rb CHANGED
@@ -35,6 +35,13 @@ class TestField < Minitest::Test
35
35
  assert_equal field.id, field.boundary.field_id
36
36
  end
37
37
 
38
+ def test_boundary_unset
39
+ field = MyJohnDeere::Field.new({})
40
+ assert field.boundary_unset?
41
+ field.boundary = MyJohnDeere::Boundary.new({}, nil, 1)
42
+ assert !field.boundary_unset?
43
+ end
44
+
38
45
  def test_list()
39
46
  stub_request(:get, /organizations\/#{ORGANIZATION_FIXTURE["id"]}\/fields/).
40
47
  to_return(status: 200, body: FIXTURE_FOR_LIST.to_json)
@@ -63,11 +63,12 @@ class TestRestMethods < Minitest::Test
63
63
  end
64
64
 
65
65
  def test_list_with_body
66
+ embed = {embed: "boundaries"}
66
67
  stub_request(:get, /organizations/).
67
- with(query: {embed: "boundaries"},
68
+ with(query: embed,
68
69
  headers: {MyJohnDeere::ETAG_HEADER_KEY=>""}).
69
70
  to_return(status: 200, body: LIST_FIXTURE.to_json())
70
- organizations = MyJohnDeere::Organization.list(default_access_token, count: 1, etag: "", body: {embed: "boundaries"})
71
- assert_equal({:embed=>"boundaries"}, organizations.options[:body])
71
+ organizations = MyJohnDeere::Organization.list(default_access_token, count: 1, etag: "", body: embed)
72
+ assert_equal(embed, organizations.options[:body])
72
73
  end
73
74
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myjohndeere
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Susmarski