class Seiya::Response

Public Class Methods

new(resp) click to toggle source
# File lib/seiya/response.rb, line 3
def initialize(resp)
  @resp = resp
end

Public Instance Methods

body() click to toggle source
# File lib/seiya/response.rb, line 19
def body
  @resp.body
end
doc() click to toggle source
# File lib/seiya/response.rb, line 23
def doc
  begin
    return @doc unless @doc.nil?
    @doc = Nokogiri::HTML body
    @has_doc = true
  rescue
    @has_doc = false
  end
end
has_doc?() click to toggle source
# File lib/seiya/response.rb, line 43
def has_doc?
  doc
  !!@has_doc
end
has_json?() click to toggle source
# File lib/seiya/response.rb, line 48
def has_json?
  json
  !!@has_json
end
header() click to toggle source
# File lib/seiya/response.rb, line 11
def header
  @resp.header
end
headers() click to toggle source
# File lib/seiya/response.rb, line 15
def headers
  @resp.headers
end
json() click to toggle source
# File lib/seiya/response.rb, line 33
def json
  begin
    return @json unless @json.nil?
    @json = JSON.parse body
    @has_json = true
  rescue
    @has_json = false
  end
end
url() click to toggle source
# File lib/seiya/response.rb, line 7
def url
  @resp.header.request_uri.to_s
end