module Api
  module V2
    # Catgories REST API Controller
    class CategoriesController < BaseController
      before_filter :find_categories, only: [:index]
      before_filter :set_category, only: [:show]

      def index
        respond_with @categories
      end

      def show
        respond_with @category
      end

      protected

      def find_categories
        @categories = Category.all
      end

      def set_category
        @category = Category.find(params[:id])
      end
    end
  end
end
