lol_data_fetcher 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/lib/lol_data_fetcher/cli.rb +16 -6
- data/lib/lol_data_fetcher/resources/champions.rb +7 -0
- data/lib/lol_data_fetcher/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7cf99a663e6a86de3bb2bab4aa9a2237dbe6a6fb4400429f0c0866c605472426
|
|
4
|
+
data.tar.gz: c99bb67f229a840db389e1324ace988992d8768b402d43cb5c4c913d595c36e7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fbf7a156f906d9b9c2182da7c9e9da80a91acadfee7870b9cda9f7c2628ac928ebace11345d589303e47aff524919c22ba98d328ae134337044eeb31778ded02
|
|
7
|
+
data.tar.gz: 69f2a49fe2999c5706f50a9bc2b989e126ee5b3aee5158658e230c50bfa7e5b64499747a2d45b137fa69f0be6a465d627ffcaa2e5b04bc323dd17a141219b8d2
|
data/README.md
CHANGED
|
@@ -67,6 +67,14 @@ ahri_data = ahri["data"]["Ahri"]
|
|
|
67
67
|
puts ahri_data["name"] # => "Ahri"
|
|
68
68
|
puts ahri_data["title"] # => "the Nine-Tailed Fox"
|
|
69
69
|
|
|
70
|
+
# Access champion's passive ability
|
|
71
|
+
passive = ahri_data["passive"]
|
|
72
|
+
puts "#{passive['name']}: #{passive['description']}"
|
|
73
|
+
|
|
74
|
+
# Or use the helper method
|
|
75
|
+
passive = client.champions.passive("Ahri")
|
|
76
|
+
puts "#{passive['name']}: #{passive['description']}"
|
|
77
|
+
|
|
70
78
|
# Access champion spells/skills
|
|
71
79
|
ahri_data["spells"].each do |spell|
|
|
72
80
|
puts "#{spell['name']}: #{spell['description']}"
|
|
@@ -267,6 +275,7 @@ client = LolDataFetcher::Client.new(version: "15.23.1", language: "en_US")
|
|
|
267
275
|
```ruby
|
|
268
276
|
client.champions.all # Get all champions (overview)
|
|
269
277
|
client.champions.find("Ahri") # Get detailed champion data
|
|
278
|
+
client.champions.passive("Ahri") # Get champion's passive ability
|
|
270
279
|
client.champions.list_names # List all champion names
|
|
271
280
|
client.champions.find_by_id("103") # Find champion by ID
|
|
272
281
|
```
|
data/lib/lol_data_fetcher/cli.rb
CHANGED
|
@@ -62,12 +62,22 @@ module LolDataFetcher
|
|
|
62
62
|
puts "\nLore:"
|
|
63
63
|
puts word_wrap(champion_data["lore"])
|
|
64
64
|
|
|
65
|
-
if options[:skills]
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
puts "\
|
|
70
|
-
puts " #{word_wrap(strip_html(
|
|
65
|
+
if options[:skills]
|
|
66
|
+
# Display passive ability
|
|
67
|
+
if champion_data["passive"]
|
|
68
|
+
passive = champion_data["passive"]
|
|
69
|
+
puts "\nPassive: #{passive['name']}"
|
|
70
|
+
puts " #{word_wrap(strip_html(passive['description']), 3)}"
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Display active spells/abilities
|
|
74
|
+
if champion_data["spells"]
|
|
75
|
+
puts "\n#{champion_data['name']}'s Skills:"
|
|
76
|
+
puts "-" * 50
|
|
77
|
+
champion_data["spells"].each_with_index do |spell, idx|
|
|
78
|
+
puts "\n#{idx + 1}. #{spell['name']}"
|
|
79
|
+
puts " #{word_wrap(strip_html(spell['description']), 3)}"
|
|
80
|
+
end
|
|
71
81
|
end
|
|
72
82
|
end
|
|
73
83
|
|
|
@@ -17,6 +17,13 @@ module LolDataFetcher
|
|
|
17
17
|
get(cdn_path("champion/#{name}"))
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
+
# Get passive ability for a specific champion
|
|
21
|
+
# @param name [String] Champion name (e.g., "Ahri", "MasterYi")
|
|
22
|
+
# @return [Hash, nil] Passive ability data or nil if not found
|
|
23
|
+
def passive(name)
|
|
24
|
+
find(name).dig("data", name, "passive")
|
|
25
|
+
end
|
|
26
|
+
|
|
20
27
|
# List all champion names
|
|
21
28
|
# @return [Array<String>] Array of champion names
|
|
22
29
|
def list_names
|