class AfTalk::Response

Constants

JSON_CONTENT
SUCCESS_STATUSES

Attributes

body[R]
error_message[R]
status[R]

Public Class Methods

new(response) click to toggle source
# File lib/aftalk/response.rb, line 8
def initialize(response)
  @status = response.status
  body = response.body

  if success?
    @body = body
  else
    @error_message = body
    @body = { error: body }
  end
end

Private Instance Methods

success?() click to toggle source
# File lib/aftalk/response.rb, line 22
def success?
  SUCCESS_STATUSES.include?(status)
end