Class: Esputnik::Response

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

Instance Method Summary collapse

Constructor Details

#initialize(faraday_response) ⇒ Response

Returns a new instance of Response.



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

def initialize(faraday_response)
  @raw_response = faraday_response
end

Instance Method Details

#jsonObject



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

def json
  JSON.parse(@raw_response.body) if @raw_response.body.present?
end

#raw_bodyObject



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

def raw_body
  @raw_response.body
end

#success?Boolean

Returns:

  • (Boolean)


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

def success?
  @raw_response.success?
end