From 098afc62c1ce0359025dcde5f0fa44aa18ff68c1 Mon Sep 17 00:00:00 2001 From: Rob Harrington Date: Wed, 13 Sep 2017 17:27:02 +1000 Subject: [PATCH] Fix rubocop issues --- .../spree/credit_cards_controller.rb | 2 +- app/models/spree/gateway/stripe_connect.rb | 2 +- .../api/admin/payment_method_serializer.rb | 18 +++++++++++------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/controllers/spree/credit_cards_controller.rb b/app/controllers/spree/credit_cards_controller.rb index a4b8ce9479..4582931dd0 100644 --- a/app/controllers/spree/credit_cards_controller.rb +++ b/app/controllers/spree/credit_cards_controller.rb @@ -30,7 +30,7 @@ module Spree flash[:error] = I18n.t(:card_could_not_be_removed) end redirect_to account_path(anchor: 'cards') - rescue Stripe::CardError => e + rescue Stripe::CardError flash[:error] = I18n.t(:card_could_not_be_removed) redirect_to account_path(anchor: 'cards') end diff --git a/app/models/spree/gateway/stripe_connect.rb b/app/models/spree/gateway/stripe_connect.rb index ba235d213d..f4a0435ace 100644 --- a/app/models/spree/gateway/stripe_connect.rb +++ b/app/models/spree/gateway/stripe_connect.rb @@ -35,7 +35,7 @@ module Spree provider.purchase(*options_for_purchase_or_auth(money, creditcard, gateway_options)) end - def void(response_code, creditcard, gateway_options) + def void(response_code, _creditcard, gateway_options) gateway_options[:stripe_account] = stripe_account_id provider.void(response_code, gateway_options) end diff --git a/app/serializers/api/admin/payment_method_serializer.rb b/app/serializers/api/admin/payment_method_serializer.rb index 342bc254fd..3d66ddbc03 100644 --- a/app/serializers/api/admin/payment_method_serializer.rb +++ b/app/serializers/api/admin/payment_method_serializer.rb @@ -1,11 +1,15 @@ -class Api::Admin::PaymentMethodSerializer < ActiveModel::Serializer - delegate :serializable_hash, to: :method_serializer +module Api + module Admin + class PaymentMethodSerializer < ActiveModel::Serializer + delegate :serializable_hash, to: :method_serializer - def method_serializer - if object.type == 'Spree::Gateway::StripeConnect' - Api::Admin::PaymentMethod::StripeSerializer.new(object) - else - Api::Admin::PaymentMethod::BaseSerializer.new(object) + def method_serializer + if object.type == 'Spree::Gateway::StripeConnect' + Api::Admin::PaymentMethod::StripeSerializer.new(object) + else + Api::Admin::PaymentMethod::BaseSerializer.new(object) + end + end end end end