class Evostream::Responses

Create a response

Attributes

data[R]
evostream[RW]
message[R]
status[R]

Public Class Methods

new(evostream_response) click to toggle source
# File lib/evostream/event/response/response.rb, line 12
def initialize(evostream_response)
  @evostream = JSON.parse(evostream_response.body)

  @status = define_status
  @message = define_message
  @data = @evostream['data'] if @status.eql?(200)
end

Private Instance Methods

define_message() click to toggle source
# File lib/evostream/event/response/response.rb, line 39
def define_message
  if @status.eql?(500)
    'Error with EvoStream server.'
  else
    'Object was successfully created/updated.'
  end
end
define_status() click to toggle source
# File lib/evostream/event/response/response.rb, line 32
def define_status
  case @evostream['status']
  when 'FAIL' then 500
  when 'SUCCESS' then 200
  end
end