Class: Lolxin::Client
- Inherits:
-
Object
- Object
- Lolxin::Client
- Defined in:
- lib/lolxin/client.rb
Overview
Client create connection clients for specific endpoints
Constant Summary collapse
- ENDPOINTS =
[ :champion_mastery, :champion, :league, :lol_static_data, :lol_status, :match, :spectator, :summoner, :third_party_code #tournament_stub #tournament ]
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
Instance Method Summary collapse
-
#initialize(api_key, options = {}) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(api_key, options = {}) ⇒ Client
Returns a new instance of Client.
22 23 24 25 26 27 28 |
# File 'lib/lolxin/client.rb', line 22 def initialize(api_key, = {}) @api_key = api_key @region = [:region] if Region.valid?([:region]) @options = { api_key: @api_key, region: @region } raise ClientError, "Invalid API key" if @api_key.nil? || @api_key.empty? raise ClientError, "Invalid region" unless @region end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
20 21 22 |
# File 'lib/lolxin/client.rb', line 20 def api_key @api_key end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
20 21 22 |
# File 'lib/lolxin/client.rb', line 20 def @options end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
20 21 22 |
# File 'lib/lolxin/client.rb', line 20 def region @region end |