my_john_deere_api 0.2.0 → 0.3.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: bcc137e1443b571fcbfa6cba0480a750e1b76bf648bf30a37e51818ba25005a1
4
- data.tar.gz: 5eecb3dc93a0cbf0d8f0951dc4dc722531149ddd25c8bb9452a39459e9676ab5
3
+ metadata.gz: 31aa8280a3df1a7eb45d47c7f5d8a3f6606316b5d7bec7ce42256a843beb0274
4
+ data.tar.gz: d1cff664da5725a67903fdfc1d71b344b26c038099b456295302cb4b0949f1b0
5
5
  SHA512:
6
- metadata.gz: fcc0a3d656159189be4c3e5c9e0a523320b26d11dc6257d88ea1748ab323be63c48a1d59625ae8d4da67764919101e8efc8e5786738f05e385f537ab33edc648
7
- data.tar.gz: ec4831601dcfaeda5e13a25a4d658a0a6b77a8eba19c86e2330580470af830ca91dff4d957ab7f66e7c89166c1c25a50e75aba08c4575b23790e23e3d52a6810
6
+ metadata.gz: 555d80933c95a91da91ed4892ecc8e3243d6d7df448ed220f8921973dbfa93737e98e9d5be74a96c7509d4361c05bba257828be37e49580b1b56c911da569ecc
7
+ data.tar.gz: 33efb9f16ef9323279aa6449b9bbc21c532db6130ee2bbb7da4dba47a93510c8d36af6efb4c17262805fe26a0e2f2e4ee083ed7a65fa98aadd00b00c9410e42a
@@ -0,0 +1,12 @@
1
+ module MyJohnDeereApi
2
+ ##
3
+ # This error is used in a context that will fail in the absence of
4
+ # a valid oAuth access token. We have classes that may only need
5
+ # access tokens for some use cases.
6
+
7
+ class AccessTokenError < StandardError
8
+ def initialize(message = "A valid oAuth Access Token must be supplied to use this feature.")
9
+ super
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ require 'uri'
2
+
3
+ module MyJohnDeereApi::Helpers::UriPath
4
+ def uri_path(uri)
5
+ URI.parse(uri).path.gsub(/^\/platform/, '')
6
+ end
7
+
8
+ private :uri_path
9
+ end
@@ -0,0 +1,3 @@
1
+ module MyJohnDeereApi::Helpers
2
+ autoload :UriPath, 'my_john_deere_api/helpers/uri_path'
3
+ end
@@ -0,0 +1,25 @@
1
+ module MyJohnDeereApi
2
+ class Model::Field
3
+ include Helpers::UriPath
4
+
5
+ attr_reader :name, :id, :links, :accessor
6
+
7
+ def initialize(record, accessor = nil)
8
+ @accessor = accessor
9
+
10
+ @name = record['name']
11
+ @id = record['id']
12
+ @archived = record['archived']
13
+
14
+ @links = {}
15
+
16
+ record['links'].each do |association|
17
+ @links[association['rel']] = uri_path(association['uri'])
18
+ end
19
+ end
20
+
21
+ def archived?
22
+ @archived
23
+ end
24
+ end
25
+ end
@@ -1,20 +1,38 @@
1
- class MyJohnDeereApi::Model::Organization
2
- attr_reader :name, :type, :id, :links
1
+ require 'uri'
3
2
 
4
- def initialize(record)
5
- @name = record['name']
6
- @type = record['type']
7
- @id = record['id']
8
- @member = record['member']
3
+ module MyJohnDeereApi
4
+ class Model::Organization
5
+ include Helpers::UriPath
9
6
 
10
- @links = {}
7
+ attr_reader :name, :type, :id, :links, :accessor
11
8
 
12
- record['links'].each do |association|
13
- @links[association['rel']] = association['uri']
9
+ def initialize(record, accessor = nil)
10
+ @accessor = accessor
11
+
12
+ @name = record['name']
13
+ @type = record['type']
14
+ @id = record['id']
15
+ @member = record['member']
16
+
17
+ @links = {}
18
+
19
+ record['links'].each do |association|
20
+ @links[association['rel']] = uri_path(association['uri'])
21
+ end
14
22
  end
15
- end
16
23
 
17
- def member?
18
- @member
24
+ def member?
25
+ @member
26
+ end
27
+
28
+ ##
29
+ # fields associated with this organization
30
+
31
+ def fields
32
+ raise AccessTokenError unless accessor
33
+
34
+ return @fields if defined?(@fields)
35
+ @fields = MyJohnDeereApi::Request::Fields.new(accessor, organization: id).all
36
+ end
19
37
  end
20
38
  end
@@ -1,3 +1,4 @@
1
1
  module MyJohnDeereApi::Model
2
2
  autoload :Organization, 'my_john_deere_api/model/organization'
3
+ autoload :Field, 'my_john_deere_api/model/field'
3
4
  end
@@ -1,73 +1,83 @@
1
- class MyJohnDeereApi::Request::Collection
2
- include Enumerable
1
+ module MyJohnDeereApi
2
+ class Request::Collection
3
+ include Enumerable
4
+ include Helpers::UriPath
3
5
 
4
- attr_reader :accessor
6
+ attr_reader :accessor, :associations
5
7
 
6
- ##
7
- # accessor is an OAuth::AccessToken object which has the necessary
8
- # credentials to make the desired requests.
8
+ ##
9
+ # accessor is an OAuth::AccessToken object which has the necessary
10
+ # credentials to make the desired requests.
9
11
 
10
- def initialize(accessor)
11
- @accessor = accessor
12
- @items = []
13
- end
12
+ def initialize(accessor, associations = {})
13
+ @accessor = accessor
14
+ @associations = associations
15
+ @items = []
16
+ end
14
17
 
15
- ##
16
- # Iterate lazily through all records in the collection, fetching
17
- # additional pages as needed.
18
+ ##
19
+ # Iterate lazily through all records in the collection, fetching
20
+ # additional pages as needed.
18
21
 
19
- def each(&block)
20
- count.times do |index|
21
- fetch if @items.size <= index
22
- block.call(@items[index])
22
+ def each(&block)
23
+ count.times do |index|
24
+ fetch if @items.size <= index
25
+ block.call(@items[index])
26
+ end
23
27
  end
24
- end
25
-
26
- ##
27
- # Return all objects in the collection at once
28
28
 
29
- def all
30
- return @all if defined?(@all)
31
- @all = map { |i| i }
32
- end
29
+ ##
30
+ # Return all objects in the collection at once
33
31
 
34
- ##
35
- # Total count of records, even before pagination
32
+ def all
33
+ return @all if defined?(@all)
34
+ @all = map { |i| i }
35
+ end
36
36
 
37
- def count
38
- @count ||= first_page['total']
39
- end
37
+ ##
38
+ # Total count of records, even before pagination
40
39
 
41
- private
40
+ def count
41
+ @count ||= first_page['total']
42
+ end
42
43
 
43
- def first_page
44
- return @first_page if defined?(@first_page)
44
+ private
45
45
 
46
- @first_page = JSON.parse(@accessor.get(resource, headers).body)
46
+ def first_page
47
+ return @first_page if defined?(@first_page)
47
48
 
48
- @items = @first_page['values'].map{|record| model.new(record) }
49
+ @first_page = JSON.parse(@accessor.get(resource, headers).body)
50
+ extract_page_contents(@first_page)
49
51
 
50
- if next_page = @first_page['links'].detect{|link| link['rel'] == 'nextPage'}
51
- @next_page = next_page['uri'].gsub(@accessor.consumer.site, '')
52
+ @first_page
52
53
  end
53
54
 
54
- @first_page
55
- end
55
+ def fetch
56
+ return unless @next_page
56
57
 
57
- def fetch
58
- return unless @next_page
58
+ page = JSON.parse(@accessor.get(@next_page, headers).body)
59
+ extract_page_contents(page)
60
+ end
59
61
 
60
- page = JSON.parse(@accessor.get(@next_page, headers).body)
61
- @items += page['values'].map{|record| model.new(record) }
62
+ def headers
63
+ @headers ||= {accept: 'application/vnd.deere.axiom.v3+json'}
64
+ end
62
65
 
63
- if next_page = @first_page['links'].detect{|link| link['rel'] == 'nextPage'}
64
- @next_page = next_page['uri'].gsub(@accessor.consumer.site, '')
65
- else
66
- @next_page = nil
66
+ def extract_page_contents(page)
67
+ add_items_from_page(page)
68
+ set_next_page(page)
67
69
  end
68
- end
69
70
 
70
- def headers
71
- @headers ||= {accept: 'application/vnd.deere.axiom.v3+json'}
71
+ def add_items_from_page(page)
72
+ @items += page['values'].map{|record| model.new(record, accessor) }
73
+ end
74
+
75
+ def set_next_page(page)
76
+ if next_page = page['links'].detect{|link| link['rel'] == 'nextPage'}
77
+ @next_page = uri_path(next_page['uri'])
78
+ else
79
+ @next_page = nil
80
+ end
81
+ end
72
82
  end
73
83
  end
@@ -0,0 +1,19 @@
1
+ require 'json'
2
+
3
+ module MyJohnDeereApi::Request
4
+ class Fields < Collection
5
+ ##
6
+ # The resource path for the first page in the collection
7
+
8
+ def resource
9
+ "/organizations/#{associations[:organization]}/fields"
10
+ end
11
+
12
+ ##
13
+ # This is the class used to model the data
14
+
15
+ def model
16
+ MyJohnDeereApi::Model::Field
17
+ end
18
+ end
19
+ end
@@ -1,4 +1,5 @@
1
1
  module MyJohnDeereApi::Request
2
2
  autoload :Collection, 'my_john_deere_api/request/collection'
3
3
  autoload :Organizations, 'my_john_deere_api/request/organizations'
4
+ autoload :Fields, 'my_john_deere_api/request/fields'
4
5
  end
@@ -1,3 +1,3 @@
1
1
  module MyJohnDeereApi
2
- VERSION='0.2.0'
2
+ VERSION='0.3.0'
3
3
  end
@@ -9,4 +9,7 @@ module MyJohnDeereApi
9
9
  autoload :Consumer, 'my_john_deere_api/consumer'
10
10
  autoload :Request, 'my_john_deere_api/request'
11
11
  autoload :Model, 'my_john_deere_api/model'
12
+ autoload :Helpers, 'my_john_deere_api/helpers'
13
+
14
+ require 'my_john_deere_api/errors'
12
15
  end
@@ -0,0 +1,28 @@
1
+ require 'support/helper'
2
+
3
+ class UriPathHelperSample
4
+ include JD::Helpers::UriPath
5
+ end
6
+
7
+ describe 'UriPath' do
8
+ let(:object) { UriPathHelperSample.new }
9
+
10
+ it 'extracts the path from the uri' do
11
+ path = object.send(:uri_path, 'https://example.com/turtles')
12
+ assert_equal '/turtles', path
13
+ end
14
+
15
+ it 'removes leading /platform from the path' do
16
+ path = object.send(:uri_path, 'https://example.com/platform/turtles')
17
+ assert_equal '/turtles', path
18
+ end
19
+
20
+ it 'preserves /platform in any other part of the path' do
21
+ path = object.send(:uri_path, 'https://example.com/platform/turtles/platform')
22
+ assert_equal '/turtles/platform', path
23
+ end
24
+
25
+ it 'is a private method' do
26
+ assert_raises(NoMethodError) { object.uri_path('https://example.com/turtles')}
27
+ end
28
+ end
@@ -0,0 +1,48 @@
1
+ require 'support/helper'
2
+
3
+ describe 'MyJohnDeereApi::Model::Field' do
4
+ let(:record) do
5
+ {
6
+ "@type"=>"Field",
7
+ "name"=>"Happy Field",
8
+ "archived"=>false,
9
+ "id"=>"123456",
10
+ "links"=>[
11
+ {"@type"=>"Link", "rel"=>"self", "uri"=>"https://sandboxapi.deere.com/platform/organizations/123456/fields/123456"},
12
+ {"@type"=>"Link", "rel"=>"clients", "uri"=>"https://sandboxapi.deere.com/platform/organizations/123456/fields/123456/clients"},
13
+ {"@type"=>"Link", "rel"=>"notes", "uri"=>"https://sandboxapi.deere.com/platform/organizations/123456/fields/123456/notes"},
14
+ ]
15
+ }
16
+ end
17
+
18
+ describe '#initialize' do
19
+ def link_for label
20
+ record['links'].detect{|link| link['rel'] == label}['uri'].gsub('https://sandboxapi.deere.com/platform', '')
21
+ end
22
+
23
+ it 'sets the attributes from the given record' do
24
+ field = JD::Model::Field.new(record)
25
+
26
+ assert_nil field.accessor
27
+
28
+ # basic attributes
29
+ assert_equal record['name'], field.name
30
+ assert_equal record['archived'], field.archived?
31
+ assert_equal record['id'], field.id
32
+
33
+ # links to other things
34
+ assert_kind_of Hash, field.links
35
+
36
+ ['clients', 'notes'].each do |association|
37
+ assert_equal link_for(association), field.links[association]
38
+ end
39
+ end
40
+
41
+ it 'accepts an optional accessor' do
42
+ accessor = 'mock-accessor'
43
+
44
+ field = JD::Model::Field.new(record, accessor)
45
+ assert_equal accessor, field.accessor
46
+ end
47
+ end
48
+ end
@@ -28,9 +28,12 @@ describe 'MyJohnDeereApi::Model::Organization' do
28
28
  }
29
29
  end
30
30
 
31
- describe '#initialize' do
31
+ let(:client) { JD::Client.new(API_KEY, API_SECRET, environment: :sandbox, access: [ACCESS_TOKEN, ACCESS_SECRET]) }
32
+ let(:accessor) { VCR.use_cassette('catalog') { client.send(:accessor) } }
33
+
34
+ describe '#initialize(record, accessor = nil)' do
32
35
  def link_for label
33
- record['links'].detect{|link| link['rel'] == label}['uri']
36
+ record['links'].detect{|link| link['rel'] == label}['uri'].gsub('https://sandboxapi.deere.com/platform', '')
34
37
  end
35
38
 
36
39
  it 'sets the attributes from the given record' do
@@ -41,6 +44,7 @@ describe 'MyJohnDeereApi::Model::Organization' do
41
44
  assert_equal record['type'], organization.type
42
45
  assert_equal record['member'], organization.member?
43
46
  assert_equal record['id'], organization.id
47
+ assert_nil organization.accessor
44
48
 
45
49
  # links to other things
46
50
  assert_kind_of Hash, organization.links
@@ -49,5 +53,34 @@ describe 'MyJohnDeereApi::Model::Organization' do
49
53
  assert_equal link_for(association), organization.links[association]
50
54
  end
51
55
  end
56
+
57
+ it 'accepts an optional accessor' do
58
+ accessor = 'mock-accessor'
59
+
60
+ organization = JD::Model::Organization.new(record, accessor)
61
+ assert_equal accessor, organization.accessor
62
+ end
63
+ end
64
+
65
+ describe '#fields' do
66
+ it 'returns a collection of fields for this organization' do
67
+ accessor
68
+ organization = VCR.use_cassette('get_organizations') { client.organizations.first }
69
+ fields = VCR.use_cassette('get_fields') { organization.fields }
70
+
71
+ assert_kind_of Array, fields
72
+
73
+ fields.each do |field|
74
+ assert_kind_of JD::Model::Field, field
75
+ end
76
+ end
77
+
78
+ it 'raises an exception if an accessor is not available' do
79
+ organization = JD::Model::Organization.new(record)
80
+
81
+ exception = assert_raises(JD::AccessTokenError) { organization.fields }
82
+
83
+ assert_includes exception.message, 'Access Token must be supplied'
84
+ end
52
85
  end
53
86
  end
@@ -9,6 +9,13 @@ describe 'MyJohnDeereApi::Request::Collection' do
9
9
  collection = JD::Request::Collection.new(accessor)
10
10
  assert_kind_of OAuth::AccessToken, collection.accessor
11
11
  end
12
+
13
+ it 'accepts associations' do
14
+ collection = JD::Request::Collection.new(accessor, organization: '123')
15
+
16
+ assert_kind_of Hash, collection.associations
17
+ assert_equal '123', collection.associations[:organization]
18
+ end
12
19
  end
13
20
 
14
21
  it 'uses the Enumerable module' do
@@ -0,0 +1,83 @@
1
+ require 'support/helper'
2
+ require 'yaml'
3
+ require 'json'
4
+
5
+ describe 'MyJohnDeereApi::Request::Fields' do
6
+ let(:organization_id) do
7
+ contents = File.read('test/support/vcr/get_organizations.yml')
8
+ body = YAML.load(contents)['http_interactions'].first['response']['body']['string']
9
+ JSON.parse(body)['values'].first['id']
10
+ end
11
+
12
+ let(:client) { JD::Client.new(API_KEY, API_SECRET, environment: :sandbox, access: [ACCESS_TOKEN, ACCESS_SECRET]) }
13
+ let(:accessor) { VCR.use_cassette('catalog') { client.send(:accessor) } }
14
+ let(:collection) { JD::Request::Fields.new(accessor, organization: organization_id) }
15
+
16
+ describe '#initialize(access_token)' do
17
+ it 'accepts an access token' do
18
+ assert_kind_of OAuth::AccessToken, collection.accessor
19
+ end
20
+
21
+ it 'accepts associations' do
22
+ collection = JD::Request::Organizations.new(accessor, organization: '123')
23
+
24
+ assert_kind_of Hash, collection.associations
25
+ assert_equal '123', collection.associations[:organization]
26
+ end
27
+ end
28
+
29
+ describe '#resource' do
30
+ it 'returns /organizations/{org_id}/fields' do
31
+ assert_equal "/organizations/#{organization_id}/fields", collection.resource
32
+ end
33
+ end
34
+
35
+ describe '#all' do
36
+ it 'returns all records' do
37
+ all = VCR.use_cassette('get_fields', record: :new_episodes) { collection.all }
38
+
39
+ assert_kind_of Array, all
40
+ assert_equal collection.count, all.size
41
+
42
+ all.each do |item|
43
+ assert_kind_of JD::Model::Field, item
44
+ end
45
+ end
46
+ end
47
+
48
+ describe '#count' do
49
+ let(:server_response) do
50
+ contents = File.read('test/support/vcr/get_fields.yml')
51
+ body = YAML.load(contents)['http_interactions'].first['response']['body']['string']
52
+ JSON.parse(body)
53
+ end
54
+
55
+ let(:server_count) { server_response['total'] }
56
+
57
+ it 'returns the total count of records in the collection' do
58
+ count = VCR.use_cassette('get_fields') { collection.count }
59
+
60
+ assert_equal server_count, count
61
+ end
62
+ end
63
+
64
+ describe 'results' do
65
+ let(:field_names) do
66
+ contents = File.read('test/support/vcr/get_fields.yml')
67
+ body = YAML.load(contents)['http_interactions'].first['response']['body']['string']
68
+ JSON.parse(body)['values'].map{|v| v['name']}
69
+ end
70
+
71
+ it 'returns all records as a single enumerator' do
72
+ count = VCR.use_cassette('get_fields') { collection.count }
73
+ names = VCR.use_cassette('get_fields', record: :new_episodes) { collection.map{|item| item.name} }
74
+
75
+ assert_kind_of Array, names
76
+ assert_equal count, names.size
77
+
78
+ field_names.each do |expected_name|
79
+ assert_includes names, expected_name
80
+ end
81
+ end
82
+ end
83
+ end
@@ -21,12 +21,12 @@ describe 'MyJohnDeereApi::Request::Organizations' do
21
21
 
22
22
  describe '#all' do
23
23
  it 'returns all records' do
24
- items = VCR.use_cassette('get_organizations', record: :new_episodes) { collection.map{|item| item} }
24
+ all = VCR.use_cassette('get_organizations', record: :new_episodes) { collection.all }
25
25
 
26
- assert_kind_of Array, collection.all
27
- assert_equal collection.count, collection.all.size
26
+ assert_kind_of Array, all
27
+ assert_equal collection.count, all.size
28
28
 
29
- collection.all.each do |item|
29
+ all.each do |item|
30
30
  assert_kind_of JD::Model::Organization, item
31
31
  end
32
32
  end
@@ -49,23 +49,30 @@ describe 'MyJohnDeereApi::Request::Organizations' do
49
49
  end
50
50
 
51
51
  describe 'pagination' do
52
- it 'returns all records as a single enumerator' do
53
- expected_names = [
54
- 'Century Farms', "JJ's Farm", 'Organization A', 'Organization B', 'Organization C',
55
- 'Organization D', 'Organization E', 'Organization F', 'Organization G',
56
- 'Organization H', 'Organization Eye', 'Organization Jay', 'Organization Kay',
57
- 'Organization Elle'
58
- ]
52
+ let(:organization_names) do
53
+ contents = File.read('test/support/vcr/get_organizations.yml')
54
+ body = YAML.load(contents)['http_interactions'].first['response']['body']['string']
55
+ JSON.parse(body)['values'].map{|v| v['name']}
56
+ end
59
57
 
58
+ it 'returns all records as a single enumerator' do
60
59
  count = VCR.use_cassette('get_organizations') { collection.count }
61
60
  names = VCR.use_cassette('get_organizations', record: :new_episodes) { collection.map{|item| item.name} }
62
61
 
63
62
  assert_kind_of Array, names
64
63
  assert_equal count, names.size
65
64
 
66
- expected_names.each do |expected_name|
65
+ organization_names.each do |expected_name|
67
66
  assert_includes names, expected_name
68
67
  end
69
68
  end
69
+
70
+ it 'passes the accessor to all organizations' do
71
+ organizations = VCR.use_cassette('get_organizations', record: :new_episodes) { collection.all }
72
+
73
+ organizations.each do |organization|
74
+ assert_equal accessor, organization.accessor
75
+ end
76
+ end
70
77
  end
71
78
  end
@@ -0,0 +1,9 @@
1
+ require 'support/helper'
2
+
3
+ describe 'MyJohnDeereApi::Helpers' do
4
+ describe 'loading dependencies' do
5
+ it 'loads Helpers::UriPath' do
6
+ assert JD::Helpers::UriPath
7
+ end
8
+ end
9
+ end
@@ -5,5 +5,9 @@ describe 'MyJohnDeereApi::Model' do
5
5
  it 'loads Model::Organization' do
6
6
  assert JD::Model::Organization
7
7
  end
8
+
9
+ it 'loads Model::Field' do
10
+ assert JD::Model::Field
11
+ end
8
12
  end
9
13
  end
@@ -9,5 +9,9 @@ describe 'MyJohnDeereApi::Request' do
9
9
  it 'loads Request::Organizations' do
10
10
  assert JD::Request::Organizations
11
11
  end
12
+
13
+ it 'loads Request::Fields' do
14
+ assert JD::Request::Fields
15
+ end
12
16
  end
13
17
  end
@@ -0,0 +1,49 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://sandboxapi.deere.com/platform/organizations/444563/fields
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-wgmADngYCRmfpEbVgSyc709wnyRux5J7PAv8SE7B",
18
+ oauth_nonce="EuBNDwOFDYzuM5T50isfeWfjmFhOEKwnQBptgqAAQ", oauth_signature="5VXnWsRC0EAneTF7mQIthGJ2%2BVA%3D",
19
+ oauth_signature_method="HMAC-SHA1", oauth_timestamp="1578526360", oauth_token="47bbb9c9-41a8-4bec-8127-e3c5760af2f6",
20
+ oauth_version="1.0"
21
+ response:
22
+ status:
23
+ code: 200
24
+ message: OK
25
+ headers:
26
+ Date:
27
+ - Wed, 08 Jan 2020 23:32:41 GMT
28
+ Content-Type:
29
+ - application/vnd.deere.axiom.v3+json;charset=UTF-8
30
+ X-Deere-Handling-Server:
31
+ - ip-10-214-44-105
32
+ X-Frame-Options:
33
+ - SAMEORIGIN
34
+ X-Deere-Elapsed-Ms:
35
+ - '52'
36
+ Cache-Control:
37
+ - no-store
38
+ Content-Language:
39
+ - en-US
40
+ Transfer-Encoding:
41
+ - chunked
42
+ body:
43
+ encoding: ASCII-8BIT
44
+ string: '{"links":[{"rel":"self","uri":"https://sandboxapi.deere.com/platform/organizations/444563/fields"}],"total":2,"values":[{"@type":"Field","name":"Pivot
45
+ Fields","archived":false,"id":"11911a5a-ff81-40ef-b10d-0af9457fe474","links":[{"@type":"Link","rel":"self","uri":"https://sandboxapi.deere.com/platform/organizations/444563/fields/11911a5a-ff81-40ef-b10d-0af9457fe474"},{"@type":"Link","rel":"clients","uri":"https://sandboxapi.deere.com/platform/organizations/444563/fields/11911a5a-ff81-40ef-b10d-0af9457fe474/clients"},{"@type":"Link","rel":"farms","uri":"https://sandboxapi.deere.com/platform/organizations/444563/fields/11911a5a-ff81-40ef-b10d-0af9457fe474/farms"},{"@type":"Link","rel":"owningOrganization","uri":"https://sandboxapi.deere.com/platform/organizations/444563"},{"@type":"Link","rel":"boundaries","uri":"https://sandboxapi.deere.com/platform/organizations/444563/fields/11911a5a-ff81-40ef-b10d-0af9457fe474/boundaries"},{"@type":"Link","rel":"simplifiedBoundaries","uri":"https://sandboxapi.deere.com/platform/organizations/444563/fields/11911a5a-ff81-40ef-b10d-0af9457fe474/boundaries?simple=true"},{"@type":"Link","rel":"addBoundary","uri":"https://sandboxapi.deere.com/platform/organizations/444563/fields/11911a5a-ff81-40ef-b10d-0af9457fe474/boundaries"},{"@type":"Link","rel":"deleteField","uri":"https://sandboxapi.deere.com/platform/organizations/444563/fields/11911a5a-ff81-40ef-b10d-0af9457fe474"},{"@type":"Link","rel":"editField","uri":"https://sandboxapi.deere.com/platform/organizations/444563/fields/11911a5a-ff81-40ef-b10d-0af9457fe474"}]},{"@type":"Field","name":"Pond
46
+ 1","archived":false,"id":"77db44f1-298d-45fd-9013-7184e25da776","links":[{"@type":"Link","rel":"self","uri":"https://sandboxapi.deere.com/platform/organizations/444563/fields/77db44f1-298d-45fd-9013-7184e25da776"},{"@type":"Link","rel":"clients","uri":"https://sandboxapi.deere.com/platform/organizations/444563/fields/77db44f1-298d-45fd-9013-7184e25da776/clients"},{"@type":"Link","rel":"farms","uri":"https://sandboxapi.deere.com/platform/organizations/444563/fields/77db44f1-298d-45fd-9013-7184e25da776/farms"},{"@type":"Link","rel":"owningOrganization","uri":"https://sandboxapi.deere.com/platform/organizations/444563"},{"@type":"Link","rel":"boundaries","uri":"https://sandboxapi.deere.com/platform/organizations/444563/fields/77db44f1-298d-45fd-9013-7184e25da776/boundaries"},{"@type":"Link","rel":"simplifiedBoundaries","uri":"https://sandboxapi.deere.com/platform/organizations/444563/fields/77db44f1-298d-45fd-9013-7184e25da776/boundaries?simple=true"},{"@type":"Link","rel":"addBoundary","uri":"https://sandboxapi.deere.com/platform/organizations/444563/fields/77db44f1-298d-45fd-9013-7184e25da776/boundaries"},{"@type":"Link","rel":"deleteField","uri":"https://sandboxapi.deere.com/platform/organizations/444563/fields/77db44f1-298d-45fd-9013-7184e25da776"},{"@type":"Link","rel":"editField","uri":"https://sandboxapi.deere.com/platform/organizations/444563/fields/77db44f1-298d-45fd-9013-7184e25da776"}]}]}'
47
+ http_version:
48
+ recorded_at: Wed, 08 Jan 2020 23:32:42 GMT
49
+ recorded_with: VCR 5.0.0
@@ -25,5 +25,9 @@ class MyJohnDeereApiTest < MiniTest::Test
25
25
  it 'loads Model' do
26
26
  assert JD::Model
27
27
  end
28
+
29
+ it 'loads Helpers' do
30
+ assert JD::Helpers
31
+ end
28
32
  end
29
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: my_john_deere_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaime. Bellmyer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-08 00:00:00.000000000 Z
11
+ date: 2020-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vcr
@@ -99,18 +99,27 @@ files:
99
99
  - lib/my_john_deere_api/authorize.rb
100
100
  - lib/my_john_deere_api/client.rb
101
101
  - lib/my_john_deere_api/consumer.rb
102
+ - lib/my_john_deere_api/errors.rb
103
+ - lib/my_john_deere_api/helpers.rb
104
+ - lib/my_john_deere_api/helpers/uri_path.rb
102
105
  - lib/my_john_deere_api/model.rb
106
+ - lib/my_john_deere_api/model/field.rb
103
107
  - lib/my_john_deere_api/model/organization.rb
104
108
  - lib/my_john_deere_api/request.rb
105
109
  - lib/my_john_deere_api/request/collection.rb
110
+ - lib/my_john_deere_api/request/fields.rb
106
111
  - lib/my_john_deere_api/request/organizations.rb
107
112
  - lib/my_john_deere_api/version.rb
113
+ - test/lib/my_john_deere_api/helpers/test_uri_path.rb
114
+ - test/lib/my_john_deere_api/model/test_field.rb
108
115
  - test/lib/my_john_deere_api/model/test_organization.rb
109
116
  - test/lib/my_john_deere_api/request/test_collection.rb
117
+ - test/lib/my_john_deere_api/request/test_fields.rb
110
118
  - test/lib/my_john_deere_api/request/test_organizations.rb
111
119
  - test/lib/my_john_deere_api/test_authorize.rb
112
120
  - test/lib/my_john_deere_api/test_client.rb
113
121
  - test/lib/my_john_deere_api/test_consumer.rb
122
+ - test/lib/my_john_deere_api/test_helpers.rb
114
123
  - test/lib/my_john_deere_api/test_model.rb
115
124
  - test/lib/my_john_deere_api/test_request.rb
116
125
  - test/lib/my_john_deere_api/test_version.rb
@@ -118,6 +127,7 @@ files:
118
127
  - test/support/vcr/app_consumer.yml
119
128
  - test/support/vcr/catalog.yml
120
129
  - test/support/vcr/get_access_token.yml
130
+ - test/support/vcr/get_fields.yml
121
131
  - test/support/vcr/get_organizations.yml
122
132
  - test/support/vcr/get_request_token.yml
123
133
  - test/test_my_john_deere_api.rb