class NatureRemoApi::Client

Attributes

access_token[RW]

TODO: NatureRemoApi::Config::ATTRIBUTESを下記に設定できるようにする

client[RW]

TODO: NatureRemoApi::Config::ATTRIBUTESを下記に設定できるようにする

default_max_retries[RW]

TODO: NatureRemoApi::Config::ATTRIBUTESを下記に設定できるようにする

endpoint[RW]

TODO: NatureRemoApi::Config::ATTRIBUTESを下記に設定できるようにする

Public Class Methods

config() click to toggle source
# File lib/nature_remo_api/client.rb, line 39
def config
  Config
end
configure() { |Config| ... } click to toggle source
# File lib/nature_remo_api/client.rb, line 35
def configure
  block_given? ? yield(Config) : Config
end
new(options = {}) click to toggle source
# File lib/nature_remo_api/client.rb, line 13
def initialize(options = {})
  NatureRemoApi::Config::ATTRIBUTES.each do |key|
    send("#{key}=", options.fetch(key, NatureRemoApi.config.send(key)))
  end
  @access_token ||= NatureRemoApi.config.access_token
  @client = Faraday.new(url: endpoint) do |conn|
    conn.request :json
    conn.response :mashify
    conn.response :json, :content_type => /\bjson$/
    conn.adapter Faraday.default_adapter
  end
  @client.headers['Authorization'] = "Bearer #{access_token}"
end