Class: Ryze::Client
- Inherits:
-
Object
- Object
- Ryze::Client
- Defined in:
- lib/Ryze/client.rb
Overview
Client is the main entry point for interacting with the Riot API.
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
Instance Method Summary collapse
-
#connection ⇒ Faraday::Connection
A new instance of Faraday::Connection or the current instance.
-
#initialize(api_key:, adapter: Faraday.default_adapter, stubs: nil) ⇒ Client
constructor
A new instance of Client.
-
#match ⇒ MatchResource
A new instance of MatchResource.
-
#summoner ⇒ SummonerResource
A new instance of SummonerResource.
Constructor Details
#initialize(api_key:, adapter: Faraday.default_adapter, stubs: nil) ⇒ Client
Returns A new instance of Client.
14 15 16 17 18 |
# File 'lib/Ryze/client.rb', line 14 def initialize(api_key:, adapter: Faraday.default_adapter, stubs: nil) @api_key = api_key @adapter = adapter @stubs = stubs end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
8 9 10 |
# File 'lib/Ryze/client.rb', line 8 def adapter @adapter end |
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
8 9 10 |
# File 'lib/Ryze/client.rb', line 8 def api_key @api_key end |
Instance Method Details
#connection ⇒ Faraday::Connection
Returns A new instance of Faraday::Connection or the current instance.
31 32 33 34 35 36 37 |
# File 'lib/Ryze/client.rb', line 31 def connection @connection ||= Faraday.new do |conn| conn.request :json conn.response :json, content_type: "application/json" conn.adapter adapter, @stubs end end |
#match ⇒ MatchResource
Returns A new instance of MatchResource.
26 27 28 |
# File 'lib/Ryze/client.rb', line 26 def match MatchResource.new(self) end |
#summoner ⇒ SummonerResource
Returns A new instance of SummonerResource.
21 22 23 |
# File 'lib/Ryze/client.rb', line 21 def summoner SummonerResource.new(self) end |