Sha256: c8fc0f1a254ffa9c3efd73721a19e7282d87210ed3cdc45901b1baa874702b78
Contents?: true
Size: 718 Bytes
Versions: 14
Compression:
Stored size: 718 Bytes
Contents
require 'uri' require 'net/http' module Timezone # A basic HTTP Client that handles requests to Geonames and Google. You # can create your own version of this class if you want to use a proxy # or a different http library such as faraday but be aware that the # Google timezone API uses https protocol. # # @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) @http.use_ssl = (protocol == 'https') end def get(url) @http.request(Net::HTTP::Get.new(url)) end end end
Version data entries
14 entries across 14 versions & 1 rubygems