Class: StripeCallbackGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/stripe_callback/stripe_callback_generator.rb

Instance Method Summary collapse

Constructor Details

#initialize(args, *options) ⇒ StripeCallbackGenerator

:nodoc:



4
5
6
7
# File 'lib/generators/stripe_callback/stripe_callback_generator.rb', line 4

def initialize(args, *options) #:nodoc:
  args[0] = args[0].gsub(/\./,'_')
  super
end

Instance Method Details

#create_callback_fileObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/generators/stripe_callback/stripe_callback_generator.rb', line 9

def create_callback_file
  create_file "app/stripe_callbacks/#{file_name}_callback.rb", <<-FILE
class #{class_name}Callback < StripeRails::Callback

# Some logic to process during the callback
def actions

  # The response hash
  @response = {success: true}

end

end
  FILE
end