add new api
This commit is contained in:
19
app/controllers/api/products_controller.rb
Normal file
19
app/controllers/api/products_controller.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
class Api::ProductsController < ApplicationController
|
||||
skip_before_filter :verify_authenticity_token
|
||||
|
||||
def index
|
||||
session_token=params[:session_token]
|
||||
check_member= Member.authenticate_session_token(session_token)
|
||||
if !check_member.nil?
|
||||
categories =ProductCategory.all
|
||||
arr_category=Array.new
|
||||
categories.each do |cat|
|
||||
str={:id => cat.id,:name => cat.name}
|
||||
arr_category.push(str)
|
||||
end
|
||||
@out=true,arr_category
|
||||
else
|
||||
@out=false,"Sorry!Unauthorized user!"
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user