module Nexus
Constants
- VERSION
- VERSION_STATIC
- VERSION_SUMMONER
Attributes
api_key[RW]
global_uri[RW]
region[RW]
uri[RW]
Public Class Methods
api_key(api_key)
click to toggle source
# File lib/nexus/connection.rb, line 8 def self.api_key(api_key) @api_key = api_key.to_s end
connect_to(region)
click to toggle source
# File lib/nexus/connection.rb, line 12 def self.connect_to(region) case region.to_s.downcase when "eune", "eu nordic & east", "eu nordic and east" @uri = "https://eune.api.pvp.net/api/lol/eune/" @region = "eune" when "euw", "eu west" @uri = "https://euw.api.pvp.net/api/lol/euw/" @region = "euw" when "kr", "korea" @uri = "https://kr.api.pvp.net/api/lol/kr/" @region = "kr" when "br", "brasil", "brazil" @uri = "https://br.api.pvp.net/api/lol/br/" @region = "br" when "lan", "latin america north" @uri = "https://lan.api.pvp.net/api/lol/lan/" @region = "lan" when "las", "latin america south" @uri = "https://las.api.pvp.net/api/lol/las/" @region = "las" when "na", "north america" @uri = "https://na.api.pvp.net/api/lol/na/" @region = "na" when "oce", "oceania" @uri = "https://oce.api.pvp.net/api/lol/oce/" @region = "oce" when "ru", "russia" @uri = "https://ru.api.pvp.net/api/lol/ru/" @region = "ru" when "tr", "turkey" @uri = "https://tr.api.pvp.net/api/lol/tr/" @region = "tr" else nil end end
get_champion_by_id(champ_id, champData = "all")
click to toggle source
# File lib/nexus/controller/static.rb, line 15 def self.get_champion_by_id(champ_id, champData = "all") url = ("#{@global_uri}#{@region}/#{VERSION_STATIC}/champion/#{champ_id}?champData=#{champData}&api_key=#{@api_key}") return Nexus::Champion.new(retrieve_url get(url)) end
get_champion_by_name(champ_name,champData = "all")
click to toggle source
# File lib/nexus/controller/static.rb, line 9 def self.get_champion_by_name(champ_name,champData = "all") url = ("#{@global_uri}#{@region}/#{VERSION_STATIC}/champion?champData=#{champData}&api_key=#{@api_key}") response = retrieve_url get(url) return Nexus::Champion.new(response["data"][champ_name.to_s]) end
get_item_by_id(item_id, itemData = "all")
click to toggle source
# File lib/nexus/controller/static.rb, line 26 def self.get_item_by_id(item_id, itemData = "all") url = ("#{@global_uri}#{@region}/#{VERSION_STATIC}/item/#{item_id}?itemData=#{itemData}&api_key=#{@api_key}") return Nexus::Item.new(retrieve_url get(url)) end
get_items(itemData = "all")
click to toggle source
# File lib/nexus/controller/static.rb, line 20 def self.get_items(itemData = "all") url = ("#{@global_uri}#{@region}/#{VERSION_STATIC}/item?itemListData=#{itemData}&api_key=#{@api_key}") response = retrieve_url get(url) return (response["data"]) end
get_masteries(masteryData = "all")
click to toggle source
# File lib/nexus/controller/static.rb, line 32 def self.get_masteries(masteryData = "all") url = ("#{@global_uri}#{@region}/#{VERSION_STATIC}/mastery?masteryListData=#{masteryData}&api_key=#{@api_key}") response = retrieve_url get(url) return (response["data"]) end
get_mastery_by_id(mastery_id, masteryData = "all")
click to toggle source
# File lib/nexus/controller/static.rb, line 38 def self.get_mastery_by_id(mastery_id, masteryData = "all") url = ("#{@global_uri}#{@region}/#{VERSION_STATIC}/mastery/#{mastery_id}?masteryData=#{masteryData}&api_key=#{@api_key}") return Nexus::Mastery.new(retrieve_url get(url)) end
get_realm()
click to toggle source
# File lib/nexus/controller/static.rb, line 54 def self.get_realm url = ("#{@global_uri}#{@region}/#{VERSION_STATIC}/realm?api_key=#{@api_key}") response = retrieve_url get(url) return (response) end
get_rune_by_id(rune_id, runeData = "all")
click to toggle source
# File lib/nexus/controller/static.rb, line 49 def self.get_rune_by_id(rune_id, runeData = "all") url = ("#{@global_uri}#{@region}/#{VERSION_STATIC}/rune/#{rune_id}?runeData=#{runeData}&api_key=#{@api_key}") return Nexus::Rune.new(retrieve_url get(url)) end
get_runes(runeData = "all")
click to toggle source
# File lib/nexus/controller/static.rb, line 43 def self.get_runes(runeData = "all") url = ("#{@global_uri}#{@region}/#{VERSION_STATIC}/rune?runeListData=#{runeData}&api_key=#{@api_key}") response = retrieve_url get(url) return (response["data"]) end
get_summoner_by_id(id)
click to toggle source
# File lib/nexus/controller/summoner.rb, line 9 def self.get_summoner_by_id(id) url = (@uri + VERSION_SUMMONER + "/summoner/#{id}?api_key=#{@api_key}") return Nexus::Summoner.new(retrieve_url_ident get(url), id) end
get_summoner_by_name(name)
click to toggle source
# File lib/nexus/controller/summoner.rb, line 4 def self.get_summoner_by_name(name) url = (@uri + VERSION_SUMMONER + "/summoner/by-name/#{name}?api_key=#{@api_key}") return Nexus::Summoner.new(retrieve_url_ident get(url), name) end
get_summoner_masteries(id)
click to toggle source
# File lib/nexus/controller/summoner.rb, line 14 def self.get_summoner_masteries(id) url = (@uri + VERSION_SUMMONER + "/summoner/#{id}/masteries?api_key=#{@api_key}") return Nexus::PagesMasteries.new(retrieve_url_ident get(url), id) end
get_summoner_name(id)
click to toggle source
# File lib/nexus/controller/summoner.rb, line 19 def self.get_summoner_name(id) url = (@uri + VERSION_SUMMONER + "/summoner/#{id}/name?api_key=#{@api_key}") return retrieve_url_ident get(url), id end
get_summoner_runes(id)
click to toggle source
# File lib/nexus/controller/summoner.rb, line 24 def self.get_summoner_runes(id) url = (@uri + VERSION_SUMMONER + "/summoner/#{id}/runes?api_key=#{@api_key}") return Nexus::PagesRunes.new(retrieve_url_ident get(url), id) end
get_versions()
click to toggle source
# File lib/nexus/controller/static.rb, line 60 def self.get_versions url = ("#{@global_uri}#{@region}/#{VERSION_STATIC}/versions?api_key=#{@api_key}") response = retrieve_url get(url) return (response) end
Private Class Methods
retrieve_url(response)
click to toggle source
# File lib/nexus/connection.rb, line 66 def self.retrieve_url(response) response.parsed_response end
retrieve_url_ident(response, ident)
click to toggle source
# File lib/nexus/connection.rb, line 62 def self.retrieve_url_ident(response, ident) response.parsed_response["#{ident.to_s.downcase}"] end