Module: Nexus
- Includes:
- HTTParty
- Defined in:
- lib/nexus/version.rb,
lib/nexus/connection.rb,
lib/nexus/model/items.rb,
lib/nexus/model/runes.rb,
lib/nexus/model/champion.rb,
lib/nexus/model/summoner.rb,
lib/nexus/model/masteries.rb,
lib/nexus/controller/static.rb,
lib/nexus/controller/summoner.rb
Defined Under Namespace
Classes: Champion, Item, MPage, Mastery, PagesMasteries, PagesRunes, RPage, Rune, Summoner
Constant Summary
collapse
- VERSION =
"0.0.3"
- VERSION_STATIC =
"v1.2"
- VERSION_SUMMONER =
"v1.4"
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
4
5
6
|
# File 'lib/nexus/connection.rb', line 4
def api_key
@api_key
end
|
#global_uri ⇒ Object
Returns the value of attribute global_uri.
3
4
5
|
# File 'lib/nexus/controller/static.rb', line 3
def global_uri
@global_uri
end
|
#region ⇒ Object
Returns the value of attribute region.
6
7
8
|
# File 'lib/nexus/connection.rb', line 6
def region
@region
end
|
#uri ⇒ Object
Returns the value of attribute uri.
5
6
7
|
# File 'lib/nexus/connection.rb', line 5
def uri
@uri
end
|
Class Method Details
.api_key(api_key) ⇒ Object
8
9
10
|
# File 'lib/nexus/connection.rb', line 8
def self.api_key(api_key)
@api_key = api_key.to_s
end
|
.connect_to(region) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# 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") ⇒ Object
15
16
17
18
|
# 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") ⇒ Object
9
10
11
12
13
|
# 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") ⇒ Object
26
27
28
29
|
# 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") ⇒ Object
20
21
22
23
24
|
# 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") ⇒ Object
32
33
34
35
36
|
# 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") ⇒ Object
38
39
40
41
|
# 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 ⇒ Object
54
55
56
57
58
|
# 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") ⇒ Object
49
50
51
52
|
# 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") ⇒ Object
43
44
45
46
47
|
# 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) ⇒ Object
9
10
11
12
|
# 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) ⇒ Object
4
5
6
7
|
# 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) ⇒ Object
14
15
16
17
|
# 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) ⇒ Object
19
20
21
22
|
# 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) ⇒ Object
24
25
26
27
|
# 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 ⇒ Object
60
61
62
63
64
|
# 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
|