class TingYun::Http::TyphoeusHTTPRequest

Constants

GET
LHOST
TYPHOEUS
UHOST

Public Class Methods

new(request) click to toggle source
# File lib/ting_yun/http/typhoeus_wrappers.rb, line 38
def initialize(request)
  @request = request
  @uri = case request.url
    when ::URI then request.url
    else TingYun::Agent::HTTPClients::URIUtil.parse_and_normalize_url(request.url)
    end
end

Public Instance Methods

[](key) click to toggle source
# File lib/ting_yun/http/typhoeus_wrappers.rb, line 72
def [](key)
  return nil unless @request.options && @request.options[:headers]
  @request.options[:headers][key]
end
[]=(key, value) click to toggle source
# File lib/ting_yun/http/typhoeus_wrappers.rb, line 77
def []=(key, value)
  @request.options[:headers] ||= {}
  @request.options[:headers][key] = value
end
from() click to toggle source
# File lib/ting_yun/http/typhoeus_wrappers.rb, line 51
def from
  "typhoeus http"
end
host() click to toggle source
# File lib/ting_yun/http/typhoeus_wrappers.rb, line 62
def host
  host_from_header || @uri.host
end
host_from_header() click to toggle source
# File lib/ting_yun/http/typhoeus_wrappers.rb, line 58
def host_from_header
  self[LHOST] || self[UHOST]
end
method() click to toggle source
# File lib/ting_yun/http/typhoeus_wrappers.rb, line 68
def method
  (@request.options[:method] || GET).to_s.upcase
end
type() click to toggle source
# File lib/ting_yun/http/typhoeus_wrappers.rb, line 48
def type
  TYPHOEUS
end
uri() click to toggle source
# File lib/ting_yun/http/typhoeus_wrappers.rb, line 82
def uri
  @uri
end