Class: Omnipay::AutosubmitForm
- Inherits:
-
Object
- Object
- Omnipay::AutosubmitForm
- Defined in:
- lib/omnipay/autosubmit_form.rb
Overview
This class is responsible for generating an html page which will redirect its visitor to an arbitrary url, with arbitrary POST parameters in the request body.
It does so by including an hidden form in the page, and submitting it via javascript on page load.
Constant Summary collapse
- HEADER =
<<-HEADER <!DOCTYPE html> <html> <head> <title>You are being redirected</title> </head> <body> <h1>Redirecting...</h1> HEADER
- FOOTER =
<<-FOOTER <script type="text/javascript"> document.getElementById('autosubmit-form').submit(); </script> </body> </html> FOOTER
Instance Method Summary collapse
-
#html ⇒ String
Returns the full html page.
-
#initialize(action, fields) ⇒ AutosubmitForm
constructor
Initializes the form with its action, and its inputs name/value pairs.
Constructor Details
#initialize(action, fields) ⇒ AutosubmitForm
Initializes the form with its action, and its inputs name/value pairs
35 36 37 38 |
# File 'lib/omnipay/autosubmit_form.rb', line 35 def initialize(action, fields) @action = action @fields = fields.map{|name, value| {:name => name, :value => value}} end |