Permalink
Browse files

api

  • Loading branch information...
1 parent bc5787a commit 1a837b19e316e42821b9ef0d2868bf9d35b68863 @dceballos dceballos committed Oct 11, 2013
@@ -0,0 +1,8 @@
+class Api::V1::PurchaseOrdersController < ApplicationController
+ respond_to :json
+
+ def search
+ po = PurchaseOrder.find_by_purchase_order_number(params[:po_number])
+ respond_with(po, :status => po.blank? ? 404 : 200)
+ end
+end
@@ -62,7 +62,7 @@
# :token = Support basic authentication with token authentication key
# :token_options = Support token authentication with options as defined in
# http://api.rubyonrails.org/classes/ActionController/HttpAuthentication/Token.html
- # config.http_authenticatable = false
+ config.http_authenticatable = true
# If http headers should be returned for AJAX requests. True by default.
# config.http_authenticatable_on_xhr = true
View
@@ -162,9 +162,18 @@
post 'update_company_uoms' => :update_company_uoms
post 'add_warehouse' => :add_warehouse
post 'add_user' => :add_user
-
end
+ namespace :api do
+ namespace :v1 do
+ resources :purchase_orders do
+ collection do
+ get 'search'
+ end
+ end
+ end
+ end
+
devise_for :user, :path => '', :path_names => { :sign_in => "login", :sign_out => "logout", :sign_up => "register" }
# You can have the root of your site routed with "root"
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 1a837b1

Please sign in to comment.