class Koala::HTTPService::Response

Attributes

body[R]
headers[R]
status[R]

Public Class Methods

new(status, body, headers) click to toggle source

Creates a new Response object, which standardizes the response received by Facebook for use within Koala.

   # File lib/koala/http_service/response.rb
 7 def initialize(status, body, headers)
 8   @status = status
 9   @body = body
10   @headers = headers
11 end

Public Instance Methods

data() click to toggle source
   # File lib/koala/http_service/response.rb
13 def data
14   # quirks_mode is needed because Facebook sometimes returns a raw true or false value --
15   # in Ruby 2.4 we can drop that.
16   @data ||= JSON.parse(body, quirks_mode: true) unless body.empty?
17 end