Class: HotPepper::Client
- Inherits:
-
Object
- Object
- HotPepper::Client
- Defined in:
- lib/hot_pepper/client.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#client ⇒ Object
Returns the value of attribute client.
-
#default_max_retries ⇒ Object
Returns the value of attribute default_max_retries.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
Methods included from Query
Methods included from Endpoints::Gourmet
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/hot_pepper/client.rb', line 18 def initialize( = {}) HotPepper::Config::ATTRIBUTES.each do |key| send("#{key}=", .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 |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
16 17 18 |
# File 'lib/hot_pepper/client.rb', line 16 def api_key @api_key end |
#client ⇒ Object
Returns the value of attribute client.
16 17 18 |
# File 'lib/hot_pepper/client.rb', line 16 def client @client end |
#default_max_retries ⇒ Object
Returns the value of attribute default_max_retries.
16 17 18 |
# File 'lib/hot_pepper/client.rb', line 16 def default_max_retries @default_max_retries end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
16 17 18 |
# File 'lib/hot_pepper/client.rb', line 16 def endpoint @endpoint end |