Skip to content

Commit b9e4019

Browse files
committed
standardrb --fix
1 parent 2ac5ea7 commit b9e4019

58 files changed

Lines changed: 950 additions & 950 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Gemfile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
# frozen_string_literal: true
22

3-
source 'https://rubygems.org'
3+
source "https://rubygems.org"
44
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
55

6-
branch = ENV.fetch('SOLIDUS_BRANCH', 'main')
7-
gem 'solidus', github: 'solidusio/solidus', branch: branch
6+
branch = ENV.fetch("SOLIDUS_BRANCH", "main")
7+
gem "solidus", github: "solidusio/solidus", branch: branch
88

9-
gem 'rails', "~> #{ENV.fetch('RAILS_VERSION', '7.0')}"
9+
gem "rails", "~> #{ENV.fetch("RAILS_VERSION", "7.0")}"
1010

1111
# Provides basic authentication functionality for testing parts of your engine
12-
gem 'solidus_auth_devise'
12+
gem "solidus_auth_devise"
1313

14-
case ENV.fetch('DB', nil)
15-
when 'mysql'
16-
gem 'mysql2'
17-
when 'postgresql'
18-
gem 'pg'
14+
case ENV.fetch("DB", nil)
15+
when "mysql"
16+
gem "mysql2"
17+
when "postgresql"
18+
gem "pg"
1919
else
20-
gem 'sqlite3'
20+
gem "sqlite3"
2121
end
2222

2323
gemspec
@@ -27,4 +27,4 @@ gemspec
2727
#
2828
# We use `send` instead of calling `eval_gemfile` to work around an issue with
2929
# how Dependabot parses projects: https://github.com/dependabot/dependabot-core/issues/1658.
30-
send(:eval_gemfile, 'Gemfile-local') if File.exist? 'Gemfile-local'
30+
send(:eval_gemfile, "Gemfile-local") if File.exist? "Gemfile-local"

Rakefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# frozen_string_literal: true
22

3-
require 'bundler/gem_tasks'
4-
require 'solidus_dev_support/rake_tasks'
3+
require "bundler/gem_tasks"
4+
require "solidus_dev_support/rake_tasks"
55
SolidusDevSupport::RakeTasks.install
66

77
task :default do
8-
require 'bundler'
8+
require "bundler"
99
Bundler.with_unbundled_env do
10-
sh 'bin/rspec'
10+
sh "bin/rspec"
1111
end
1212
end
1313

14-
CLOBBER.include('dummy-app')
15-
CLOBBER.include('sandbox')
14+
CLOBBER.include("dummy-app")
15+
CLOBBER.include("sandbox")

app/decorators/models/solidus_braintree/spree_user_decorator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module SolidusBraintree
44
module SpreeUserDecorator
55
def self.prepended(base)
6-
base.has_one :braintree_customer, class_name: 'SolidusBraintree::Customer', inverse_of: :user
6+
base.has_one :braintree_customer, class_name: "SolidusBraintree::Customer", inverse_of: :user
77
end
88

99
::Spree.user_class.prepend self

app/helpers/solidus_braintree/braintree_admin_helper.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module SolidusBraintree
44
module BraintreeAdminHelper
55
# Returns a link to the Braintree web UI for the given Braintree payment
66
def braintree_transaction_link(payment)
7-
environment = payment.payment_method.preferred_environment == 'sandbox' ? 'sandbox' : 'www'
7+
environment = (payment.payment_method.preferred_environment == "sandbox") ? "sandbox" : "www"
88
merchant_id = payment.payment_method.preferred_merchant_id
99
response_code = payment.response_code
1010

@@ -14,9 +14,9 @@ def braintree_transaction_link(payment)
1414
link_to(
1515
response_code,
1616
"https://#{environment}.braintreegateway.com/merchants/#{merchant_id}/transactions/#{response_code}",
17-
title: 'Show payment on Braintree',
18-
target: '_blank',
19-
rel: 'noopener'
17+
title: "Show payment on Braintree",
18+
target: "_blank",
19+
rel: "noopener"
2020
)
2121
end
2222
end

app/models/solidus_braintree/avs_result.rb

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
11
# frozen_string_literal: true
22

3-
require 'active_merchant/billing/avs_result'
3+
require "active_merchant/billing/avs_result"
44

55
module SolidusBraintree
66
class AVSResult < ActiveMerchant::Billing::AVSResult
77
# Mapping took from ActiveMerchant::Billing::BraintreeBlueGateway
88
AVS_MAPPING = {
9-
'M' => {
10-
'M' => 'M',
11-
'N' => 'A',
12-
'U' => 'B',
13-
'I' => 'B',
14-
'A' => 'B'
9+
"M" => {
10+
"M" => "M",
11+
"N" => "A",
12+
"U" => "B",
13+
"I" => "B",
14+
"A" => "B"
1515
},
16-
'N' => {
17-
'M' => 'Z',
18-
'N' => 'C',
19-
'U' => 'C',
20-
'I' => 'C',
21-
'A' => 'C'
16+
"N" => {
17+
"M" => "Z",
18+
"N" => "C",
19+
"U" => "C",
20+
"I" => "C",
21+
"A" => "C"
2222
},
23-
'U' => {
24-
'M' => 'P',
25-
'N' => 'N',
26-
'U' => 'I',
27-
'I' => 'I',
28-
'A' => 'I'
23+
"U" => {
24+
"M" => "P",
25+
"N" => "N",
26+
"U" => "I",
27+
"I" => "I",
28+
"A" => "I"
2929
},
30-
'I' => {
31-
'M' => 'P',
32-
'N' => 'C',
33-
'U' => 'I',
34-
'I' => 'I',
35-
'A' => 'I'
30+
"I" => {
31+
"M" => "P",
32+
"N" => "C",
33+
"U" => "I",
34+
"I" => "I",
35+
"A" => "I"
3636
},
37-
'A' => {
38-
'M' => 'P',
39-
'N' => 'C',
40-
'U' => 'I',
41-
'I' => 'I',
42-
'A' => 'I'
37+
"A" => {
38+
"M" => "P",
39+
"N" => "C",
40+
"U" => "I",
41+
"I" => "I",
42+
"A" => "I"
4343
},
44-
'B' => {
45-
'B' => 'B'
44+
"B" => {
45+
"B" => "B"
4646
},
47-
nil => { nil => nil }
47+
nil => {nil => nil}
4848
}.freeze
4949

5050
class << self

app/models/solidus_braintree/base_record.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module SolidusBraintree
44
def self.table_name_prefix
5-
'solidus_paypal_braintree_'
5+
"solidus_paypal_braintree_"
66
end
77

88
class BaseRecord < ::Spree::Base

app/models/solidus_braintree/configuration.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,30 @@
33
module SolidusBraintree
44
class Configuration < BaseRecord
55
PAYPAL_BUTTON_PREFERENCES = {
6-
color: { availables: %w[gold blue silver white black], default: 'white' },
7-
shape: { availables: %w[pill rect], default: 'rect' },
8-
label: { availables: %w[checkout credit pay buynow paypal installment], default: 'checkout' },
9-
tagline: { availables: %w[true false], default: 'false' },
10-
layout: { availables: %w[horizontal vertical], default: 'horizontal' },
11-
messaging: { availables: %w[true false], default: 'false' }
6+
color: {availables: %w[gold blue silver white black], default: "white"},
7+
shape: {availables: %w[pill rect], default: "rect"},
8+
label: {availables: %w[checkout credit pay buynow paypal installment], default: "checkout"},
9+
tagline: {availables: %w[true false], default: "false"},
10+
layout: {availables: %w[horizontal vertical], default: "horizontal"},
11+
messaging: {availables: %w[true false], default: "false"}
1212
}.freeze
1313

1414
include ::Spree::Preferences::Persistable
1515

16-
belongs_to :store, class_name: 'Spree::Store', optional: false
16+
belongs_to :store, class_name: "Spree::Store", optional: false
1717

1818
# Preferences for Paypal button
1919
PAYPAL_BUTTON_PREFERENCES.each do |name, desc|
20-
preference_name = "paypal_button_#{name}".to_sym
21-
attribute_name = "preferred_#{preference_name}".to_sym
20+
preference_name = :"paypal_button_#{name}"
21+
attribute_name = :"preferred_#{preference_name}"
2222

2323
preference preference_name, :string, default: desc[:default]
2424

2525
validates attribute_name, inclusion: desc[:availables]
2626
end
2727

28-
preference :venmo_button_color, :preference_select, default: 'blue'
29-
preference :venmo_button_width, :preference_select, default: '320'
28+
preference :venmo_button_color, :preference_select, default: "blue"
29+
preference :venmo_button_width, :preference_select, default: "320"
3030

3131
def preferred_venmo_button_color_options
3232
[["Blue", "blue"], ["White", "white"]]

app/models/solidus_braintree/gateway.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
require 'solidus_braintree/request_protection'
3+
require "solidus_braintree/request_protection"
44

55
module SolidusBraintree
66
class Gateway < ::Spree::PaymentMethod
@@ -11,9 +11,9 @@ class TokenGenerationDisabledError < StandardError; end
1111
# Error message from Braintree that gets returned by a non voidable transaction
1212
NON_VOIDABLE_STATUS_ERROR_REGEXP = /can only be voided if status is authorized/
1313

14-
TOKEN_GENERATION_DISABLED_MESSAGE = 'Token generation is disabled. ' \
15-
'To re-enable set the `token_generation_enabled` preference on the ' \
16-
'gateway to `true`.'
14+
TOKEN_GENERATION_DISABLED_MESSAGE = "Token generation is disabled. " \
15+
"To re-enable set the `token_generation_enabled` preference on the " \
16+
"gateway to `true`."
1717

1818
ALLOWED_BRAINTREE_OPTIONS = [
1919
:device_data,
@@ -35,17 +35,17 @@ class TokenGenerationDisabledError < StandardError; end
3535
preference(:token_generation_enabled, :boolean, default: true)
3636

3737
# Preferences for configuration of Braintree credentials
38-
preference(:environment, :string, default: 'sandbox')
38+
preference(:environment, :string, default: "sandbox")
3939
preference(:merchant_id, :string, default: nil)
40-
preference(:public_key, :string, default: nil)
40+
preference(:public_key, :string, default: nil)
4141
preference(:private_key, :string, default: nil)
4242
preference(:http_open_timeout, :integer, default: 60)
4343
preference(:http_read_timeout, :integer, default: 60)
4444
preference(:merchant_currency_map, :hash, default: {})
4545
preference(:paypal_payee_email_map, :hash, default: {})
4646

4747
# Which checkout flow to use (vault/checkout)
48-
preference(:paypal_flow, :string, default: 'vault')
48+
preference(:paypal_flow, :string, default: "vault")
4949

5050
# A hash that gets passed to the `style` key when initializing the credit card fields.
5151
# See https://developers.braintreepayments.com/guides/hosted-fields/styling/javascript/v3
@@ -301,7 +301,7 @@ def reusable_sources(order)
301301
# Whether to store this payment method in the PayPal Vault. This only works when the checkout
302302
# flow is "vault", so make sure to call +super+ if you override it.
303303
def store_in_vault
304-
preferred_paypal_flow == 'vault'
304+
preferred_paypal_flow == "vault"
305305
end
306306

307307
def logger
@@ -339,18 +339,18 @@ def transaction_options(source, options, submit_for_settlement: false)
339339
end
340340

341341
params[:channel] = "Solidus"
342-
params[:options] = { store_in_vault_on_success: store_in_vault }
342+
params[:options] = {store_in_vault_on_success: store_in_vault}
343343

344344
if submit_for_settlement
345345
params[:options][:submit_for_settlement] = true
346346
end
347347

348348
if paypal_email = paypal_payee_email_for(source, options)
349-
params[:options][:paypal] = { payee_email: paypal_email }
349+
params[:options][:paypal] = {payee_email: paypal_email}
350350
end
351351

352352
if source.venmo? && venmo_business_profile_id
353-
params[:options][:venmo] = { profile_id: venmo_business_profile_id }
353+
params[:options][:venmo] = {profile_id: venmo_business_profile_id}
354354
end
355355

356356
if merchant_account_id = merchant_account_for(source, options)

app/models/solidus_braintree/response.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

3-
require 'active_merchant/billing/response'
4-
require_relative 'avs_result'
3+
require "active_merchant/billing/response"
4+
require_relative "avs_result"
55

66
# Response object that all actions on the gateway should return
77
module SolidusBraintree
@@ -57,21 +57,21 @@ def error_message(result)
5757
# Human readable error message for transaction responses
5858
def transaction_error_message(transaction)
5959
case transaction.status
60-
when 'gateway_rejected'
60+
when "gateway_rejected"
6161
I18n.t(transaction.gateway_rejection_reason,
62-
scope: 'solidus_braintree.gateway_rejection_reasons',
62+
scope: "solidus_braintree.gateway_rejection_reasons",
6363
default: "#{transaction.status.humanize} #{transaction.gateway_rejection_reason.humanize}")
64-
when 'processor_declined'
64+
when "processor_declined"
6565
I18n.t(transaction.processor_response_code,
66-
scope: 'solidus_braintree.processor_response_codes',
66+
scope: "solidus_braintree.processor_response_codes",
6767
default: "#{transaction.processor_response_text} (#{transaction.processor_response_code})")
68-
when 'settlement_declined'
68+
when "settlement_declined"
6969
I18n.t(transaction.processor_settlement_response_code,
70-
scope: 'solidus_braintree.processor_settlement_response_codes',
70+
scope: "solidus_braintree.processor_settlement_response_codes",
7171
default: "#{transaction.processor_settlement_response_text} (#{transaction.processor_settlement_response_code})") # rubocop:disable Layout/LineLength
7272
else
7373
I18n.t(transaction.status,
74-
scope: 'solidus_braintree.transaction_statuses',
74+
scope: "solidus_braintree.transaction_statuses",
7575
default: transaction.status.humanize)
7676
end
7777
end

app/models/solidus_braintree/source.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
require 'solidus_braintree/request_protection'
3+
require "solidus_braintree/request_protection"
44

55
module SolidusBraintree
66
class Source < ::Spree::PaymentSource
@@ -20,7 +20,7 @@ class Source < ::Spree::PaymentSource
2020
}, suffix: :funding
2121

2222
belongs_to :user, class_name: ::Spree::UserClassHandle.new, optional: true
23-
belongs_to :payment_method, class_name: 'Spree::PaymentMethod'
23+
belongs_to :payment_method, class_name: "Spree::PaymentMethod"
2424
has_many :payments, as: :source, class_name: "Spree::Payment", dependent: :destroy
2525

2626
belongs_to :customer, class_name: "SolidusBraintree::Customer", optional: true
@@ -100,18 +100,18 @@ def display_number
100100
elsif venmo?
101101
username
102102
else
103-
"XXXX-XXXX-XXXX-#{last_digits.to_s.rjust(4, 'X')}"
103+
"XXXX-XXXX-XXXX-#{last_digits.to_s.rjust(4, "X")}"
104104
end
105105
end
106106

107107
def display_paypal_funding_source
108108
I18n.t(paypal_funding_source,
109-
scope: 'solidus_braintree.paypal_funding_sources',
109+
scope: "solidus_braintree.paypal_funding_sources",
110110
default: paypal_funding_source)
111111
end
112112

113113
def display_payment_type
114-
"#{I18n.t('solidus_braintree.payment_type.label')}: #{friendly_payment_type}"
114+
"#{I18n.t("solidus_braintree.payment_type.label")}: #{friendly_payment_type}"
115115
end
116116

117117
private

0 commit comments

Comments
 (0)