Class: TokenAuth::Api::PayloadsController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- TokenAuth::Api::PayloadsController
- Includes:
- Concerns::CorsSettings
- Defined in:
- app/controllers/token_auth/api/payloads_controller.rb
Overview
Processes inbound and outbound resources.
Instance Attribute Summary collapse
-
#authentication_token ⇒ Object
readonly
Returns the value of attribute authentication_token.
Instance Method Summary collapse
Methods included from Concerns::CorsSettings
#cors_set_access_control_headers
Instance Attribute Details
#authentication_token ⇒ Object (readonly)
Returns the value of attribute authentication_token.
10 11 12 |
# File 'app/controllers/token_auth/api/payloads_controller.rb', line 10 def authentication_token @authentication_token end |
Instance Method Details
#create ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/token_auth/api/payloads_controller.rb', line 32 def create authenticate! payload = Payload.new(entity_id: authentication_token.entity_id) payload.save request_data headers["Errors"] = payload.errors.join(", ") render json: payload.valid_resources, status: 201 rescue TokenAuth::Payload::MalformedPayloadError render json: {}, status: 400 end |
#index ⇒ Object
22 23 24 25 26 |
# File 'app/controllers/token_auth/api/payloads_controller.rb', line 22 def index authenticate! render json: pullable_records, meta: { timestamp: Time.zone.now.iso8601 } end |
#options ⇒ Object
28 29 30 |
# File 'app/controllers/token_auth/api/payloads_controller.rb', line 28 def render json: {}, status: 200 end |