Class: Esignatur::Api::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/esignatur/api/response.rb

Overview

api response wrapper

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(original_response) ⇒ Response

Returns a new instance of Response.



9
10
11
# File 'lib/esignatur/api/response.rb', line 9

def initialize(original_response)
  @original_response = original_response
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object



21
22
23
# File 'lib/esignatur/api/response.rb', line 21

def method_missing(method_name, *args)
  original_respond_to?(method_name, *args) ? original_response.public_send(method_name, *args) : super
end

Instance Attribute Details

#original_responseObject (readonly)

Returns the value of attribute original_response.



7
8
9
# File 'lib/esignatur/api/response.rb', line 7

def original_response
  @original_response
end

Instance Method Details

#bodyObject



13
14
15
# File 'lib/esignatur/api/response.rb', line 13

def body
  original_response.body
end

#json_bodyObject



17
18
19
# File 'lib/esignatur/api/response.rb', line 17

def json_body
  JSON.parse(body)
end

#respond_to_missing?(method_name, *args) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/esignatur/api/response.rb', line 25

def respond_to_missing?(method_name, *args)
  original_respond_to?(method_name, *args) || super
end