Skip to content

Commit 710b012

Browse files
committed
fix: adjust cdn and match serializer
1 parent 3222fec commit 710b012

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

app/serializers/player_match_stat_serializer.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,10 @@ class PlayerMatchStatSerializer < Blueprinter::Base
7676
# I'll add a `spell_icon_url_by_name` to the service or just handle it here.
7777
# Let's keep it simple:
7878

79+
cdn = RiotCdnService.new
7980
{
8081
name: spell_name,
81-
icon_url: "#{RiotCdnService::BASE_URL}/#{RiotCdnService::DEFAULT_VERSION}/img/spell/#{spell_name}.png"
82+
icon_url: "#{RiotCdnService::BASE_URL}/#{cdn.cached_latest_version}/img/spell/#{spell_name}.png"
8283
}
8384
end
8485
end

app/serializers/scouting_target_serializer.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ class ScoutingTargetSerializer < Blueprinter::Base
3131
field :avatar_url do |target|
3232
target.avatar_url || target.metadata&.dig('avatar_url') || begin
3333
icon_id = target.profile_icon_id || target.metadata&.dig('profile_icon_id')
34-
icon_id ? "https://ddragon.leagueoflegends.com/cdn/14.1.1/img/profileicon/#{icon_id}.png" : nil
34+
if icon_id
35+
cdn = RiotCdnService.new
36+
"https://ddragon.leagueoflegends.com/cdn/#{cdn.cached_latest_version}/img/profileicon/#{icon_id}.png"
37+
end
3538
end
3639
end
3740

0 commit comments

Comments
 (0)