Class: Logistics::Core::AgencyPermitDocumentsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Logistics::Core::AgencyPermitDocumentsController
- Defined in:
- app/controllers/logistics/core/agency_permit_documents_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /agency_permit_documents POST /agency_permit_documents.json.
- #document_type ⇒ Object
-
#index ⇒ Object
GET /agency_permit_documents GET /agency_permit_documents.json.
-
#update ⇒ Object
PATCH/PUT /agency_permit_documents/1 PATCH/PUT /agency_permit_documents/1.json.
Instance Method Details
#create ⇒ Object
POST /agency_permit_documents POST /agency_permit_documents.json
23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/logistics/core/agency_permit_documents_controller.rb', line 23 def create @agency_permit_document = AgencyPermitDocument.new(agency_permit_document_params[:agency_permit_document]) if @agency_permit_document.save response = Mks::Common::MethodResponse.new(true, "Agency Permit Document successfully saved!", @agency_permit_document, nil, nil) else errors = Mks::Common::Util. @agency_permit_document, "Agency Permit Document" response = Mks::Common::MethodResponse.new(false, nil, nil, errors, nil) end render json: response end |
#document_type ⇒ Object
15 16 17 18 19 |
# File 'app/controllers/logistics/core/agency_permit_documents_controller.rb', line 15 def document_type data = ApplicationRecord.as_json(@agency_permit_document.document_type) response = Mks::Common::MethodResponse.new(true, nil, data, nil, nil) render json: response end |
#index ⇒ Object
GET /agency_permit_documents GET /agency_permit_documents.json
8 9 10 11 12 13 |
# File 'app/controllers/logistics/core/agency_permit_documents_controller.rb', line 8 def index agency_permit_documents = AgencyPermitDocument.where(agency_id: params[:agency_id]) data = ActiveModelSerializers::SerializableResource.new(agency_permit_documents).as_json response = Mks::Common::MethodResponse.new(true, nil, data, nil, nil) render json: response end |
#update ⇒ Object
PATCH/PUT /agency_permit_documents/1 PATCH/PUT /agency_permit_documents/1.json
36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/logistics/core/agency_permit_documents_controller.rb', line 36 def update if @agency_permit_document.update(agency_permit_document_params[:agency_permit_document]) response = Mks::Common::MethodResponse.new(true, "Agency Permit Document successfully updated!", @agency_permit_document, nil, nil) else errors = Mks::Common::Util. @agency_permit_document, "Agency Permit Document" response = Mks::Common::MethodResponse.new(false, nil, nil, errors, nil) end render json: response end |