Module: RiotLolApi::Request::Mastery

Included in:
Client
Defined in:
lib/riot_lol_api/requests/masteries.rb

Instance Method Summary collapse

Instance Method Details

#get_all_masteries(data = nil, locale = 'en_US') ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/riot_lol_api/requests/masteries.rb', line 4

def get_all_masteries(data = nil, locale = 'en_US')
  data.merge!(locale: locale)
  response = get(url: "static-data/#{@region}/v1.2/mastery", domaine: 'global', data: data)
  return nil if response.nil?
  tab_masteries = []
  response['data'].each do |mastery|
    tab_masteries << RiotLolApi::Model::Mastery.new(mastery[1].lol_symbolize.merge(client: self))
  end
  tab_masteries
end

#get_mastery_by_id(id, data = {}, locale = 'en_US') ⇒ Object



15
16
17
18
19
20
# File 'lib/riot_lol_api/requests/masteries.rb', line 15

def get_mastery_by_id(id, data = {}, locale = 'en_US')
  data.merge!(locale: locale)
  response = get(url: "static-data/#{@region}/v1.2/mastery/#{id}", domaine: 'global', data: data)
  return nil if response.nil?
  RiotLolApi::Model::Mastery.new(response.lol_symbolize.merge(client: self))
end