class FormStalker::Response

Constants

RAILS_HTTP_STATUS

Attributes

data[RW]
error[R]
status[R]

Public Class Methods

new(http_response) click to toggle source
# File lib/form_stalker/response.rb, line 59
def initialize(http_response)
  @http_response = http_response

  @status = RAILS_HTTP_STATUS[@http_response.code]

  @data = JSON.parse(@http_response.body) if @status == :ok

  parse_error
end

Public Instance Methods

ok?() click to toggle source
# File lib/form_stalker/response.rb, line 69
def ok?
  status == :ok && (error.nil? || error == '')
end