module PhantomProxy::Http

Public Class Methods

NextApi(data="Not Found", content_type="text/plain") click to toggle source
# File lib/phantom_proxy/helper/http.rb, line 33
def self.NextApi(data="Not Found", content_type="text/plain")
  Response(600, data, content_type)
end
OK(data="", content_type="text/plain") click to toggle source
# File lib/phantom_proxy/helper/http.rb, line 36
def self.OK(data="", content_type="text/plain")
  Response(200, data, content_type)
end
OK_no_data(data="", content_type="text/plain") click to toggle source
# File lib/phantom_proxy/helper/http.rb, line 42
def self.OK_no_data(data="", content_type="text/plain")
  [204, {}, ""]
end
Response(status_code=200, data="", content_type="text/plain") click to toggle source
# File lib/phantom_proxy/helper/http.rb, line 39
def self.Response(status_code=200, data="", content_type="text/plain")
  [status_code, {"Content-Type" => content_type}, data]
end
error_massages() click to toggle source
# File lib/phantom_proxy/helper/http.rb, line 23
def self.error_massages
  @error_massages||={"Not Found" => 404, "Server Error" => 500, "Not Allowed" => 403, "Not Authorized" => 401}
end
error_object_binding(obj) click to toggle source
# File lib/phantom_proxy/helper/http.rb, line 6
def self.error_object_binding(obj)
  obj||={}
  def obj.get_binding
    binding
  end
  def obj.title
    self[:title]
  end
  def obj.content
    self[:content]
  end
  def obj.error_code
    self[:error_code]
  end
  obj.get_binding
end
renderer() click to toggle source
# File lib/phantom_proxy/helper/http.rb, line 3
def self.renderer
  @@renderer||=TemplateRenderer.create(binding)
end