Sha256: 009bce546066f08ea553440a93fe805acc68111babc8b398840425c77ee48250

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

module Agilib
  module Routing
    module MapperExtensions
      
      def agilib
        
        if Agilib.rails4? && Rails.env.development?
          root :to => "agilib/welcome#index", :as => :agilib_root
        end

        if Agilib.use_modules[:token_authenticatable].present?
          agilib_token_authenticatable
        end

        if Agilib.use_modules[:push_notification].present?
          agilib_push_notification
        end

      end

      def agilib_token_authenticatable
          route = Agilib::TokenAuthenticatable.route
          devise_scope :user do 
            post    "#{route}"        => "agilib/tokens#create"
            delete  "#{route}"        => "agilib/tokens#destroy"
            get     "#{route}/check"  => "agilib/tokens#check"
          end
      end

      def agilib_push_notification
        path = Agilib::PushNotification.device_route
        resources :devices, :path => path, :controller => "agilib/devices"
      end

    end
  end
end
if defined? ActionDispatch
  ActionDispatch::Routing::Mapper.send :include, Agilib::Routing::MapperExtensions
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
agilib-0.1.9 lib/agilib/routing.rb
agilib-0.1.8 lib/agilib/routing.rb
agilib-0.1.7 lib/agilib/routing.rb