class Opbeat::HttpClient::HTTPAdapter

Public Class Methods

new(conf) click to toggle source
# File lib/opbeat/http_client.rb, line 77
def initialize conf
  @config = conf
end

Public Instance Methods

perform_request(req) click to toggle source
# File lib/opbeat/http_client.rb, line 87
def perform_request req
  http.start do |http|
    http.request req
  end
end
post(path) { |req| ... } click to toggle source
# File lib/opbeat/http_client.rb, line 81
def post path
  req = Net::HTTP::Post.new path
  yield req if block_given?
  req
end

Private Instance Methods

http() click to toggle source
# File lib/opbeat/http_client.rb, line 95
def http
  return @http if @http

  http = Net::HTTP.new server_uri.host, server_uri.port
  http.use_ssl = @config.use_ssl
  http.read_timeout = @config.timeout
  http.open_timeout = @config.open_timeout

  @http = http
end
server_uri() click to toggle source
# File lib/opbeat/http_client.rb, line 106
def server_uri
  @uri ||= URI(@config.server)
end