Class: RiotAPI::RunePage

Inherits:
Object
  • Object
show all
Defined in:
lib/riot_api/rune_page.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ RunePage

Returns a new instance of RunePage.



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/riot_api/rune_page.rb', line 5

def initialize(data)
	data.each do |key, value|
		key = key.underscore
		if key == "slots"
			self.slots = value
		else
			self.class.send(:attr_accessor, key.to_sym)
			instance_variable_set("@#{key}", value)
		end
	end
end

Instance Attribute Details

#slotsObject

Returns the value of attribute slots.



3
4
5
# File 'lib/riot_api/rune_page.rb', line 3

def slots
  @slots
end

Class Method Details

.find(region, summoner_id) ⇒ Object



17
18
19
20
21
22
# File 'lib/riot_api/rune_page.rb', line 17

def self.find(region, summoner_id)
	response = RiotAPI::Client.get(region, "summoner/#{summoner_id}/runes")
	response["pages"].map do |data|
		RiotAPI::MasteryPage.new(data)
	end
end