Class: Relcy::Client

Inherits:
Base
  • Object
show all
Includes:
API
Defined in:
lib/relcy/client.rb

Constant Summary

Constants included from API

API::BASE_URL

Instance Method Summary collapse

Methods included from API::Lookup

#lookup

Methods included from API::Detail

#detail, #load_card

Methods included from API::Search

#search

Methods included from API::Autocomplete

#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