Class: Esignatur::Api::Response
- Inherits:
-
Object
- Object
- Esignatur::Api::Response
show all
- Defined in:
- lib/esignatur/api/response.rb
Overview
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(original_response, request:) ⇒ Response
Returns a new instance of Response.
11
12
13
14
|
# File 'lib/esignatur/api/response.rb', line 11
def initialize(original_response, request:)
@original_response = original_response
@request = request
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
43
44
45
|
# File 'lib/esignatur/api/response.rb', line 43
def method_missing(method_name, *args)
original_respond_to?(method_name, *args) ? original_response.public_send(method_name, *args) : super
end
|
Instance Attribute Details
#request ⇒ Object
Returns the value of attribute request.
9
10
11
|
# File 'lib/esignatur/api/response.rb', line 9
def request
@request
end
|
Instance Method Details
#body ⇒ Object
16
17
18
|
# File 'lib/esignatur/api/response.rb', line 16
def body
original_response.body
end
|
#failed? ⇒ Boolean
32
33
34
|
# File 'lib/esignatur/api/response.rb', line 32
def failed?
!success?
end
|
24
25
26
|
# File 'lib/esignatur/api/response.rb', line 24
def
original_response.
end
|
#json_body ⇒ Object
36
37
38
39
40
41
|
# File 'lib/esignatur/api/response.rb', line 36
def json_body
JSON.parse(body)
rescue JSON::ParserError => error
error.extend(Esignatur::ParsingError)
raise error
end
|
#respond_to_missing?(method_name, *args) ⇒ Boolean
47
48
49
|
# File 'lib/esignatur/api/response.rb', line 47
def respond_to_missing?(method_name, *args)
original_respond_to?(method_name, *args) || super
end
|
#status_code ⇒ Object
20
21
22
|
# File 'lib/esignatur/api/response.rb', line 20
def status_code
original_response.status
end
|
#success? ⇒ Boolean
28
29
30
|
# File 'lib/esignatur/api/response.rb', line 28
def success?
original_response.success?
end
|