my_john_deere_api 1.2.2 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -2
- data/lib/my_john_deere_api/errors.rb +1 -0
- data/lib/my_john_deere_api/errors/not_yet_implemented_error.rb +12 -0
- data/lib/my_john_deere_api/request/collection/flags.rb +14 -0
- data/lib/my_john_deere_api/version.rb +1 -1
- data/test/lib/my_john_deere_api/errors/not_yet_implemented_error_test.rb +13 -0
- data/test/lib/my_john_deere_api/errors_test.rb +4 -0
- data/test/lib/my_john_deere_api/request/collection/flags_test.rb +12 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d50aa3fc0ca62985954cd44e295bded9e99d4c4dfe0f54476790d67a8c9ec9c7
|
4
|
+
data.tar.gz: ff0e198656370bf7db40d83d389750c02fc9bf687f721f1aa1633ea3ea62dafa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc0e69436e3a50c0f3c14cbe472415478d7fa1ee79ad308c12054da7a5c03d6e298f0c85aebfdc32edf42c0ff4abc50b8cba1908f308564adfa75fdf57928adc
|
7
|
+
data.tar.gz: 18f7ba0176b534e2af940205145b97172dd64c4083b2c43fdf586ce602742fc6110e059dff26fbbf1e408d43a9cf67488eae7b7e0ec10166288b5bf137f400ec
|
data/README.md
CHANGED
@@ -467,5 +467,16 @@ client.delete('/assets/123123')
|
|
467
467
|
|
468
468
|
John Deere's standard response is a 204 HTTP status code, with the message "No Content". This method returns the full Net::HTTP response.
|
469
469
|
|
470
|
-
|
471
|
-
|
470
|
+
### Contributing to This Gem
|
471
|
+
|
472
|
+
The easiest way to contribute is:
|
473
|
+
|
474
|
+
* Clone the repo
|
475
|
+
* Create a feature branch
|
476
|
+
* Grep for "raise NotYetImplementedError" in the lib directory
|
477
|
+
* Replace one of these exceptions with working code, following the conventions used in the rest of the app
|
478
|
+
* Run tests.
|
479
|
+
* You may need to regenerate all VCR cassettes from scratch.
|
480
|
+
* All VCR cassettes should be pre-recorded in `vcr_setup`
|
481
|
+
* Anything that is created in the JD sandbox as a result of running the tests should be removed, also in `vcr_setup`.
|
482
|
+
* When tests are passing, submit a Pull Request.
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module MyJohnDeereApi::Errors
|
2
2
|
require 'my_john_deere_api/errors/access_token_error'
|
3
3
|
require 'my_john_deere_api/errors/invalid_record_error'
|
4
|
+
require 'my_john_deere_api/errors/not_yet_implemented_error'
|
4
5
|
require 'my_john_deere_api/errors/type_mismatch_error'
|
5
6
|
require 'my_john_deere_api/errors/unsupported_environment_error'
|
6
7
|
end
|
@@ -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 NotYetImplementedError < StandardError
|
8
|
+
def initialize(message = 'This is not yet implemented. View README to help make this gem better!')
|
9
|
+
super
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -15,5 +15,19 @@ module MyJohnDeereApi::Request
|
|
15
15
|
def model
|
16
16
|
MyJohnDeereApi::Model::Flag
|
17
17
|
end
|
18
|
+
|
19
|
+
##
|
20
|
+
# Create a new flag (NOT YET IMPLEMENTED)
|
21
|
+
|
22
|
+
def create(attributes)
|
23
|
+
raise NotImplementedError
|
24
|
+
end
|
25
|
+
|
26
|
+
##
|
27
|
+
# Retrieve an flag from JD (NOT YET IMPLEMENTED)
|
28
|
+
|
29
|
+
def find(asset_id)
|
30
|
+
raise NotImplementedError
|
31
|
+
end
|
18
32
|
end
|
19
33
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'support/helper'
|
2
|
+
|
3
|
+
describe 'MyJohnDeereApi::NotYetImplementedError' do
|
4
|
+
it 'inherits from StandardError' do
|
5
|
+
error = MyJohnDeereApi::NotYetImplementedError.new
|
6
|
+
assert_kind_of StandardError, error
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'has a default message' do
|
10
|
+
error = MyJohnDeereApi::NotYetImplementedError.new
|
11
|
+
assert_includes error.message, 'This is not yet implemented. View README to help make this gem better!'
|
12
|
+
end
|
13
|
+
end
|
@@ -57,6 +57,18 @@ describe 'MyJohnDeereApi::Request::Collection::Flags' do
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
+
describe '#create(attributes)' do
|
61
|
+
it 'raises an error, not yet implemented' do
|
62
|
+
assert_raises(NotImplementedError) { collection.create({}) }
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe '#find(id)' do
|
67
|
+
it 'raises an error, not yet implemented' do
|
68
|
+
assert_raises(NotImplementedError) { collection.find(123) }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
60
72
|
describe 'results' do
|
61
73
|
let(:flag_geometries) do
|
62
74
|
contents = File.read('test/support/vcr/get_flags.yml')
|
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.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jaime Bellmyer
|
@@ -109,6 +109,7 @@ files:
|
|
109
109
|
- lib/my_john_deere_api/errors.rb
|
110
110
|
- lib/my_john_deere_api/errors/access_token_error.rb
|
111
111
|
- lib/my_john_deere_api/errors/invalid_record_error.rb
|
112
|
+
- lib/my_john_deere_api/errors/not_yet_implemented_error.rb
|
112
113
|
- lib/my_john_deere_api/errors/type_mismatch_error.rb
|
113
114
|
- lib/my_john_deere_api/errors/unsupported_environment_error.rb
|
114
115
|
- lib/my_john_deere_api/helpers.rb
|
@@ -151,6 +152,7 @@ files:
|
|
151
152
|
- test/lib/my_john_deere_api/consumer_test.rb
|
152
153
|
- test/lib/my_john_deere_api/errors/access_token_error_test.rb
|
153
154
|
- test/lib/my_john_deere_api/errors/invalid_record_error_test.rb
|
155
|
+
- test/lib/my_john_deere_api/errors/not_yet_implemented_error_test.rb
|
154
156
|
- test/lib/my_john_deere_api/errors/type_mismatch_error_test.rb
|
155
157
|
- test/lib/my_john_deere_api/errors/unsupported_environment_error_test.rb
|
156
158
|
- test/lib/my_john_deere_api/errors_test.rb
|