Class: KapsoClientRuby::Rails::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/kapso_client_ruby/rails/generators/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_routesObject



29
30
31
32
33
34
35
# File 'lib/kapso_client_ruby/rails/generators/install_generator.rb', line 29

def add_routes
  route "    # Kapso webhook endpoint\n    post '/webhooks/kapso', to: 'kapso_webhooks#create'\n    get '/webhooks/kapso', to: 'kapso_webhooks#verify' # For webhook verification\n  RUBY\nend\n"

#create_env_exampleObject



17
18
19
# File 'lib/kapso_client_ruby/rails/generators/install_generator.rb', line 17

def create_env_example
  template 'env.erb', '.env.example'
end

#create_initializerObject



13
14
15
# File 'lib/kapso_client_ruby/rails/generators/install_generator.rb', line 13

def create_initializer
  template 'initializer.rb.erb', 'config/initializers/kapso_client_ruby.rb'
end

#create_service_exampleObject



25
26
27
# File 'lib/kapso_client_ruby/rails/generators/install_generator.rb', line 25

def create_service_example
  template 'message_service.rb.erb', 'app/services/kapso_message_service.rb'
end

#create_webhook_controllerObject



21
22
23
# File 'lib/kapso_client_ruby/rails/generators/install_generator.rb', line 21

def create_webhook_controller
  template 'webhook_controller.rb.erb', 'app/controllers/kapso_webhooks_controller.rb'
end

#show_readmeObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/kapso_client_ruby/rails/generators/install_generator.rb', line 37

def show_readme
  say "\n    KapsoClientRuby has been successfully installed!\n\n    Next steps:\n    1. Add your Kapso credentials to your environment variables:\n       - KAPSO_API_KEY\n       - KAPSO_PHONE_NUMBER_ID\n       - KAPSO_BUSINESS_ACCOUNT_ID\n\n    2. Review and customize the generated files:\n       - config/initializers/kapso_client_ruby.rb\n       - app/controllers/kapso_webhooks_controller.rb\n       - app/services/kapso_message_service.rb\n\n    3. Set up your webhook URL in the Kapso dashboard:\n       https://yourapp.com/webhooks/kapso\n\n    4. Test the integration:\n       rails runner \"KapsoMessageService.new.send_test_message\"\n\n    For more information, see: https://github.com/PabloB07/kapso-client-ruby\n\n  MESSAGE\nend\n"