# frozen_string_literal: true class WowRaceDetailWorker < WowSidekiqWorker def perform(race_id) return unless (race = WowRace.find_by(race_id: race_id)) RBattlenet.set_options(locale: 'all') result = RBattlenet::Wow::PlayableRace.find(race_id) return unless result.status_code == 200 race.faction = result.faction.type race.is_selectable = result.is_selectable race.is_allied_race = result.is_allied_race # Localisation data locales.each do |locale| Mobility.with_locale(locale[0]) do race.translated_faction = result.faction.name[locale[1]] race.male_name = result.gender_name.male[locale[1]] race.female_name = result.gender_name.female[locale[1]] end end race.save end end