Exception: DwollaV2::Error
- Inherits:
-
StandardError
- Object
- StandardError
- DwollaV2::Error
show all
- Extended by:
- Forwardable
- Defined in:
- lib/dwolla_v2/error.rb
Direct Known Subclasses
AccessDeniedError, BadRequestError, ConflictError, DuplicateResourceError, ExpiredAccessTokenError, ForbiddenError, InvalidAccessTokenError, InvalidAccountStatusError, InvalidApplicationStatusError, InvalidClientError, InvalidCredentialsError, InvalidGrantError, InvalidRequestError, InvalidResourceStateError, InvalidScopeError, InvalidScopesError, InvalidVersionError, MaxNumberOfResourcesError, MethodNotAllowedError, NotFoundError, RequestTimeoutError, ServerError, TemporarilyUnavailableError, TooManyRequestsError, UnauthorizedClientError, UnsupportedGrantTypeError, UnsupportedResponseTypeError, ValidationError
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(response) ⇒ Error
Returns a new instance of Error.
19
20
21
|
# File 'lib/dwolla_v2/error.rb', line 19
def initialize response
@response = response
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
47
48
49
50
51
52
53
|
# File 'lib/dwolla_v2/error.rb', line 47
def method_missing method, *args, &block
if response_body.respond_to? method
response_body.public_send method, *args, &block
else
super
end
end
|
Class Method Details
.raise!(response) ⇒ Object
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/dwolla_v2/error.rb', line 8
def self.raise! response
unless response.respond_to? :body
response = turn_into_response(response)
end
if response.body.is_a?(Hash) && klass = error_class(response.body[:error] || response.body[:code])
raise klass, response, caller
else
raise self, response, caller
end
end
|
Instance Method Details
#==(other) ⇒ Object
43
44
45
|
# File 'lib/dwolla_v2/error.rb', line 43
def == other
super || response_body == other
end
|
23
24
25
26
27
28
29
|
# File 'lib/dwolla_v2/error.rb', line 23
def
if @response.respond_to? :response_headers
@response.
elsif @response.respond_to? :headers
@response.
end
end
|
#inspect ⇒ Object
63
64
65
|
# File 'lib/dwolla_v2/error.rb', line 63
def inspect
Util.pretty_inspect self.class.name, { status: status, headers: }, response_body
end
|
#is_a?(klass) ⇒ Boolean
35
36
37
|
# File 'lib/dwolla_v2/error.rb', line 35
def is_a? klass
super || response_body.is_a?(klass)
end
|
#kind_of?(klass) ⇒ Boolean
39
40
41
|
# File 'lib/dwolla_v2/error.rb', line 39
def kind_of? klass
super || response_body.kind_of?(klass)
end
|
#message ⇒ Object
55
56
57
|
# File 'lib/dwolla_v2/error.rb', line 55
def message
to_s
end
|
#respond_to?(method, include_private = false) ⇒ Boolean
31
32
33
|
# File 'lib/dwolla_v2/error.rb', line 31
def respond_to? method, include_private = false
super || response_body.respond_to?(method)
end
|
#to_str ⇒ Object
59
60
61
|
# File 'lib/dwolla_v2/error.rb', line 59
def to_str
nil
end
|