diff --git a/lib/sightstone/masterybook.rb b/lib/sightstone/masterybook.rb index b56918b..df889d1 100644 --- a/lib/sightstone/masterybook.rb +++ b/lib/sightstone/masterybook.rb @@ -8,8 +8,10 @@ class MasteryBook def initialize(data) @summonerId = data['summonerId'] @pages = [] - data['pages'].each do |page| - @pages << MasteryPage.new(page) + if(data.has_key? 'pages') + data['pages'].each do |page| + @pages << MasteryPage.new(page) + end end end end @@ -27,8 +29,10 @@ class MasteryPage @name = data['name'] @current = data['current'] @talents = [] - data['talents'].each do |talent| - @talents << Talent.new(talent) + if(data.has_key? 'talents') + data['talents'].each do |talent| + @talents << Talent.new(talent) + end end end diff --git a/lib/sightstone/runebook.rb b/lib/sightstone/runebook.rb index b6740f7..5ff60f7 100644 --- a/lib/sightstone/runebook.rb +++ b/lib/sightstone/runebook.rb @@ -8,8 +8,10 @@ class RuneBook def initialize(data) @summonerId = data['summonerId'] @pages = [] - data['pages'].each do |page| - @pages << RunePage.new(page) + if(data.has_key? 'pages') + data['pages'].each do |page| + @pages << RunePage.new(page) + end end end end @@ -27,8 +29,10 @@ class RunePage @name = data['name'] @current = data['current'] @slots = {} - data['slots'].each do |slot| - @slots[slot['runeSlotId']] = Rune.new(slot['rune']) + if(data.has_key? 'slots') + data['slots'].each do |slot| + @slots[slot['runeSlotId']] = Rune.new(slot['rune']) + end end end diff --git a/sightstone.gemspec b/sightstone.gemspec index 1f7edf3..eb548f0 100644 --- a/sightstone.gemspec +++ b/sightstone.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |s| s.name = 'sightstone' - s.version = '1.4.4' - s.date = '2014-03-17' + s.version = '1.4.5' + s.date = '2014-03-18' s.summary = 'Ruby wrapper for riots league of legends api' s.description = s.summary s.authors = ["Daniel Bauer"]