my_john_deere_api 2.3.4 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +111 -1
  3. data/lib/my_john_deere_api.rb +1 -0
  4. data/lib/my_john_deere_api/client.rb +13 -3
  5. data/lib/my_john_deere_api/net_http_retry.rb +4 -0
  6. data/lib/my_john_deere_api/net_http_retry/decorator.rb +62 -0
  7. data/lib/my_john_deere_api/net_http_retry/invalid_response_error.rb +23 -0
  8. data/lib/my_john_deere_api/net_http_retry/max_retries_exceeded_error.rb +20 -0
  9. data/lib/my_john_deere_api/version.rb +1 -1
  10. data/test/lib/my_john_deere_api/client_test.rb +20 -3
  11. data/test/lib/my_john_deere_api/net_http_retry/decorator_test.rb +208 -0
  12. data/test/lib/my_john_deere_api/net_http_retry/invalid_response_error_test.rb +19 -0
  13. data/test/lib/my_john_deere_api/net_http_retry/max_retries_exceeded_error_test.rb +13 -0
  14. data/test/support/helper.rb +1 -0
  15. data/test/support/vcr/accessor/delete_failed.yml +327 -0
  16. data/test/support/vcr/accessor/delete_invalid.yml +39 -0
  17. data/test/support/vcr/accessor/delete_max_failed.yml +615 -0
  18. data/test/support/vcr/accessor/delete_retry.yml +191 -0
  19. data/test/support/vcr/accessor/delete_retry_too_soon.yml +191 -0
  20. data/test/support/vcr/accessor/get_failed.yml +390 -0
  21. data/test/support/vcr/accessor/get_invalid.yml +46 -0
  22. data/test/support/vcr/accessor/get_max_failed.yml +734 -0
  23. data/test/support/vcr/accessor/get_retry.yml +226 -0
  24. data/test/support/vcr/accessor/get_retry_too_soon.yml +226 -0
  25. data/test/support/vcr/accessor/post_failed.yml +417 -0
  26. data/test/support/vcr/accessor/post_invalid.yml +49 -0
  27. data/test/support/vcr/accessor/post_max_failed.yml +785 -0
  28. data/test/support/vcr/accessor/post_retry.yml +241 -0
  29. data/test/support/vcr/accessor/post_retry_too_soon.yml +241 -0
  30. data/test/support/vcr/accessor/put_failed.yml +372 -0
  31. data/test/support/vcr/accessor/put_invalid.yml +44 -0
  32. data/test/support/vcr/accessor/put_max_failed.yml +700 -0
  33. data/test/support/vcr/accessor/put_retry.yml +216 -0
  34. data/test/support/vcr/accessor/put_retry_too_soon.yml +216 -0
  35. metadata +30 -3
@@ -0,0 +1,226 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://sandboxapi.deere.com/platform/
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-0000000000000000000000000000000000000000",
18
+ oauth_nonce="000000000000000000000000000000000000000000", oauth_signature="0000000000000000000000000000",
19
+ oauth_signature_method="HMAC-SHA1", oauth_timestamp="1581334172", oauth_version="1.0"
20
+ response:
21
+ status:
22
+ code: 429
23
+ message: Too Many Requests
24
+ headers:
25
+ Date:
26
+ - Mon, 10 Feb 2020 17:29:28 GMT
27
+ Content-Type:
28
+ - application/vnd.deere.axiom.v3+json;charset=UTF-8
29
+ X-Deere-Handling-Server:
30
+ - ip-10-214-44-28
31
+ X-Frame-Options:
32
+ - SAMEORIGIN
33
+ X-Deere-Elapsed-Ms:
34
+ - '11'
35
+ Cache-Control:
36
+ - no-store
37
+ Content-Language:
38
+ - en-US
39
+ Transfer-Encoding:
40
+ - chunked
41
+ Retry-After:
42
+ - '13'
43
+ body:
44
+ encoding: ASCII-8BIT
45
+ string: ''
46
+ http_version:
47
+ recorded_at: Mon, 10 Feb 2020 17:29:28 GMT
48
+ - request:
49
+ method: get
50
+ uri: https://sandboxapi.deere.com/platform/
51
+ body:
52
+ encoding: US-ASCII
53
+ string: ''
54
+ headers:
55
+ Accept:
56
+ - application/vnd.deere.axiom.v3+json
57
+ Accept-Encoding:
58
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
59
+ User-Agent:
60
+ - OAuth gem v0.5.4
61
+ Authorization:
62
+ - OAuth oauth_consumer_key="johndeere-0000000000000000000000000000000000000000",
63
+ oauth_nonce="000000000000000000000000000000000000000000", oauth_signature="0000000000000000000000000000",
64
+ oauth_signature_method="HMAC-SHA1", oauth_timestamp="1581334172", oauth_version="1.0"
65
+ response:
66
+ status:
67
+ code: 429
68
+ message: Too Many Requests
69
+ headers:
70
+ Date:
71
+ - Mon, 10 Feb 2020 17:29:28 GMT
72
+ Content-Type:
73
+ - application/vnd.deere.axiom.v3+json;charset=UTF-8
74
+ X-Deere-Handling-Server:
75
+ - ip-10-214-44-28
76
+ X-Frame-Options:
77
+ - SAMEORIGIN
78
+ X-Deere-Elapsed-Ms:
79
+ - '11'
80
+ Cache-Control:
81
+ - no-store
82
+ Content-Language:
83
+ - en-US
84
+ Transfer-Encoding:
85
+ - chunked
86
+ Retry-After:
87
+ - '17'
88
+ body:
89
+ encoding: ASCII-8BIT
90
+ string: ''
91
+ http_version:
92
+ recorded_at: Mon, 10 Feb 2020 17:29:28 GMT
93
+ - request:
94
+ method: get
95
+ uri: https://sandboxapi.deere.com/platform/
96
+ body:
97
+ encoding: US-ASCII
98
+ string: ''
99
+ headers:
100
+ Accept:
101
+ - application/vnd.deere.axiom.v3+json
102
+ Accept-Encoding:
103
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
104
+ User-Agent:
105
+ - OAuth gem v0.5.4
106
+ Authorization:
107
+ - OAuth oauth_consumer_key="johndeere-0000000000000000000000000000000000000000",
108
+ oauth_nonce="000000000000000000000000000000000000000000", oauth_signature="0000000000000000000000000000",
109
+ oauth_signature_method="HMAC-SHA1", oauth_timestamp="1581334172", oauth_version="1.0"
110
+ response:
111
+ status:
112
+ code: 503
113
+ message: Service Unavailable
114
+ headers:
115
+ Date:
116
+ - Mon, 10 Feb 2020 17:29:28 GMT
117
+ Content-Type:
118
+ - application/vnd.deere.axiom.v3+json;charset=UTF-8
119
+ X-Deere-Handling-Server:
120
+ - ip-10-214-44-28
121
+ X-Frame-Options:
122
+ - SAMEORIGIN
123
+ X-Deere-Elapsed-Ms:
124
+ - '11'
125
+ Cache-Control:
126
+ - no-store
127
+ Content-Language:
128
+ - en-US
129
+ Transfer-Encoding:
130
+ - chunked
131
+ Retry-After:
132
+ - '19'
133
+ body:
134
+ encoding: ASCII-8BIT
135
+ string: ''
136
+ http_version:
137
+ recorded_at: Mon, 10 Feb 2020 17:29:28 GMT
138
+ - request:
139
+ method: get
140
+ uri: https://sandboxapi.deere.com/platform/
141
+ body:
142
+ encoding: US-ASCII
143
+ string: ''
144
+ headers:
145
+ Accept:
146
+ - application/vnd.deere.axiom.v3+json
147
+ Accept-Encoding:
148
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
149
+ User-Agent:
150
+ - OAuth gem v0.5.4
151
+ Authorization:
152
+ - OAuth oauth_consumer_key="johndeere-0000000000000000000000000000000000000000",
153
+ oauth_nonce="000000000000000000000000000000000000000000", oauth_signature="0000000000000000000000000000",
154
+ oauth_signature_method="HMAC-SHA1", oauth_timestamp="1581334172", oauth_version="1.0"
155
+ response:
156
+ status:
157
+ code: 503
158
+ message: Service Unavailable
159
+ headers:
160
+ Date:
161
+ - Mon, 10 Feb 2020 17:29:28 GMT
162
+ Content-Type:
163
+ - application/vnd.deere.axiom.v3+json;charset=UTF-8
164
+ X-Deere-Handling-Server:
165
+ - ip-10-214-44-28
166
+ X-Frame-Options:
167
+ - SAMEORIGIN
168
+ X-Deere-Elapsed-Ms:
169
+ - '11'
170
+ Cache-Control:
171
+ - no-store
172
+ Content-Language:
173
+ - en-US
174
+ Transfer-Encoding:
175
+ - chunked
176
+ Retry-After:
177
+ - '23'
178
+ body:
179
+ encoding: ASCII-8BIT
180
+ string: ''
181
+ http_version:
182
+ recorded_at: Mon, 10 Feb 2020 17:29:28 GMT
183
+ - request:
184
+ method: get
185
+ uri: https://sandboxapi.deere.com/platform/
186
+ body:
187
+ encoding: US-ASCII
188
+ string: ''
189
+ headers:
190
+ Accept:
191
+ - application/vnd.deere.axiom.v3+json
192
+ Accept-Encoding:
193
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
194
+ User-Agent:
195
+ - OAuth gem v0.5.4
196
+ Authorization:
197
+ - OAuth oauth_consumer_key="johndeere-0000000000000000000000000000000000000000",
198
+ oauth_nonce="000000000000000000000000000000000000000000", oauth_signature="0000000000000000000000000000",
199
+ oauth_signature_method="HMAC-SHA1", oauth_timestamp="1581334172", oauth_version="1.0"
200
+ response:
201
+ status:
202
+ code: 200
203
+ message: OK
204
+ headers:
205
+ Date:
206
+ - Mon, 10 Feb 2020 17:29:28 GMT
207
+ Content-Type:
208
+ - application/vnd.deere.axiom.v3+json;charset=UTF-8
209
+ X-Deere-Handling-Server:
210
+ - ip-10-214-44-28
211
+ X-Frame-Options:
212
+ - SAMEORIGIN
213
+ X-Deere-Elapsed-Ms:
214
+ - '11'
215
+ Cache-Control:
216
+ - no-store
217
+ Content-Language:
218
+ - en-US
219
+ Transfer-Encoding:
220
+ - chunked
221
+ body:
222
+ encoding: ASCII-8BIT
223
+ string: '{"@type":"ApiCatalog","links":[{"@type":"Link","rel":"oauthRequestToken","uri":"https://sandboxapi.deere.com/platform/oauth/request_token"},{"@type":"Link","rel":"oauthAuthorizeRequestToken","uri":"https://my.deere.com/consentToUseOfData?oauth_token={token}"},{"@type":"Link","rel":"oauthAccessToken","uri":"https://sandboxapi.deere.com/platform/oauth/access_token"},{"@type":"Link","rel":"agencies","uri":"https://sandboxapi.deere.com/platform/agencies"}]}'
224
+ http_version:
225
+ recorded_at: Mon, 10 Feb 2020 17:29:28 GMT
226
+ recorded_with: VCR 5.0.0
@@ -0,0 +1,226 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://sandboxapi.deere.com/platform/
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-0000000000000000000000000000000000000000",
18
+ oauth_nonce="000000000000000000000000000000000000000000", oauth_signature="0000000000000000000000000000",
19
+ oauth_signature_method="HMAC-SHA1", oauth_timestamp="1581334172", oauth_version="1.0"
20
+ response:
21
+ status:
22
+ code: 429
23
+ message: Too Many Requests
24
+ headers:
25
+ Date:
26
+ - Mon, 10 Feb 2020 17:29:28 GMT
27
+ Content-Type:
28
+ - application/vnd.deere.axiom.v3+json;charset=UTF-8
29
+ X-Deere-Handling-Server:
30
+ - ip-10-214-44-28
31
+ X-Frame-Options:
32
+ - SAMEORIGIN
33
+ X-Deere-Elapsed-Ms:
34
+ - '11'
35
+ Cache-Control:
36
+ - no-store
37
+ Content-Language:
38
+ - en-US
39
+ Transfer-Encoding:
40
+ - chunked
41
+ Retry-After:
42
+ - '0'
43
+ body:
44
+ encoding: ASCII-8BIT
45
+ string: ''
46
+ http_version:
47
+ recorded_at: Mon, 10 Feb 2020 17:29:28 GMT
48
+ - request:
49
+ method: get
50
+ uri: https://sandboxapi.deere.com/platform/
51
+ body:
52
+ encoding: US-ASCII
53
+ string: ''
54
+ headers:
55
+ Accept:
56
+ - application/vnd.deere.axiom.v3+json
57
+ Accept-Encoding:
58
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
59
+ User-Agent:
60
+ - OAuth gem v0.5.4
61
+ Authorization:
62
+ - OAuth oauth_consumer_key="johndeere-0000000000000000000000000000000000000000",
63
+ oauth_nonce="000000000000000000000000000000000000000000", oauth_signature="0000000000000000000000000000",
64
+ oauth_signature_method="HMAC-SHA1", oauth_timestamp="1581334172", oauth_version="1.0"
65
+ response:
66
+ status:
67
+ code: 429
68
+ message: Too Many Requests
69
+ headers:
70
+ Date:
71
+ - Mon, 10 Feb 2020 17:29:28 GMT
72
+ Content-Type:
73
+ - application/vnd.deere.axiom.v3+json;charset=UTF-8
74
+ X-Deere-Handling-Server:
75
+ - ip-10-214-44-28
76
+ X-Frame-Options:
77
+ - SAMEORIGIN
78
+ X-Deere-Elapsed-Ms:
79
+ - '11'
80
+ Cache-Control:
81
+ - no-store
82
+ Content-Language:
83
+ - en-US
84
+ Transfer-Encoding:
85
+ - chunked
86
+ Retry-After:
87
+ - '1'
88
+ body:
89
+ encoding: ASCII-8BIT
90
+ string: ''
91
+ http_version:
92
+ recorded_at: Mon, 10 Feb 2020 17:29:28 GMT
93
+ - request:
94
+ method: get
95
+ uri: https://sandboxapi.deere.com/platform/
96
+ body:
97
+ encoding: US-ASCII
98
+ string: ''
99
+ headers:
100
+ Accept:
101
+ - application/vnd.deere.axiom.v3+json
102
+ Accept-Encoding:
103
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
104
+ User-Agent:
105
+ - OAuth gem v0.5.4
106
+ Authorization:
107
+ - OAuth oauth_consumer_key="johndeere-0000000000000000000000000000000000000000",
108
+ oauth_nonce="000000000000000000000000000000000000000000", oauth_signature="0000000000000000000000000000",
109
+ oauth_signature_method="HMAC-SHA1", oauth_timestamp="1581334172", oauth_version="1.0"
110
+ response:
111
+ status:
112
+ code: 503
113
+ message: Service Unavailable
114
+ headers:
115
+ Date:
116
+ - Mon, 10 Feb 2020 17:29:28 GMT
117
+ Content-Type:
118
+ - application/vnd.deere.axiom.v3+json;charset=UTF-8
119
+ X-Deere-Handling-Server:
120
+ - ip-10-214-44-28
121
+ X-Frame-Options:
122
+ - SAMEORIGIN
123
+ X-Deere-Elapsed-Ms:
124
+ - '11'
125
+ Cache-Control:
126
+ - no-store
127
+ Content-Language:
128
+ - en-US
129
+ Transfer-Encoding:
130
+ - chunked
131
+ Retry-After:
132
+ - '2'
133
+ body:
134
+ encoding: ASCII-8BIT
135
+ string: ''
136
+ http_version:
137
+ recorded_at: Mon, 10 Feb 2020 17:29:28 GMT
138
+ - request:
139
+ method: get
140
+ uri: https://sandboxapi.deere.com/platform/
141
+ body:
142
+ encoding: US-ASCII
143
+ string: ''
144
+ headers:
145
+ Accept:
146
+ - application/vnd.deere.axiom.v3+json
147
+ Accept-Encoding:
148
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
149
+ User-Agent:
150
+ - OAuth gem v0.5.4
151
+ Authorization:
152
+ - OAuth oauth_consumer_key="johndeere-0000000000000000000000000000000000000000",
153
+ oauth_nonce="000000000000000000000000000000000000000000", oauth_signature="0000000000000000000000000000",
154
+ oauth_signature_method="HMAC-SHA1", oauth_timestamp="1581334172", oauth_version="1.0"
155
+ response:
156
+ status:
157
+ code: 503
158
+ message: Service Unavailable
159
+ headers:
160
+ Date:
161
+ - Mon, 10 Feb 2020 17:29:28 GMT
162
+ Content-Type:
163
+ - application/vnd.deere.axiom.v3+json;charset=UTF-8
164
+ X-Deere-Handling-Server:
165
+ - ip-10-214-44-28
166
+ X-Frame-Options:
167
+ - SAMEORIGIN
168
+ X-Deere-Elapsed-Ms:
169
+ - '11'
170
+ Cache-Control:
171
+ - no-store
172
+ Content-Language:
173
+ - en-US
174
+ Transfer-Encoding:
175
+ - chunked
176
+ Retry-After:
177
+ - '3'
178
+ body:
179
+ encoding: ASCII-8BIT
180
+ string: ''
181
+ http_version:
182
+ recorded_at: Mon, 10 Feb 2020 17:29:28 GMT
183
+ - request:
184
+ method: get
185
+ uri: https://sandboxapi.deere.com/platform/
186
+ body:
187
+ encoding: US-ASCII
188
+ string: ''
189
+ headers:
190
+ Accept:
191
+ - application/vnd.deere.axiom.v3+json
192
+ Accept-Encoding:
193
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
194
+ User-Agent:
195
+ - OAuth gem v0.5.4
196
+ Authorization:
197
+ - OAuth oauth_consumer_key="johndeere-0000000000000000000000000000000000000000",
198
+ oauth_nonce="000000000000000000000000000000000000000000", oauth_signature="0000000000000000000000000000",
199
+ oauth_signature_method="HMAC-SHA1", oauth_timestamp="1581334172", oauth_version="1.0"
200
+ response:
201
+ status:
202
+ code: 200
203
+ message: OK
204
+ headers:
205
+ Date:
206
+ - Mon, 10 Feb 2020 17:29:28 GMT
207
+ Content-Type:
208
+ - application/vnd.deere.axiom.v3+json;charset=UTF-8
209
+ X-Deere-Handling-Server:
210
+ - ip-10-214-44-28
211
+ X-Frame-Options:
212
+ - SAMEORIGIN
213
+ X-Deere-Elapsed-Ms:
214
+ - '11'
215
+ Cache-Control:
216
+ - no-store
217
+ Content-Language:
218
+ - en-US
219
+ Transfer-Encoding:
220
+ - chunked
221
+ body:
222
+ encoding: ASCII-8BIT
223
+ string: '{"@type":"ApiCatalog","links":[{"@type":"Link","rel":"oauthRequestToken","uri":"https://sandboxapi.deere.com/platform/oauth/request_token"},{"@type":"Link","rel":"oauthAuthorizeRequestToken","uri":"https://my.deere.com/consentToUseOfData?oauth_token={token}"},{"@type":"Link","rel":"oauthAccessToken","uri":"https://sandboxapi.deere.com/platform/oauth/access_token"},{"@type":"Link","rel":"agencies","uri":"https://sandboxapi.deere.com/platform/agencies"}]}'
224
+ http_version:
225
+ recorded_at: Mon, 10 Feb 2020 17:29:28 GMT
226
+ recorded_with: VCR 5.0.0