class HotPepper::Client

Attributes

api_key[RW]
client[RW]
default_max_retries[RW]
endpoint[RW]

Public Class Methods

config() click to toggle source
# File lib/hot_pepper/client.rb, line 43
def config
  Config
end
configure() { |Config| ... } click to toggle source
# File lib/hot_pepper/client.rb, line 39
def configure
  block_given? ? yield(Config) : Config
end
new(options = {}) click to toggle source
# File lib/hot_pepper/client.rb, line 18
def initialize(options = {})
  HotPepper::Config::ATTRIBUTES.each do |key|
    send("#{key}=", options.fetch(key, HotPepper.config.send(key)))
  end
  @api_key ||= HotPepper.config.api_key
  @client = Faraday.new(url: endpoint) do |conn|
    conn.request :json
    conn.response :json, content_type: /\bjson$/
    conn.response :encoding
    conn.adapter Faraday.default_adapter
  end
end