spree/spree — pull request #5613 by gmacdougall (2014-11-14 20:56:32+00:00)
Title: Refactor gateway options to its own class.

I ran in to a problem where I wanted to customize the options that are being passed along to ActiveMerchant. This is something which happens commonly, as different gateways have many different requirements.

There wasn't an easy way to add a value to the hash, so I extracted the logic in to a separate class, making it easy to customize it in the future.

```Ruby
class CustomGatewayOptions < Spree::Payment::GatewayOptions
def hash_methods
super + [:extra_description]
end
def extra_description
"This is needed for some reason"
end
end
```

Then in an initializer:
```Ruby
Spree.config do |config|
config.class_gateway_options = 'CustomGatewayOptions'
end
```

This will allow these options to individually be changes by stores, and they can remove or add options as needed by overriding hash_methods.