Class: RiotLolApi::Model::Mastery

Inherits:
Object
  • Object
show all
Defined in:
lib/riot_lol_api/model/masteries.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Mastery

Returns a new instance of Mastery.



5
6
7
8
9
10
# File 'lib/riot_lol_api/model/masteries.rb', line 5

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

Instance Method Details

#infos(data = nil, locale = 'fr_FR') ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/riot_lol_api/model/masteries.rb', line 12

def infos data = nil, locale = 'fr_FR'
  if data.nil?
    data = {:locale => locale}
  else
    data.merge!({:locale => locale})
  end

  # hack : set region by default euw
  response = Client.get("static-data/euw/v1.2/mastery/#{@id}","global",data)
  unless response.nil?
    RiotLolApi::Model::Mastery.new(response.to_symbol)
  else
    nil
  end
end