Class: Veritrans::PaymentFormGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Veritrans::PaymentFormGenerator
- Defined in:
- lib/generators/veritrans/payment_form_generator.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#append_javascript_file ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/generators/veritrans/payment_form_generator.rb', line 28 def append_javascript_file copy_file "assets/credit_card_form.js", "app/assets/javascripts/credit_card_form.js" insert_into_file "app/assets/javascripts/application.js", :after => %r{//= require +['"]?jquery['"]?$} do "\n//= require credit_card_form" end say_status "", %{ Sample form installed in you app! It contains example for VT-Web and VT-Direct Now open http://localhost:3000/payments/new } end |
#copy_controller ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/generators/veritrans/payment_form_generator.rb', line 15 def copy_controller copy_file "payments_controller.rb", "app/controllers/payments_controller.rb" route "resources :payments do\n" + " collection do\n" + " post :receive_webhook\n" + " end\n" + " end" copy_file "views/payments/new.erb", "app/views/payments/new.erb" copy_file "views/payments/create.erb", "app/views/payments/create.erb" end |
#copy_shared_views ⇒ Object
10 11 12 13 |
# File 'lib/generators/veritrans/payment_form_generator.rb', line 10 def copy_shared_views copy_file "views/_veritrans_include.erb", "app/views/shared/_veritrans_include.erb" copy_file "views/_credit_card_form.erb", "app/views/shared/_credit_card_form.erb" end |