Exception: Recurly::API::ResponseError
- Inherits:
-
Error
- Object
- StandardError
- Error
- Recurly::API::ResponseError
show all
- Defined in:
- lib/recurly/api/errors.rb
Overview
The superclass to all errors that occur when making an API request.
Instance Attribute Summary (collapse)
Instance Method Summary
(collapse)
Methods inherited from Error
#set_message
Constructor Details
- (ResponseError) initialize(request, response)
A new instance of ResponseError
10
11
12
|
# File 'lib/recurly/api/errors.rb', line 10
def initialize request, response
@request, @response = request, response
end
|
Instance Attribute Details
- (Object) request
Returns the value of attribute request
7
8
9
|
# File 'lib/recurly/api/errors.rb', line 7
def request
@request
end
|
- (Object) response
Returns the value of attribute response
8
9
10
|
# File 'lib/recurly/api/errors.rb', line 8
def response
@response
end
|
Instance Method Details
- (Object) code
14
15
16
|
# File 'lib/recurly/api/errors.rb', line 14
def code
response.code.to_i if response
end
|
- (Object) description
33
34
35
|
# File 'lib/recurly/api/errors.rb', line 33
def description
xml and xml.root and xml.text '/error/description'
end
|
- (Object) details
37
38
39
|
# File 'lib/recurly/api/errors.rb', line 37
def details
xml and xml.root and xml.text '/error/details'
end
|
- (Object) symbol
29
30
31
|
# File 'lib/recurly/api/errors.rb', line 29
def symbol
xml and xml.root and xml.text '/error/symbol'
end
|
- (Object) to_s
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/recurly/api/errors.rb', line 18
def to_s
if description
return CGI.unescapeHTML [description, details].compact.join(' ')
end
return super unless code
"%d %s (%s %s)" % [
code, http_error, request.method, API.base_uri + request.path
]
end
|