continue to backport old code

This commit is contained in:
2021-04-24 00:24:05 +02:00
parent 5d7217f355
commit 04434760c5
72 changed files with 795 additions and 78 deletions

View File

@@ -0,0 +1,33 @@
class WowMountDetailWorker < WowSidekiqWorker
def locales
super
end
def perform(mount_id)
return unless (mount = WowMount.where(mount_id: mount_id).first)
RBattlenet.set_options(locale: 'all')
result = RBattlenet::Wow::Mount.find(mount_id)
return unless result.status_code == 200
mount.faction = result.faction.type if result.faction
# Localisation data
locales.each do |locale|
Mobility.with_locale(locale[0]) do
mount.translated_faction = result.faction.name[locale[1]] if result.faction
mount.description = result.description[locale[1]]
end
end
if result.creature_displays.first
mount.creature_display_id = result.creature_displays.first.id
media = RBattlenet::Wow::CreatureMedia.find(result.creature_displays.first.id)
mount.asset_zoom = media.assets.find { |asset| asset['key'] == 'zoom' }.value || nil
end
mount.save
end
end