class RestWorld::Response

a class to represent a response from the server

Public Class Methods

new(resp) click to toggle source
# File lib/blix/rest/cucumber/world.rb, line 17
def initialize(resp)
  @resp = resp
  if @resp.header['Content-Type'] == 'application/json'
    begin
      @h = MultiJson.load(@resp.body) || {}
    rescue Exception => e
      puts 'INVALID RESPONSE BODY=>' + @resp.body
      raise
    end
  else
    @h = { 'html' => @resp.body }
  end

  # get_ids_from_hash
end

Public Instance Methods

[](k) click to toggle source
# File lib/blix/rest/cucumber/world.rb, line 33
def [](k)
  @h[k]
end
body() click to toggle source
# File lib/blix/rest/cucumber/world.rb, line 37
def body
  @resp.body
end
content_type() click to toggle source
# File lib/blix/rest/cucumber/world.rb, line 57
def content_type
  header['Content-Type']
end
data() click to toggle source
# File lib/blix/rest/cucumber/world.rb, line 41
def data
  @h['data']
end
error() click to toggle source
# File lib/blix/rest/cucumber/world.rb, line 45
def error
  @h['error']
end
header() click to toggle source
# File lib/blix/rest/cucumber/world.rb, line 53
def header
  @resp.header || {}
end
inspect() click to toggle source
# File lib/blix/rest/cucumber/world.rb, line 61
def inspect
  @resp.inspect
end
status() click to toggle source
# File lib/blix/rest/cucumber/world.rb, line 49
def status
  @resp.status.to_i
end