Skip to content

Commit f7874f6

Browse files
committed
feat: add player icon to serialize
1 parent 1c08b47 commit f7874f6

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

app/serializers/player_serializer.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,23 @@ class PlayerSerializer < Blueprinter::Base
88
:solo_queue_wins, :solo_queue_losses,
99
:flex_queue_tier, :flex_queue_rank, :flex_queue_lp,
1010
:peak_tier, :peak_rank, :peak_season,
11-
:riot_puuid, :riot_summoner_id,
11+
:riot_puuid, :riot_summoner_id, :profile_icon_id,
1212
:twitter_handle, :twitch_channel, :instagram_handle,
1313
:notes, :sync_status, :last_sync_at, :created_at, :updated_at
1414

1515
field :age do |player|
1616
player.age
1717
end
1818

19+
field :avatar_url do |player|
20+
if player.profile_icon_id.present?
21+
# Use latest patch version from Data Dragon
22+
"https://ddragon.leagueoflegends.com/cdn/14.1.1/img/profileicon/#{player.profile_icon_id}.png"
23+
else
24+
nil
25+
end
26+
end
27+
1928
field :win_rate do |player|
2029
player.win_rate
2130
end

0 commit comments

Comments
 (0)