the_nexus 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nexus/model/champion.rb +24 -0
- data/lib/nexus/model/items.rb +22 -0
- data/lib/nexus/model/masteries.rb +36 -12
- data/lib/nexus/model/models.rb +5 -0
- data/lib/nexus/model/runes.rb +36 -11
- data/lib/nexus/static.rb +65 -0
- data/lib/nexus/summoner.rb +5 -13
- data/lib/nexus/version.rb +1 -1
- data/lib/nexus.rb +11 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb439f424152462afc6a177b9664bedb5349bc0b
|
4
|
+
data.tar.gz: 9403e1a32bd41329b9109f2bb4e1adf7d42e9644
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f123964168d2cf36c83666901597db8cf5a5703d74fc5c4204106cf67283fd2ee505ae006da6247354e21e1b626b76d89c6059f0b9c8d73a515e46984846ce1f
|
7
|
+
data.tar.gz: 7c8dd39be9d6f513110eb8fc862cc7b7bc4ecb676661194eeb1a52f228cd94b6a25106c9ea39a50a3c88d1c71a988dfee95c991938708707b8e63dbfb6d72587
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Nexus
|
2
|
+
class Champion
|
3
|
+
attr_reader :id, :key, :name, :title, :image, :skins, :lore, :blurb, :allytips
|
4
|
+
attr_reader :enemytips, :tags, :partype, :info, :stats, :spells
|
5
|
+
|
6
|
+
def initialize(params)
|
7
|
+
@id = params["id"]
|
8
|
+
@key = params["key"]
|
9
|
+
@name = params["name"]
|
10
|
+
@title = params["title"]
|
11
|
+
@image = params["image"]
|
12
|
+
@skins = params["skins"]
|
13
|
+
@lore = params["lore"]
|
14
|
+
@blurb = params["blurb"]
|
15
|
+
@allytips = params["allytips"]
|
16
|
+
@enemytips = params["enemytips"]
|
17
|
+
@tags = params["tags"]
|
18
|
+
@partype = params["partype"]
|
19
|
+
@info = params["info"]
|
20
|
+
@stats = params["stats"]
|
21
|
+
@spells = params["spells"]
|
22
|
+
end
|
23
|
+
end #Incomplete
|
24
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Nexus
|
2
|
+
class Item
|
3
|
+
attr_reader :id, :name, :description, :sanitizedDescription, :tags, :image, :stats, :stacks, :consumable, :colloq, :plaintext, :gold_base, :gold_total, :gold_sell
|
4
|
+
|
5
|
+
def initialize(params)
|
6
|
+
@id = params["id"]
|
7
|
+
@name = params["name"]
|
8
|
+
@gold_base = params["gold"]["base"]
|
9
|
+
@gold_total = params["gold"]["total"]
|
10
|
+
@gold_sell = params["gold"]["sell"]
|
11
|
+
@description = params["description"]
|
12
|
+
@sanitizedDescription = params["sanitizedDescription"]
|
13
|
+
@colloq = params["colloq"]
|
14
|
+
@plaintext = params["plaintext"]
|
15
|
+
@consumable = params["consumed"]
|
16
|
+
@stacks = params["stacks"]
|
17
|
+
@tags = params["tags"]
|
18
|
+
@image = params["image"]
|
19
|
+
@stats = params["stats"]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Nexus
|
2
|
-
class
|
2
|
+
class PagesMasteries
|
3
3
|
|
4
4
|
attr_reader :id, :name, :pages
|
5
5
|
|
@@ -8,19 +8,43 @@ module Nexus
|
|
8
8
|
@name = Nexus.get_summoner_name(params["summonerId"].to_s)
|
9
9
|
@pages = Array.new()
|
10
10
|
params["pages"].each do |p|
|
11
|
-
@pages.push(Nexus::
|
11
|
+
@pages.push(Nexus::MPage.new(p))
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
15
|
+
|
16
|
+
class MPage
|
17
|
+
attr_reader :id, :name, :current, :slots
|
18
|
+
|
19
|
+
def initialize(params)
|
20
|
+
@id = params["id"]
|
21
|
+
@name = params["name"]
|
22
|
+
@current = params["current"]
|
23
|
+
|
24
|
+
@masteries = Array.new()
|
25
|
+
|
26
|
+
if(params["masteries"] != nil)
|
27
|
+
params["masteries"].each do |m|
|
28
|
+
@masteries.push(Nexus.get_mastery_by_id(m["id"]))
|
29
|
+
end
|
30
|
+
else
|
31
|
+
@masteries = []
|
24
32
|
end
|
25
|
-
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class Mastery
|
37
|
+
|
38
|
+
attr_reader :id, :name, :description, :sanitizedDescription, :level, :prereq, :image, :tier, :type
|
39
|
+
|
40
|
+
def initialize(params)
|
41
|
+
@id = params["id"]
|
42
|
+
@name = params["name"]
|
43
|
+
@description = params["description"]
|
44
|
+
@sanitizedDescription = params["sanitizedDescription"]
|
45
|
+
@level = params["ranks"]
|
46
|
+
@prereq_id = params["prereq"]
|
47
|
+
@image = params["image"]
|
48
|
+
end
|
49
|
+
end
|
26
50
|
end
|
data/lib/nexus/model/runes.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Nexus
|
2
|
-
class
|
2
|
+
class PagesRunes
|
3
3
|
|
4
4
|
attr_reader :id, :name, :pages
|
5
5
|
|
@@ -8,20 +8,45 @@ module Nexus
|
|
8
8
|
@name = Nexus.get_summoner_name(params["summonerId"].to_s)
|
9
9
|
@pages = Array.new()
|
10
10
|
params["pages"].each do |p|
|
11
|
-
@pages.push(Nexus::
|
11
|
+
@pages.push(Nexus::RPage.new(p))
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
attr_reader :id, :name, :current, :slots
|
16
|
+
class RPage
|
17
|
+
attr_reader :id, :name, :current, :runes
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
def initialize(params)
|
20
|
+
@id = params["id"]
|
21
|
+
@name = params["name"]
|
22
|
+
@current = params["current"]
|
23
|
+
|
24
|
+
@runes = Array.new()
|
25
|
+
|
26
|
+
if(params["slots"] != nil)
|
27
|
+
params["slots"].each do |r|
|
28
|
+
@runes.push(Nexus.get_rune_by_id(r["runeId"]))
|
29
|
+
end
|
30
|
+
else
|
31
|
+
@runes = []
|
25
32
|
end
|
26
|
-
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class Rune
|
37
|
+
attr_reader :id, :name, :description, :sanitizedDescription, :tags, :image, :stats, :tier, :type
|
38
|
+
|
39
|
+
def initialize(params)
|
40
|
+
@id = params["id"]
|
41
|
+
@name = params["name"]
|
42
|
+
@description = params["description"]
|
43
|
+
@sanitizedDescription = params["sanitizedDescription"]
|
44
|
+
@tags = params["tags"]
|
45
|
+
@image = params["image"]
|
46
|
+
@stats = params["stats"]
|
47
|
+
@tier = params["rune"]["tier"]
|
48
|
+
@type = params["rune"]["type"]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
27
52
|
end
|
data/lib/nexus/static.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
module Nexus
|
2
|
+
|
3
|
+
attr_accessor :global_uri
|
4
|
+
|
5
|
+
VERSION_STATIC = "v1.2"
|
6
|
+
|
7
|
+
@global_uri = "https://global.api.pvp.net/api/lol/static-data/"
|
8
|
+
|
9
|
+
def self.get_champion_by_name(champ_name,champData = "all")
|
10
|
+
url = ("#{@global_uri}#{@region}/#{VERSION_STATIC}/champion?champData=#{champData}&api_key=#{@api_key}")
|
11
|
+
response = retrieve_url get(url)
|
12
|
+
return Nexus::Champion.new(response["data"][champ_name.to_s])
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.get_champion_by_id(champ_id, champData = "all")
|
16
|
+
url = ("#{@global_uri}#{@region}/#{VERSION_STATIC}/champion/#{champ_id}?champData=#{champData}&api_key=#{@api_key}")
|
17
|
+
return Nexus::Champion.new(retrieve_url get(url))
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.get_items(itemData = "all")
|
21
|
+
url = ("#{@global_uri}#{@region}/#{VERSION_STATIC}/item?itemListData=#{itemData}&api_key=#{@api_key}")
|
22
|
+
response = retrieve_url get(url)
|
23
|
+
return (response["data"])
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.get_item_by_id(item_id, itemData = "all")
|
27
|
+
url = ("#{@global_uri}#{@region}/#{VERSION_STATIC}/item/#{item_id}?itemData=#{itemData}&api_key=#{@api_key}")
|
28
|
+
return Nexus::Item.new(retrieve_url get(url))
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
def self.get_masteries(masteryData = "all")
|
33
|
+
url = ("#{@global_uri}#{@region}/#{VERSION_STATIC}/mastery?masteryListData=#{masteryData}&api_key=#{@api_key}")
|
34
|
+
response = retrieve_url get(url)
|
35
|
+
return (response["data"])
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.get_mastery_by_id(mastery_id, masteryData = "all")
|
39
|
+
url = ("#{@global_uri}#{@region}/#{VERSION_STATIC}/mastery/#{mastery_id}?masteryData=#{masteryData}&api_key=#{@api_key}")
|
40
|
+
return Nexus::Mastery.new(retrieve_url get(url))
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.get_runes(runeData = "all")
|
44
|
+
url = ("#{@global_uri}#{@region}/#{VERSION_STATIC}/rune?runeListData=#{runeData}&api_key=#{@api_key}")
|
45
|
+
response = retrieve_url get(url)
|
46
|
+
return (response["data"])
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.get_rune_by_id(rune_id, runeData = "all")
|
50
|
+
url = ("#{@global_uri}#{@region}/#{VERSION_STATIC}/rune/#{rune_id}?runeData=#{runeData}&api_key=#{@api_key}")
|
51
|
+
return Nexus::Rune.new(retrieve_url get(url))
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.get_realm
|
55
|
+
url = ("#{@global_uri}#{@region}/#{VERSION_STATIC}/realm?api_key=#{@api_key}")
|
56
|
+
response = retrieve_url get(url)
|
57
|
+
return (response)
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.get_versions
|
61
|
+
url = ("#{@global_uri}#{@region}/#{VERSION_STATIC}/versions?api_key=#{@api_key}")
|
62
|
+
response = retrieve_url get(url)
|
63
|
+
return (response)
|
64
|
+
end
|
65
|
+
end
|
data/lib/nexus/summoner.rb
CHANGED
@@ -1,36 +1,28 @@
|
|
1
|
-
require "../lib/nexus/model/summoner"
|
2
|
-
require "../lib/nexus/model/runes"
|
3
|
-
require "../lib/nexus/model/masteries"
|
4
1
|
module Nexus
|
5
2
|
VERSION_SUMMONER = "v1.4"
|
6
3
|
|
7
4
|
def self.get_summoner_by_name(name)
|
8
5
|
url = (@uri + VERSION_SUMMONER + "/summoner/by-name/#{name}?api_key=#{@api_key}")
|
9
|
-
return Nexus::Summoner.new(
|
6
|
+
return Nexus::Summoner.new(retrieve_url_ident get(url), name)
|
10
7
|
end
|
11
8
|
|
12
9
|
def self.get_summoner_by_id(id)
|
13
10
|
url = (@uri + VERSION_SUMMONER + "/summoner/#{id}?api_key=#{@api_key}")
|
14
|
-
return Nexus::Summoner.new(
|
11
|
+
return Nexus::Summoner.new(retrieve_url_ident get(url), id)
|
15
12
|
end
|
16
13
|
|
17
14
|
def self.get_summoner_masteries(id)
|
18
15
|
url = (@uri + VERSION_SUMMONER + "/summoner/#{id}/masteries?api_key=#{@api_key}")
|
19
|
-
return Nexus::
|
16
|
+
return Nexus::PagesMasteries.new(retrieve_url_ident get(url), id)
|
20
17
|
end
|
21
18
|
|
22
19
|
def self.get_summoner_name(id)
|
23
20
|
url = (@uri + VERSION_SUMMONER + "/summoner/#{id}/name?api_key=#{@api_key}")
|
24
|
-
return
|
21
|
+
return retrieve_url_ident get(url), id
|
25
22
|
end
|
26
23
|
|
27
24
|
def self.get_summoner_runes(id)
|
28
25
|
url = (@uri + VERSION_SUMMONER + "/summoner/#{id}/runes?api_key=#{@api_key}")
|
29
|
-
return Nexus::
|
26
|
+
return Nexus::PagesRunes.new(retrieve_url_ident get(url), id)
|
30
27
|
end
|
31
|
-
|
32
|
-
private
|
33
|
-
def self.retrieve_url(response, ident)
|
34
|
-
response.parsed_response["#{ident.downcase}"]
|
35
|
-
end
|
36
28
|
end
|
data/lib/nexus/version.rb
CHANGED
data/lib/nexus.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require "httparty"
|
2
2
|
require '../lib/nexus/summoner'
|
3
|
+
require '../lib/nexus/static'
|
4
|
+
require '../lib/nexus/model/models'
|
3
5
|
|
4
6
|
module Nexus
|
5
7
|
include HTTParty
|
@@ -60,4 +62,13 @@ module Nexus
|
|
60
62
|
|
61
63
|
end
|
62
64
|
end
|
65
|
+
|
66
|
+
private
|
67
|
+
def self.retrieve_url_ident(response, ident)
|
68
|
+
response.parsed_response["#{ident.to_s.downcase}"]
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.retrieve_url(response)
|
72
|
+
response.parsed_response
|
73
|
+
end
|
63
74
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: the_nexus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gui Carneiro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -65,9 +65,13 @@ files:
|
|
65
65
|
- README.md
|
66
66
|
- Rakefile
|
67
67
|
- lib/nexus.rb
|
68
|
+
- lib/nexus/model/champion.rb
|
69
|
+
- lib/nexus/model/items.rb
|
68
70
|
- lib/nexus/model/masteries.rb
|
71
|
+
- lib/nexus/model/models.rb
|
69
72
|
- lib/nexus/model/runes.rb
|
70
73
|
- lib/nexus/model/summoner.rb
|
74
|
+
- lib/nexus/static.rb
|
71
75
|
- lib/nexus/summoner.rb
|
72
76
|
- lib/nexus/version.rb
|
73
77
|
- nexus.gemspec
|