Class: Taric::Configuration
- Inherits:
-
Object
- Object
- Taric::Configuration
- Defined in:
- lib/taric/configuration.rb
Constant Summary collapse
- DEFAULT_REQUESTOR =
-> (connection, method, url, body, headers) { connection.send(method, url, body, headers) }.curry
- DEFAULT_RESPONSE_HANDLER =
-> response { response }
- PARALLEL_REQUESTOR =
-> connection, operations { operations.map{|operation| connection.send(operation[:method], operation[:url], operation[:body], operation[:headers])} }.curry
- PARALLEL_RESPONSE_HANDLER =
-> responses { responses.map{|response| response} }
Instance Attribute Summary collapse
-
#adapter ⇒ Object
Returns the value of attribute adapter.
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#connection_opts ⇒ Object
Returns the value of attribute connection_opts.
-
#format ⇒ Object
Returns the value of attribute format.
-
#parallel_requestor ⇒ Object
Returns the value of attribute parallel_requestor.
-
#parallel_response_handler ⇒ Object
Returns the value of attribute parallel_response_handler.
-
#raw ⇒ Object
Returns the value of attribute raw.
-
#region ⇒ Object
Returns the value of attribute region.
-
#requestor ⇒ Object
Returns the value of attribute requestor.
-
#response_handler ⇒ Object
Returns the value of attribute response_handler.
-
#user_agent ⇒ Object
Returns the value of attribute user_agent.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(options = {}) ⇒ Configuration
Returns a new instance of Configuration.
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/taric/configuration.rb', line 21 def initialize( = {}) @api_key = .fetch(:api_key, ENV.fetch('RIOT_API_KEY'.freeze, nil)) @format = .fetch(:format, :json) @user_agent = .fetch(:user_agent, 'Taric Gem') @adapter = .fetch(:adapter, Faraday.default_adapter) @region = .fetch(:region, ENV.fetch('RIOT_API_REGION'.freeze, 'na').to_sym) @connection_opts = .fetch(:connection_opts, {}) @requestor = .fetch(:requestor, DEFAULT_REQUESTOR) @response_handler = .fetch(:response_handler, DEFAULT_RESPONSE_HANDLER) @parallel_requestor = .fetch(:parallel_requestor, PARALLEL_REQUESTOR) @parallel_response_handler = .fetch(:parallel_response_handler, PARALLEL_RESPONSE_HANDLER) @raw = .fetch(:raw, false) end |
Instance Attribute Details
#adapter ⇒ Object
Returns the value of attribute adapter.
3 4 5 |
# File 'lib/taric/configuration.rb', line 3 def adapter @adapter end |
#api_key ⇒ Object
Returns the value of attribute api_key.
3 4 5 |
# File 'lib/taric/configuration.rb', line 3 def api_key @api_key end |
#connection_opts ⇒ Object
Returns the value of attribute connection_opts.
3 4 5 |
# File 'lib/taric/configuration.rb', line 3 def connection_opts @connection_opts end |
#format ⇒ Object
Returns the value of attribute format.
3 4 5 |
# File 'lib/taric/configuration.rb', line 3 def format @format end |
#parallel_requestor ⇒ Object
Returns the value of attribute parallel_requestor.
3 4 5 |
# File 'lib/taric/configuration.rb', line 3 def parallel_requestor @parallel_requestor end |
#parallel_response_handler ⇒ Object
Returns the value of attribute parallel_response_handler.
3 4 5 |
# File 'lib/taric/configuration.rb', line 3 def parallel_response_handler @parallel_response_handler end |
#raw ⇒ Object
Returns the value of attribute raw.
3 4 5 |
# File 'lib/taric/configuration.rb', line 3 def raw @raw end |
#region ⇒ Object
Returns the value of attribute region.
3 4 5 |
# File 'lib/taric/configuration.rb', line 3 def region @region end |
#requestor ⇒ Object
Returns the value of attribute requestor.
3 4 5 |
# File 'lib/taric/configuration.rb', line 3 def requestor @requestor end |
#response_handler ⇒ Object
Returns the value of attribute response_handler.
3 4 5 |
# File 'lib/taric/configuration.rb', line 3 def response_handler @response_handler end |
#user_agent ⇒ Object
Returns the value of attribute user_agent.
3 4 5 |
# File 'lib/taric/configuration.rb', line 3 def user_agent @user_agent end |