Class: OauthConsumerGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/oauth_consumer/oauth_consumer_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_routeObject



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/generators/oauth_consumer/oauth_consumer_generator.rb', line 19

def add_route
  route <<-ROUTE.strip
resources :oauth_consumers do
  member do
    get :callback
    get :callback2
    match 'client/*endpoint' => 'oauth_consumers#client', :via => [:get, :post, :put, :delete]
  end
end
ROUTE
end

#copy_controllerObject



13
14
15
# File 'lib/generators/oauth_consumer/oauth_consumer_generator.rb', line 13

def copy_controller
  template 'controller.rb', File.join('app', 'controllers', 'oauth_consumers_controller.rb')
end

#copy_modelsObject



9
10
11
# File 'lib/generators/oauth_consumer/oauth_consumer_generator.rb', line 9

def copy_models
  template 'oauth_config.rb',   File.join('config', 'initializers', 'oauth_consumers.rb')
end