class RitoApi::Client
Attributes
region[RW]
Public Class Methods
new(api_key, region, cache = false, ttl = 1)
click to toggle source
# File lib/rito_api/client.rb, line 9 def initialize(api_key, region, cache = false, ttl = 1) # Initializes the client. @api_key = api_key @region = region @ttl = ttl unless cache @cache_store = nil else @cache_store = Moneta.new(:Redis, expires: @ttl) # ttl = time till the cache expires [Defaults to 1 as 0 means never expire.] # @cache_store.clear end end
Public Instance Methods
basic()
click to toggle source
# File lib/rito_api/client.rb, line 31 def basic RitoApi::Requests::Basic.new(@api_key, @region, @cache_store) end
challenger()
click to toggle source
# File lib/rito_api/client.rb, line 39 def challenger # Creates a new instance of challenger class. Used to make request relating to summoner. Check requests/challenger.rb for methods. RitoApi::Requests::Challenger.new(@api_key, @region, @cache_store) end
champion()
click to toggle source
# File lib/rito_api/client.rb, line 43 def champion # Creates a new instance of champion class. Used to make request relating to champion. Check requests/champion.rb for methods. RitoApi::Requests::Champion.new(@api_key, @region, @cache_store) end
change_region(region)
click to toggle source
# File lib/rito_api/client.rb, line 27 def change_region(region) # Changes region after the client is already initialized. @region = region end
close()
click to toggle source
# File lib/rito_api/client.rb, line 21 def close # Closes the client. unless @cache_store.nil? @cache_store.clear end end
item()
click to toggle source
# File lib/rito_api/client.rb, line 51 def item RitoApi::Requests::Item.new(@api_key, @region, @cache_store) end
match()
click to toggle source
# File lib/rito_api/client.rb, line 47 def match RitoApi::Requests::Match.new(@api_key, @region, @cache_store) end
summoner()
click to toggle source
# File lib/rito_api/client.rb, line 35 def summoner # Creates a new instance of summoner class. Used to make request relating to summoner. Check requests/summoner.rb for methods. RitoApi::Requests::Summoner.new(@api_key, @region, @cache_store) end