Class: Lolxin::LolStaticData

Inherits:
Api
  • Object
show all
Defined in:
lib/lolxin/api/lol_static_data.rb

Constant Summary

Constants inherited from Api

Api::BASE_ENDPOINT

Instance Attribute Summary collapse

Attributes inherited from Api

#api_key, #conn, #region, #version

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ LolStaticData

Returns a new instance of LolStaticData.



5
6
7
8
# File 'lib/lolxin/api/lol_static_data.rb', line 5

def initialize(options = {})
  super
  @endpoint = "static-data/%{version}" % {version: @version}
end

Instance Attribute Details

#endpointObject

Returns the value of attribute endpoint.



3
4
5
# File 'lib/lolxin/api/lol_static_data.rb', line 3

def endpoint
  @endpoint
end

Instance Method Details

#champions(champion_id = nil) ⇒ Object

TODO: get Faraday block to work with optional params



11
12
13
14
15
16
17
18
19
# File 'lib/lolxin/api/lol_static_data.rb', line 11

def champions(champion_id = nil)
  url = if champion_id
               "#{endpoint}/champions/#{champion_id}"
             else
               "#{endpoint}/champions"
             end

  conn.get(url)
end

#items(item_id = nil) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/lolxin/api/lol_static_data.rb', line 21

def items(item_id = nil)
  url = if item_id
          "#{endpoint}/items/#{item_id}"
        else
          "#{endpoint}/items"
        end

  conn.get(url)
end

#language_stringsObject



31
32
33
34
# File 'lib/lolxin/api/lol_static_data.rb', line 31

def language_strings
  url = "#{endpoint}/language-strings"
  conn.get(url)
end

#languagesObject



36
37
38
39
# File 'lib/lolxin/api/lol_static_data.rb', line 36

def languages
  url = "#{endpoint}/languages"
  conn.get(url)
end

#mapsObject



41
42
43
44
# File 'lib/lolxin/api/lol_static_data.rb', line 41

def maps
  url = "#{endpoint}/maps"
  conn.get(url)
end

#masteries(mastery_id = nil) ⇒ Object



46
47
48
49
50
51
52
53
54
# File 'lib/lolxin/api/lol_static_data.rb', line 46

def masteries(mastery_id = nil)
  url = if mastery_id
          "#{endpoint}/masteries/#{mastery_id}"
        else
          "#{endpoint}/masteries"
        end

  conn.get(url)
end

#profile_iconsObject



56
57
58
59
# File 'lib/lolxin/api/lol_static_data.rb', line 56

def profile_icons
  url = "#{endpoint}/profile-icons"
  conn.get(url)
end

#realmsObject



61
62
63
64
# File 'lib/lolxin/api/lol_static_data.rb', line 61

def realms
  url = "#{endpoint}/realms"
  conn.get(url)
end

#reforged_rune_paths(path_id = nil) ⇒ Object



66
67
68
69
70
71
72
73
74
# File 'lib/lolxin/api/lol_static_data.rb', line 66

def reforged_rune_paths(path_id = nil)
  url = if path_id
          "#{endpoint}/reforged-rune-paths/#{path_id}"
        else
          "#{endpoint}/reforged-rune-paths"
        end

  conn.get(url)
end

#reforged_runes(reforged_rune_id = nil) ⇒ Object



76
77
78
79
80
81
82
83
84
# File 'lib/lolxin/api/lol_static_data.rb', line 76

def reforged_runes(reforged_rune_id = nil)
  url = if reforged_rune_id
          "#{endpoint}/reforged-runes/#{reforged_rune_id}"
        else
          "#{endpoint}/reforged-runes"
        end

  conn.get(url)
end

#runes(rune_id = nil) ⇒ Object



86
87
88
89
90
91
92
93
94
# File 'lib/lolxin/api/lol_static_data.rb', line 86

def runes(rune_id = nil)
  url = if rune_id
          "#{endpoint}/runes/#{rune_id}"
        else
          "#{endpoint}/runes"
        end

  conn.get(url)
end

#summoner_spells(spell_id = nil) ⇒ Object



96
97
98
99
100
101
102
103
104
# File 'lib/lolxin/api/lol_static_data.rb', line 96

def summoner_spells(spell_id = nil)
  url = if spell_id
          "#{endpoint}/summoner-spells/#{spell_id}"
        else
          "#{endpoint}/summoner-spells"
        end

  conn.get(url)
end


106
107
108
109
# File 'lib/lolxin/api/lol_static_data.rb', line 106

def tarball_links
  url = "#{endpoint}/tarball-links"
  conn.get(url)
end

#versionsObject



111
112
113
114
# File 'lib/lolxin/api/lol_static_data.rb', line 111

def versions
  url = "#{endpoint}/versions"
  conn.get(url)
end