Class: Ecertic::Response

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http_response) ⇒ Response

Returns a new instance of Response.



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

def initialize(http_response)
  @http_response = http_response
end

Instance Attribute Details

#http_responseObject (readonly)

Returns the value of attribute http_response.



5
6
7
# File 'lib/ecertic/response.rb', line 5

def http_response
  @http_response
end

Class Method Details

.from_faraday_response(faraday_response) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/ecertic/response.rb', line 27

def self.from_faraday_response(faraday_response)
  http_response = {
    body: faraday_response.body,
    raw_body: faraday_response.env[:raw_body],
    headers: faraday_response.headers,
    status: faraday_response.status,
  }
  new(http_response)
end

Instance Method Details

#bodyObject



11
12
13
# File 'lib/ecertic/response.rb', line 11

def body
  http_response[:body]
end

#headersObject



19
20
21
# File 'lib/ecertic/response.rb', line 19

def headers
  http_response[:headers]
end

#raw_bodyObject



15
16
17
# File 'lib/ecertic/response.rb', line 15

def raw_body
  http_response[:raw_body]
end

#statusObject



23
24
25
# File 'lib/ecertic/response.rb', line 23

def status
  http_response[:status]
end