ddy_remote_resource 1.0.0.rc3 → 1.0.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 81d5006754f703089ef4ce8518c6d76d436f99e0
4
- data.tar.gz: fe02833dc3ff9b27f2d737c22b0c7944600a39ad
3
+ metadata.gz: bccfcf5609907813018b9d01ee5c73c5e114a000
4
+ data.tar.gz: 459e6e2e2378a785bf9e7ed9248113c713d26429
5
5
  SHA512:
6
- metadata.gz: a7415dc3bc53bb4d491e0751bb27f231e066917f25069f4716480f6f307a0ee8111434770b166166aead5b1853dbdf7324f591ad1e27127896bf367080047a64
7
- data.tar.gz: 2b66490233d2656431bd44afb72ef1de4d86bbecb0cbe4e11e5fc60cfff61317c2255dedbeb8d5b43ac2deb29250de96cdd5f357a45ce5c33967ee0c4aec5e6b
6
+ metadata.gz: 71e2e8d6c00dfb31b27671c7d13c2057b90863f75bfd12e65986a53a9bb7240a1db85ef15a25357fbc4d808b35285973ad86b1921c85a311637b4ae162afb9d7
7
+ data.tar.gz: 9d87d498ff3d0585abadacee169f7419c44af52a16c2af24ca62275da16e1bb9c72bf2a2c4f379a524895150edac78c3f938ead42af4aa838917fe090e045e82
@@ -6,6 +6,7 @@ require 'typhoeus'
6
6
  require_relative 'extensions/ethon/easy/queryable'
7
7
 
8
8
  require 'remote_resource/version'
9
+ require 'remote_resource/errors'
9
10
  require 'remote_resource/base'
10
11
  require 'remote_resource/collection'
11
12
  require 'remote_resource/url_naming_determination'
@@ -21,91 +22,4 @@ require 'remote_resource/request'
21
22
  require 'remote_resource/util'
22
23
 
23
24
  module RemoteResource
24
- RemoteResourceError = Class.new(StandardError)
25
-
26
- IdMissingError = Class.new(RemoteResourceError)
27
-
28
- CollectionOptionKeyError = Class.new(RemoteResourceError)
29
-
30
- HTTPMethodUnsupported = Class.new(RemoteResourceError) # REST action
31
-
32
- class HTTPError < RemoteResourceError # HTTP errors
33
-
34
- def initialize(request, response)
35
- @request = request
36
- @response = response
37
- end
38
-
39
- def resource_klass
40
- @request.resource_klass
41
- end
42
-
43
- def http_action
44
- @request.http_action
45
- end
46
-
47
- def request_url
48
- @request.request_url
49
- end
50
-
51
- def request_query
52
- @request.query
53
- end
54
-
55
- def request_body
56
- @request.body # TODO: Filter sensitive information using: RemoteResource::Util.filter_params
57
- end
58
-
59
- def request_headers
60
- @request.headers
61
- end
62
-
63
- def response_code
64
- @response.response_code
65
- end
66
-
67
- def response_body
68
- @response.response_body # TODO: Filter sensitive information using: RemoteResource::Util.filter_params
69
- end
70
-
71
- def response_headers
72
- @response.response_headers
73
- end
74
-
75
- def to_s
76
- message = "HTTP request failed for #{resource_klass}"
77
- message << " with response_code=#{response_code}" if response_code.present?
78
- message << " with http_action=#{http_action}"
79
- message << " with request_url=#{request_url}"
80
- # message << " with request_query=#{request_query}" if request_query.present? # TODO: Test usability of error message whether to include this
81
- # message << " with request_body=#{request_body}" if request_body.present? # TODO: Test usability of error message whether to include this
82
- # message << " with response_body=#{response_body}" if response_body.present? # TODO: Test usability of error message whether to include this
83
- message
84
- end
85
- end
86
-
87
- HTTPRedirectionError = Class.new(HTTPError) # HTTP 3xx
88
- HTTPClientError = Class.new(HTTPError) # HTTP 4xx
89
- HTTPServerError = Class.new(HTTPError) # HTTP 5xx
90
-
91
- HTTPBadRequest = Class.new(HTTPClientError) # HTTP 400
92
- HTTPUnauthorized = Class.new(HTTPClientError) # HTTP 401
93
- HTTPForbidden = Class.new(HTTPClientError) # HTTP 403
94
- HTTPNotFound = Class.new(HTTPClientError) # HTTP 404
95
- HTTPMethodNotAllowed = Class.new(HTTPClientError) # HTTP 405
96
- HTTPNotAcceptable = Class.new(HTTPClientError) # HTTP 406
97
- HTTPRequestTimeout = Class.new(HTTPClientError) # HTTP 408
98
- HTTPConflict = Class.new(HTTPClientError) # HTTP 409
99
- HTTPGone = Class.new(HTTPClientError) # HTTP 410
100
- HTTPTeapot = Class.new(HTTPClientError) # HTTP 418
101
-
102
- NginxClientError = Class.new(HTTPClientError) # HTTP errors used in Nginx
103
-
104
- HTTPNoResponse = Class.new(NginxClientError) # HTTP 444
105
- HTTPRequestHeaderTooLarge = Class.new(NginxClientError) # HTTP 494
106
- HTTPCertError = Class.new(NginxClientError) # HTTP 495
107
- HTTPNoCert = Class.new(NginxClientError) # HTTP 496
108
- HTTPToHTTPS = Class.new(NginxClientError) # HTTP 497
109
- HTTPClientClosedRequest = Class.new(NginxClientError) # HTTP 499
110
-
111
25
  end
@@ -0,0 +1,88 @@
1
+ module RemoteResource
2
+ RemoteResourceError = Class.new(StandardError)
3
+
4
+ IdMissingError = Class.new(RemoteResourceError)
5
+
6
+ CollectionOptionKeyError = Class.new(RemoteResourceError)
7
+
8
+ HTTPMethodUnsupported = Class.new(RemoteResourceError) # REST action
9
+
10
+ class HTTPError < RemoteResourceError # HTTP errors
11
+
12
+ def initialize(request, response)
13
+ @request = request
14
+ @response = response
15
+ end
16
+
17
+ def resource_klass
18
+ @request.resource_klass
19
+ end
20
+
21
+ def http_action
22
+ @request.http_action
23
+ end
24
+
25
+ def request_url
26
+ @request.request_url
27
+ end
28
+
29
+ def request_query
30
+ @request.query
31
+ end
32
+
33
+ def request_body
34
+ @request.body # TODO: Filter sensitive information using: RemoteResource::Util.filter_params
35
+ end
36
+
37
+ def request_headers
38
+ @request.headers
39
+ end
40
+
41
+ def response_code
42
+ @response.response_code
43
+ end
44
+
45
+ def response_body
46
+ @response.response_body # TODO: Filter sensitive information using: RemoteResource::Util.filter_params
47
+ end
48
+
49
+ def response_headers
50
+ @response.response_headers
51
+ end
52
+
53
+ def to_s
54
+ message = "HTTP request failed for #{resource_klass}"
55
+ message << " with response_code=#{response_code}" if response_code.present?
56
+ message << " with http_action=#{http_action}"
57
+ message << " with request_url=#{request_url}"
58
+ # message << " with request_query=#{request_query}" if request_query.present? # TODO: Test usability of error message whether to include this
59
+ # message << " with request_body=#{request_body}" if request_body.present? # TODO: Test usability of error message whether to include this
60
+ # message << " with response_body=#{response_body}" if response_body.present? # TODO: Test usability of error message whether to include this
61
+ message
62
+ end
63
+ end
64
+
65
+ HTTPRedirectionError = Class.new(HTTPError) # HTTP 3xx
66
+ HTTPClientError = Class.new(HTTPError) # HTTP 4xx
67
+ HTTPServerError = Class.new(HTTPError) # HTTP 5xx
68
+
69
+ HTTPBadRequest = Class.new(HTTPClientError) # HTTP 400
70
+ HTTPUnauthorized = Class.new(HTTPClientError) # HTTP 401
71
+ HTTPForbidden = Class.new(HTTPClientError) # HTTP 403
72
+ HTTPNotFound = Class.new(HTTPClientError) # HTTP 404
73
+ HTTPMethodNotAllowed = Class.new(HTTPClientError) # HTTP 405
74
+ HTTPNotAcceptable = Class.new(HTTPClientError) # HTTP 406
75
+ HTTPRequestTimeout = Class.new(HTTPClientError) # HTTP 408
76
+ HTTPConflict = Class.new(HTTPClientError) # HTTP 409
77
+ HTTPGone = Class.new(HTTPClientError) # HTTP 410
78
+ HTTPTeapot = Class.new(HTTPClientError) # HTTP 418
79
+
80
+ NginxClientError = Class.new(HTTPClientError) # HTTP errors used in Nginx
81
+
82
+ HTTPNoResponse = Class.new(NginxClientError) # HTTP 444
83
+ HTTPRequestHeaderTooLarge = Class.new(NginxClientError) # HTTP 494
84
+ HTTPCertError = Class.new(NginxClientError) # HTTP 495
85
+ HTTPNoCert = Class.new(NginxClientError) # HTTP 496
86
+ HTTPToHTTPS = Class.new(NginxClientError) # HTTP 497
87
+ HTTPClientClosedRequest = Class.new(NginxClientError) # HTTP 499
88
+ end
@@ -1,3 +1,3 @@
1
1
  module RemoteResource
2
- VERSION = '1.0.0.rc3'.freeze
2
+ VERSION = '1.0.0.rc4'.freeze
3
3
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe RemoteResource::VERSION do
4
- it { is_expected.to eql '1.0.0.rc3' }
4
+ it { is_expected.to eql '1.0.0.rc4' }
5
5
  end
6
6
 
7
7
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ddy_remote_resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc3
4
+ version: 1.0.0.rc4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan van der Pas
@@ -235,6 +235,7 @@ files:
235
235
  - lib/remote_resource/collection.rb
236
236
  - lib/remote_resource/connection.rb
237
237
  - lib/remote_resource/connection_options.rb
238
+ - lib/remote_resource/errors.rb
238
239
  - lib/remote_resource/querying/finder_methods.rb
239
240
  - lib/remote_resource/querying/persistence_methods.rb
240
241
  - lib/remote_resource/request.rb