Implement into existing modules
manuelvanrijn edited this page Feb 16, 2012
·
14 revisions
Here's a list with examples how to use this gem in combination with some API/Frameworks. Feel free to extend this list with your own examples.
Add the mollie-bank
to your Gemfile
gem 'mollie-bank'
Change you config.ru
so it will run the mollie-bank when you start the rails server. For example, change this:
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run YourRailsApplicationName::Application
into:
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
require 'mollie-bank'
# - Make sinatra play nice
use Rack::MethodOverride
disable :run, :reload
map "/" do
run YourRailsApplicationName::Application
end
configure(:development) {
map "/mollie-bank" do
run MollieBank::Application
end
}
At this point you can access the "Mollie Bank" through http://localhost:3000/mollie-bank/ because we mapped /mollie-bank
to the Mollie Bank application.
All xml communication should now be rerouted to http://localhost:3000/mollie-bank/xml/ideal in development mode.
If you are using the ideal-mollie gem, you have to add two additional lines to you're config.ru
file
configure(:development) {
map "/mollie-bank" do
IdealMollie.send(:remove_const, 'MOLLIE_URL')
IdealMollie.const_set('MOLLIE_URL', 'http://localhost:3000/mollie-bank/xml/ideal')
run MollieBank::Application
end
}