Class: Solidus::Migrations::RenameGateways
- Inherits:
-
Object
- Object
- Solidus::Migrations::RenameGateways
- Defined in:
- lib/solidus/migrations/rename_gateways.rb
Constant Summary collapse
- DEFAULT_MAPPING =
{ 'Spree::Gateway' => 'Spree::PaymentMethod::CreditCard', 'Spree::Gateway::Bogus' => 'Spree::PaymentMethod::BogusCreditCard', 'Spree::Gateway::BogusSimple' => 'Spree::PaymentMethod::SimpleBogusCreditCard' }
Instance Attribute Summary collapse
-
#gateway_mapping ⇒ Object
readonly
Returns the value of attribute gateway_mapping.
Instance Method Summary collapse
- #down ⇒ Object
-
#initialize(gateway_mapping = DEFAULT_MAPPING) ⇒ RenameGateways
constructor
A new instance of RenameGateways.
- #up ⇒ Object
Constructor Details
#initialize(gateway_mapping = DEFAULT_MAPPING) ⇒ RenameGateways
Returns a new instance of RenameGateways.
14 15 16 17 18 |
# File 'lib/solidus/migrations/rename_gateways.rb', line 14 def initialize(gateway_mapping = DEFAULT_MAPPING) Spree::Deprecation.warn 'Solidus::Migrations::RenameGateways is deprecated and will be removed with Solidus 3.0.' @gateway_mapping = gateway_mapping end |
Instance Attribute Details
#gateway_mapping ⇒ Object (readonly)
Returns the value of attribute gateway_mapping.
12 13 14 |
# File 'lib/solidus/migrations/rename_gateways.rb', line 12 def gateway_mapping @gateway_mapping end |
Instance Method Details
#down ⇒ Object
26 27 28 29 30 |
# File 'lib/solidus/migrations/rename_gateways.rb', line 26 def down gateway_mapping.inject(0) do |count, mapping| count + update(from: mapping[1], to: mapping[0]) end end |
#up ⇒ Object
20 21 22 23 24 |
# File 'lib/solidus/migrations/rename_gateways.rb', line 20 def up gateway_mapping.inject(0) do |count, mapping| count + update(from: mapping[0], to: mapping[1]) end end |