class PushBot::Response

Attributes

error[R]
raw_response[R]

Public Class Methods

new() { || ... } click to toggle source
# File lib/push_bot/response.rb, line 7
def initialize
  @raw_response = yield
rescue => e
  @error = e
end

Public Instance Methods

error?() click to toggle source

Did the response complete with an error

# File lib/push_bot/response.rb, line 24
def error?
  defined?(@error) && @error
end
inspect() click to toggle source
# File lib/push_bot/response.rb, line 13
def inspect
  "#<#{self.class}:#{object_id} @success=#{success?} @json=#{json}>"
end
json() click to toggle source

The result of the request as a JSON Object

@return [Hash, Array] the JSON Object

# File lib/push_bot/response.rb, line 31
def json
  @json ||= body.present? ? JSON.parse(body) : {}
end