Class: EasybillRestClient::Response

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

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Response

Returns a new instance of Response.



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

def initialize(response)
  @response = response
end

Instance Method Details

#bodyObject



9
10
11
12
13
14
15
# File 'lib/easybill_rest_client/response.rb', line 9

def body
  body = extract_response_body(response)
  unless response.is_a?(Net::HTTPSuccess)
    raise ApiError, body.inspect
  end
  body && !body.empty? ? body : nil
end