goldfinger/lib/goldfinger/request.rb

25 lines
491 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2016-02-17 15:13:19 +01:00
require 'http'
require 'addressable'
module Goldfinger
class Request
def initialize(request_method, path, options = {})
@request_method = request_method
@uri = Addressable::URI.parse(path)
@options = options
end
def perform
http_client.request(@request_method, @uri.to_s, @options)
2016-02-17 15:13:19 +01:00
end
private
def http_client
HTTP.timeout(write: 60, connect: 20, read: 60).follow
2016-02-17 15:13:19 +01:00
end
end
end