class Algorithmia::Response

Attributes

response[R]

Public Class Methods

new(response, output_type) click to toggle source
# File lib/algorithmia/response.rb, line 7
def initialize(response, output_type)
  @response = response
  @output_type = output_type
end

Public Instance Methods

alerts() click to toggle source
# File lib/algorithmia/response.rb, line 54
def alerts
  if @output_type == 'raw'
    nil
  else
    metadata["alerts"]
  end
end
content_type() click to toggle source
# File lib/algorithmia/response.rb, line 38
def content_type
  if @output_type == 'raw'
    nil
  else
    metadata["content_type"]
  end
end
duration() click to toggle source
# File lib/algorithmia/response.rb, line 30
def duration
  if @output_type == 'raw'
    nil
  else
    metadata["duration"]
  end
end
metadata() click to toggle source
# File lib/algorithmia/response.rb, line 22
def metadata
  if @output_type == 'raw'
    nil
  else
    @response["metadata"]
  end
end
result() click to toggle source
# File lib/algorithmia/response.rb, line 12
def result
  if @output_type == 'raw'
    @response
  elsif content_type == 'binary'
    Base64.decode64(@response["result"])
  else
    @response["result"]
  end
end
stdout() click to toggle source
# File lib/algorithmia/response.rb, line 46
def stdout
  if @output_type == 'raw'
    nil
  else
    metadata["stdout"]
  end
end