rubocop autofix
This commit is contained in:
@@ -13,6 +13,7 @@ AllCops:
|
||||
- 'config/initializers/*.rb'
|
||||
- 'config/environments/*.rb'
|
||||
- 'config/*.rb'
|
||||
- 'node_modules/**/*'
|
||||
NewCops: enable
|
||||
|
||||
Layout/LineLength:
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module ApplicationCable
|
||||
class Channel < ActionCable::Channel::Base
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module ApplicationCable
|
||||
class Connection < ActionCable::Connection::Base
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ApplicationController < ActionController::Base
|
||||
around_action :switch_locale
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class HomeController < ApplicationController
|
||||
def index
|
||||
end
|
||||
def index; end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ProtectedController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
include Pagy::Backend
|
||||
|
||||
@@ -3,25 +3,27 @@
|
||||
# Controller: Callback
|
||||
#
|
||||
# Description: Callback method for Bnet
|
||||
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
||||
skip_before_action :verify_authenticity_token, only: :bnet
|
||||
module Users
|
||||
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
||||
skip_before_action :verify_authenticity_token, only: :bnet
|
||||
|
||||
def bnet
|
||||
@user = User.from_omniauth(request.env['omniauth.auth'])
|
||||
def bnet
|
||||
@user = User.from_omniauth(request.env['omniauth.auth'])
|
||||
|
||||
if @user.persisted?
|
||||
sign_in_and_redirect @user, event: :authentication
|
||||
WowCharactersWorker.perform_async(@user.id)
|
||||
WowMountsCollectionWorker.perform_async(@user.id)
|
||||
WowPetsCollectionWorker.perform_async(@user.id)
|
||||
set_flash_message(:notice, :success, kind: 'Bnet') if is_navigational_format?
|
||||
else
|
||||
session['devise.bnet_data'] = request.env['omniauth.auth'].except(:extra)
|
||||
redirect_to new_user_registration_url
|
||||
if @user.persisted?
|
||||
sign_in_and_redirect @user, event: :authentication
|
||||
WowCharactersWorker.perform_async(@user.id)
|
||||
WowMountsCollectionWorker.perform_async(@user.id)
|
||||
WowPetsCollectionWorker.perform_async(@user.id)
|
||||
set_flash_message(:notice, :success, kind: 'Bnet') if is_navigational_format?
|
||||
else
|
||||
session['devise.bnet_data'] = request.env['omniauth.auth'].except(:extra)
|
||||
redirect_to new_user_registration_url
|
||||
end
|
||||
end
|
||||
|
||||
def failure
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
def failure
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowCharactersController < ProtectedController
|
||||
def index
|
||||
@wow_characters = current_user.wow_characters.all
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowMountsController < ProtectedController
|
||||
def index
|
||||
@pagy, @wow_mounts = pagy(WowMount.all, items: 12)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowPetsController < ProtectedController
|
||||
def index
|
||||
@pagy, @wow_pets = pagy(WowPet.all, items: 12)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module ApplicationHelper
|
||||
include Pagy::Frontend
|
||||
end
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module CharactersHelper
|
||||
end
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module HomeHelper
|
||||
end
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module ProtectedHelper
|
||||
end
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module WelcomeHelper
|
||||
end
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module WowMountsHelper
|
||||
end
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module WowPetsHelper
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ApplicationJob < ActiveJob::Base
|
||||
# Automatically retry jobs that encountered a deadlock
|
||||
# retry_on ActiveRecord::Deadlocked
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ApplicationMailer < ActionMailer::Base
|
||||
default from: 'from@example.com'
|
||||
layout 'mailer'
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ApplicationRecord < ActiveRecord::Base
|
||||
self.abstract_class = true
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class LearnedWowPetAbility < ApplicationRecord
|
||||
belongs_to :wow_pet
|
||||
belongs_to :wow_pet_ability
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class UserObtainWowMount < ApplicationRecord
|
||||
belongs_to :user
|
||||
belongs_to :wow_mount
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class UserObtainWowPet < ApplicationRecord
|
||||
belongs_to :user
|
||||
belongs_to :wow_pet
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowCharacter < ApplicationRecord
|
||||
extend Mobility
|
||||
translates :translated_faction, :translated_gender
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowCharacterMedium < ApplicationRecord
|
||||
belongs_to :wow_character
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowCharacterTitle < ApplicationRecord
|
||||
extend Mobility
|
||||
translates :name, :male_name, :female_name
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowClass < ApplicationRecord
|
||||
extend Mobility
|
||||
translates :name, :power_type, :male_name, :female_name
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowMount < ApplicationRecord
|
||||
extend Mobility
|
||||
translates :name, :description, :translated_faction, :translated_source
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowPet < ApplicationRecord
|
||||
extend Mobility
|
||||
translates :name, :translated_battle_pet_type, :description, :translated_source_type
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowPetAbility < ApplicationRecord
|
||||
extend Mobility
|
||||
translates :name, :translated_battle_pet_type
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowRace < ApplicationRecord
|
||||
extend Mobility
|
||||
translates :name, :translated_faction, :male_name, :female_name
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowRealm < ApplicationRecord
|
||||
extend Mobility
|
||||
translates :name, :category, :realm_type
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowCharacterDetailWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowCharacterMediaWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowCharacterTitleDetailWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowCharacterTitlesWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowCharactersWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowClassDetailWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowClassesWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
class WowMountDetailWorker < WowSidekiqWorker
|
||||
def locales
|
||||
super
|
||||
end
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowMountDetailWorker < WowSidekiqWorker
|
||||
def perform(mount_id)
|
||||
return unless (mount = WowMount.where(mount_id: mount_id).first)
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowMountsCollectionWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
class WowMountsWorker < WowSidekiqWorker
|
||||
def locales
|
||||
super
|
||||
end
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowMountsWorker < WowSidekiqWorker
|
||||
def perform
|
||||
RBattlenet.authenticate(client_id: ENV['BLIZZARD_API_CLIENT_ID'], client_secret: ENV['BLIZZARD_API_CLIENT_SECRET'])
|
||||
RBattlenet.set_options(locale: 'all')
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
class WowPetAbilitiesWorker < WowSidekiqWorker
|
||||
def locales
|
||||
super
|
||||
end
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowPetAbilitiesWorker < WowSidekiqWorker
|
||||
def perform
|
||||
RBattlenet.authenticate(client_id: ENV['BLIZZARD_API_CLIENT_ID'], client_secret: ENV['BLIZZARD_API_CLIENT_SECRET'])
|
||||
RBattlenet.set_options(locale: 'all')
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowPetAbilityDetailWorker < WowSidekiqWorker
|
||||
def locales
|
||||
super
|
||||
end
|
||||
|
||||
def perform(ability_id)
|
||||
|
||||
return unless (ability = WowPetAbility.where(ability_id: ability_id).first)
|
||||
|
||||
RBattlenet.set_options(locale: 'all')
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowPetDetailWorker < WowSidekiqWorker
|
||||
def locales
|
||||
super
|
||||
end
|
||||
|
||||
def perform(pet_id)
|
||||
|
||||
return unless (pet = WowPet.where(pet_id: pet_id).first)
|
||||
|
||||
RBattlenet.set_options(locale: 'all')
|
||||
@@ -39,12 +36,10 @@ class WowPetDetailWorker < WowSidekiqWorker
|
||||
creature_media = RBattlenet::Wow::CreatureMedia.find(pet.creature_display_id)
|
||||
pet.media_zoom_url = creature_media.assets.first.value if creature_media.status_code == 200
|
||||
|
||||
if result.abilities
|
||||
result.abilities.each do |ability|
|
||||
next unless (local_ability = WowPetAbility.where(ability_id: ability.ability.id).first)
|
||||
result.abilities&.each do |ability|
|
||||
next unless (local_ability = WowPetAbility.where(ability_id: ability.ability.id).first)
|
||||
|
||||
LearnedWowPetAbility.where(wow_pet: pet.id, wow_pet_ability: local_ability.id).first_or_create
|
||||
end
|
||||
LearnedWowPetAbility.where(wow_pet: pet.id, wow_pet_ability: local_ability.id).first_or_create
|
||||
end
|
||||
|
||||
pet.save
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowPetsCollectionWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
class WowPetsWorker < WowSidekiqWorker
|
||||
def locales
|
||||
super
|
||||
end
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowPetsWorker < WowSidekiqWorker
|
||||
def perform
|
||||
RBattlenet.authenticate(client_id: ENV['BLIZZARD_API_CLIENT_ID'], client_secret: ENV['BLIZZARD_API_CLIENT_SECRET'])
|
||||
RBattlenet.set_options(locale: 'all')
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowRaceDetailWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowRacesWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowRealmDetailWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowRealmsWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowSidekiqWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# This file is used by Rack-based servers to start the application.
|
||||
|
||||
require_relative 'config/environment'
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
# This file should contain all the record creation needed to seed the database with its default values.
|
||||
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user