fixed error for empty runes/mastery sites
This commit is contained in:
@@ -8,11 +8,13 @@ class MasteryBook
|
|||||||
def initialize(data)
|
def initialize(data)
|
||||||
@summonerId = data['summonerId']
|
@summonerId = data['summonerId']
|
||||||
@pages = []
|
@pages = []
|
||||||
|
if(data.has_key? 'pages')
|
||||||
data['pages'].each do |page|
|
data['pages'].each do |page|
|
||||||
@pages << MasteryPage.new(page)
|
@pages << MasteryPage.new(page)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Class to represent a page of a masterybook
|
# Class to represent a page of a masterybook
|
||||||
# @attr [Numeric] id ID of the page
|
# @attr [Numeric] id ID of the page
|
||||||
@@ -27,10 +29,12 @@ class MasteryPage
|
|||||||
@name = data['name']
|
@name = data['name']
|
||||||
@current = data['current']
|
@current = data['current']
|
||||||
@talents = []
|
@talents = []
|
||||||
|
if(data.has_key? 'talents')
|
||||||
data['talents'].each do |talent|
|
data['talents'].each do |talent|
|
||||||
@talents << Talent.new(talent)
|
@talents << Talent.new(talent)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -8,11 +8,13 @@ class RuneBook
|
|||||||
def initialize(data)
|
def initialize(data)
|
||||||
@summonerId = data['summonerId']
|
@summonerId = data['summonerId']
|
||||||
@pages = []
|
@pages = []
|
||||||
|
if(data.has_key? 'pages')
|
||||||
data['pages'].each do |page|
|
data['pages'].each do |page|
|
||||||
@pages << RunePage.new(page)
|
@pages << RunePage.new(page)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Class to represent a page of a runebook
|
# Class to represent a page of a runebook
|
||||||
# @attr [Numeric] id ID of the page
|
# @attr [Numeric] id ID of the page
|
||||||
@@ -27,10 +29,12 @@ class RunePage
|
|||||||
@name = data['name']
|
@name = data['name']
|
||||||
@current = data['current']
|
@current = data['current']
|
||||||
@slots = {}
|
@slots = {}
|
||||||
|
if(data.has_key? 'slots')
|
||||||
data['slots'].each do |slot|
|
data['slots'].each do |slot|
|
||||||
@slots[slot['runeSlotId']] = Rune.new(slot['rune'])
|
@slots[slot['runeSlotId']] = Rune.new(slot['rune'])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
Gem::Specification.new do |s|
|
Gem::Specification.new do |s|
|
||||||
s.name = 'sightstone'
|
s.name = 'sightstone'
|
||||||
s.version = '1.4.4'
|
s.version = '1.4.5'
|
||||||
s.date = '2014-03-17'
|
s.date = '2014-03-18'
|
||||||
s.summary = 'Ruby wrapper for riots league of legends api'
|
s.summary = 'Ruby wrapper for riots league of legends api'
|
||||||
s.description = s.summary
|
s.description = s.summary
|
||||||
s.authors = ["Daniel Bauer"]
|
s.authors = ["Daniel Bauer"]
|
||||||
|
|||||||
Reference in New Issue
Block a user