Sha256: 8e206ccc2bb3df72a2d45738d96e764a05360ef37268043f999a929291d1f8e4

Contents?: true

Size: 596 Bytes

Versions: 2

Compression:

Stored size: 596 Bytes

Contents

require 'uri'
require 'net/http'

module Timezone
  # A basic HTTP Client that handles requests to Geonames. You can create
  # your own version of this class if you want to use a proxy or a
  # different http library such as faraday.
  #
  # @example
  #     Timezone::Configure.begin do |c|
  #       c.http_client = Timezone::NetHTTPClient
  #     end
  class NetHTTPClient
    def initialize(protocol, host)
      uri = URI.parse("#{protocol}://#{host}")
      @http = Net::HTTP.new(uri.host, uri.port)
    end

    def get(url)
      @http.request(Net::HTTP::Get.new(url))
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
timezone-0.3.3 lib/timezone/net_http_client.rb
timezone-0.3.2 lib/timezone/net_http_client.rb