Class: Lolxin::Api
- Inherits:
-
Object
- Object
- Lolxin::Api
- Defined in:
- lib/lolxin/helpers/api.rb
Direct Known Subclasses
Champion, ChampionMastery, League, LolStaticData, LolStatus, Spectator, Summoner, ThirdPartyCode
Constant Summary collapse
- BASE_ENDPOINT =
"https://%{region}.api.riotgames.com/lol/"
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#conn ⇒ Object
Returns the value of attribute conn.
-
#region ⇒ Object
Returns the value of attribute region.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Api
constructor
A new instance of Api.
Constructor Details
#initialize(options = {}) ⇒ Api
Returns a new instance of Api.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/lolxin/helpers/api.rb', line 7 def initialize( = {}) @api_key = [:api_key] @region = [:region] @version = [:version] endpoint = BASE_ENDPOINT % {region: region} @conn = Faraday.new(endpoint, [:conn_options]) do |faraday| faraday.request(:url_encoded) faraday.adapter(Faraday.default_adapter) faraday.params[:api_key] = api_key end end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
5 6 7 |
# File 'lib/lolxin/helpers/api.rb', line 5 def api_key @api_key end |
#conn ⇒ Object
Returns the value of attribute conn.
5 6 7 |
# File 'lib/lolxin/helpers/api.rb', line 5 def conn @conn end |
#region ⇒ Object
Returns the value of attribute region.
5 6 7 |
# File 'lib/lolxin/helpers/api.rb', line 5 def region @region end |
#version ⇒ Object
Returns the value of attribute version.
5 6 7 |
# File 'lib/lolxin/helpers/api.rb', line 5 def version @version end |