Module: RiotLolApi::Request::Item

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

Instance Method Summary collapse

Instance Method Details

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



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

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

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



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

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