Class: Relcy::Client
Constant Summary
Constants included from API
Instance Method Summary collapse
-
#initialize(api_key, cache_store = nil) ⇒ Client
constructor
A new instance of Client.
Methods included from API::Lookup
Methods included from API::Detail
Methods included from API::Search
Methods included from API::Autocomplete
Constructor Details
#initialize(api_key, cache_store = nil) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/relcy/client.rb', line 11 def initialize(api_key, cache_store=nil) @connection = Faraday.new(:url => BASE_URL) do |conn| conn.request :url_encoded conn.response :json, :content_type => /\bjson$/ faraday.use FaradayMiddleware::Caching, cache_store if cache_store conn.adapter :typhoeus conn.params["api_key"] = api_key end end |