Class: Stall::Routes
- Inherits:
-
Object
- Object
- Stall::Routes
- Defined in:
- lib/stall/routes.rb
Defined Under Namespace
Classes: CuratedProductListExistsConstraint, ProductCategoryExistsConstraint, ProductExistsConstraint
Instance Attribute Summary collapse
-
#router ⇒ Object
readonly
Returns the value of attribute router.
Instance Method Summary collapse
- #draw(mount_location) ⇒ Object
-
#initialize(router) ⇒ Routes
constructor
A new instance of Routes.
Constructor Details
#initialize(router) ⇒ Routes
Returns a new instance of Routes.
5 6 7 |
# File 'lib/stall/routes.rb', line 5 def initialize(router) @router = router end |
Instance Attribute Details
#router ⇒ Object (readonly)
Returns the value of attribute router.
3 4 5 |
# File 'lib/stall/routes.rb', line 3 def router @router end |
Instance Method Details
#draw(mount_location) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 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 63 64 |
# File 'lib/stall/routes.rb', line 9 def draw(mount_location) router.instance_eval do devise_for :users, Stall.config.devise_for_user_config devise_scope :user do get '/users/omniauth/:provider/redirect' => 'stall/omniauth_callbacks#redirect', as: :user_omniauth_redirect end scope mount_location, module: :stall do resources :products, only: [:index], as: :products constraints ProductExistsConstraint.new do resources :products, path: '/', only: [:show] end constraints CuratedProductListExistsConstraint.new do resources :curated_product_lists, path: '/', only: [:show] end constraints ProductCategoryExistsConstraint.new do resources :product_categories, path: '/', only: [:show] end resources :manufacturers, only: [:show] resources :carts do resources :line_items resource :credit, controller: 'cart_credits', only: [:update, :destroy] end get 'checkout/:cart_key' => 'checkouts#show', as: :checkout scope 'checkout', module: 'checkout', as: :checkout do scope '(:cart_key)' do resource :step, only: [:show, :update] do post '/', action: :update, as: :update get '/process', action: :update, as: :process # Allow external URLs process steps, allowing some payment # gateways to return the user through a POST request post '/process', action: :foreign_update get 'change/:step', action: :change, as: :change end end end scope '/:gateway' do resource :payment, only: [] do member do match 'notify', action: 'notify', via: [:get, :post] end end end end end end |