Sha256: 055767e2bbcbcf4d4392bc7385d69c6b90dd51be12292f92c9799de659c712d3
Contents?: true
Size: 1.55 KB
Versions: 2
Compression:
Stored size: 1.55 KB
Contents
require 'net/http' require 'multi_json' require 'addressfinder/version' require 'addressfinder/configuration' require 'addressfinder/cleanse' require 'addressfinder/location_info' require 'addressfinder/location_search' require 'addressfinder/bulk' require 'addressfinder/errors' module AddressFinder class << self def configure(config_hash=nil) if config_hash config_hash.each do |k,v| configuration.send("#{k}=", v) rescue nil if configuration.respond_to?("#{k}=") end end yield(configuration) if block_given? end def configuration @configuration ||= AddressFinder::Configuration.new end def cleanse(args={}) AddressFinder::Cleanse.new(args.merge(http: configure_http)).perform.result end def location_search(args={}) AddressFinder::LocationSearch.new(params: args, http: configure_http).perform.results end def location_info(args={}) AddressFinder::LocationInfo.new(params: args, http: configure_http).perform.result end def bulk(&block) # TODO include parameter http: configure_http AddressFinder::Bulk.new(&block).perform end private def configure_http http = Net::HTTP.new(configuration.hostname, configuration.port, configuration.proxy_host, configuration.proxy_port, configuration.proxy_user, configuration.proxy_password) http.open_timeout = configuration.timeout http.read_timeout = configuration.timeout http.use_ssl = true http end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
addressfinder-1.3.0 | lib/addressfinder.rb |
addressfinder-1.2.0 | lib/addressfinder.rb |