vigor 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/vigor.rb +52 -5
- metadata +18 -2
data/lib/vigor.rb
CHANGED
@@ -31,16 +31,26 @@ module Vigor
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def mastery_pages
|
34
|
-
|
35
|
-
|
34
|
+
@mastery_pages ||= Client.get("/summoner/" + @id.to_s + "/masteries")["pages"].map {|page| MasteryPage.new(page)}
|
35
|
+
end
|
36
|
+
|
37
|
+
def rune_pages
|
38
|
+
@rune_pages ||= Client.get("/summoner/" + @id.to_s + "/runes")["pages"].map {|page| RunePage.new(page)}
|
39
|
+
end
|
40
|
+
|
41
|
+
def current_mastery_page
|
42
|
+
mastery_pages.find {|page| page.current? }
|
43
|
+
end
|
44
|
+
|
45
|
+
def current_rune_page
|
46
|
+
rune_pages.find {|page| page.current? }
|
36
47
|
end
|
37
48
|
end
|
38
49
|
|
39
|
-
class
|
40
|
-
attr_accessor :
|
50
|
+
class Page
|
51
|
+
attr_accessor :name
|
41
52
|
|
42
53
|
def initialize(data)
|
43
|
-
@talents = data["talents"].map {|talent| Talent.new(talent)}
|
44
54
|
@name = data["name"]
|
45
55
|
@current = data["current"]
|
46
56
|
end
|
@@ -50,6 +60,17 @@ module Vigor
|
|
50
60
|
end
|
51
61
|
end
|
52
62
|
|
63
|
+
class MasteryPage < Page
|
64
|
+
attr_accessor :talents
|
65
|
+
|
66
|
+
def initialize(data)
|
67
|
+
super
|
68
|
+
|
69
|
+
return if data["talents"].nil?
|
70
|
+
@talents = data["talents"].map {|talent| Talent.new(talent)}
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
53
74
|
class Talent
|
54
75
|
attr_accessor :id, :rank, :name
|
55
76
|
|
@@ -59,4 +80,30 @@ module Vigor
|
|
59
80
|
@name = data["name"]
|
60
81
|
end
|
61
82
|
end
|
83
|
+
|
84
|
+
class RunePage < Page
|
85
|
+
attr_accessor :runes, :id
|
86
|
+
|
87
|
+
def initialize(data)
|
88
|
+
super
|
89
|
+
@id = data["id"]
|
90
|
+
|
91
|
+
return if data["slots"].nil?
|
92
|
+
@runes = data["slots"].map {|slot| Rune.new(slot)}
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
class Rune
|
97
|
+
attr_accessor :slot, :id, :description, :name, :tier
|
98
|
+
|
99
|
+
def initialize(data)
|
100
|
+
rune = data["rune"]
|
101
|
+
|
102
|
+
@slot = data["runeSlotId"]
|
103
|
+
@id = rune["id"]
|
104
|
+
@description = rune["description"]
|
105
|
+
@name = rune["name"]
|
106
|
+
@tier = rune["tier"]
|
107
|
+
end
|
108
|
+
end
|
62
109
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vigor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-12-
|
12
|
+
date: 2013-12-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: vcr
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
46
62
|
description: This aims to be a idiomatic Ruby wrapper for the League of Legends API.
|
47
63
|
Very much a work in progress at the moment.
|
48
64
|
email: peterborah@gmail.com
|