Class: ActionDispatch::Routing::Mapper

Inherits:
Object
  • Object
show all
Defined in:
lib/billingly/rails/routes.rb

Instance Method Summary collapse

Instance Method Details

#add_billingly_routes(skope = nil, controller = 'billingly/subscriptions') ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/billingly/rails/routes.rb', line 2

def add_billingly_routes(skope=nil, controller='billingly/subscriptions')
  route = lambda do 
    resources :subscriptions, controller: controller, only: [:index, :create] do
      collection do
        match 'invoice/:invoice_id' => :invoice, as: :invoice
        post :reactivate
        post :deactivate
      end
    end
    resources :redemptions, controller: 'billingly/redemptions', only: [:new, :create]
    get 'redeem' => "billingly/redemptions#new"
  end
  if skope then scope(skope, as: skope, &route) else route.call end
end