class OneApm::Support::HTTPClients::TyphoeusHTTPRequest

Public Class Methods

new(request) click to toggle source
# File lib/one_apm/support/http_clients/typhoeus_wrappers.rb, line 37
def initialize(request)
  @request = request
  @uri = case request.url
    when ::URI then request.url
    else OneApm::Support::HTTPClients::URIUtil.parse_url(request.url)
    end
end

Public Instance Methods

[](key) click to toggle source
# File lib/one_apm/support/http_clients/typhoeus_wrappers.rb, line 61
def [](key)
  return nil unless @request.options && @request.options[:headers]
  @request.options[:headers][key]
end
[]=(key, value) click to toggle source
# File lib/one_apm/support/http_clients/typhoeus_wrappers.rb, line 66
def []=(key, value)
  @request.options[:headers] ||= {}
  @request.options[:headers][key] = value
end
body() click to toggle source
# File lib/one_apm/support/http_clients/typhoeus_wrappers.rb, line 79
def body
  @request.options[:body]
end
host() click to toggle source
# File lib/one_apm/support/http_clients/typhoeus_wrappers.rb, line 49
def host
  @uri.host
end
method() click to toggle source
# File lib/one_apm/support/http_clients/typhoeus_wrappers.rb, line 57
def method
  (@request.options[:method] || 'GET').to_s.upcase
end
params() click to toggle source
# File lib/one_apm/support/http_clients/typhoeus_wrappers.rb, line 87
def params
  post_params.merge(query)
end
port() click to toggle source
# File lib/one_apm/support/http_clients/typhoeus_wrappers.rb, line 53
def port
  @uri.port
end
post_params() click to toggle source
# File lib/one_apm/support/http_clients/typhoeus_wrappers.rb, line 83
def post_params
  body.nil?? {} :  CGI.parse(body)
end
query() click to toggle source
# File lib/one_apm/support/http_clients/typhoeus_wrappers.rb, line 75
def query
  @uri.query.nil?? {} : CGI.parse(@uri.query)
end
type() click to toggle source
# File lib/one_apm/support/http_clients/typhoeus_wrappers.rb, line 45
def type
  "Typhoeus"
end
uri() click to toggle source
# File lib/one_apm/support/http_clients/typhoeus_wrappers.rb, line 71
def uri
  @uri
end