Class: CommandTower::Inbox::MessageController
- Inherits:
-
ApplicationController
- Object
- ActionController::API
- ApplicationController
- CommandTower::Inbox::MessageController
- Includes:
- PaginationHelper, SchemaHelper
- Defined in:
- app/controllers/command_tower/inbox/message_controller.rb
Constant Summary
Constants inherited from ApplicationController
ApplicationController::AUTHENTICATION_EXPIRE_HEADER, ApplicationController::AUTHENTICATION_HEADER, ApplicationController::AUTHENTICATION_WITH_RESET
Instance Method Summary collapse
-
#ack ⇒ Object
POST: /inbox/messages/ack Body { ids: [<list of ids to ack>] }.
-
#delete ⇒ Object
POST: /inbox/messages/delete Body { ids: [<list of ids to delete>] }.
-
#message ⇒ Object
GET: /inbox/messages/:id.
-
#metadata ⇒ Object
GET: /inbox/messages Pagination Available.
Methods included from PaginationHelper
#pagination_from_body, #pagination_from_query, #pagination_safe_integer_convert, #pagination_values
Methods included from SchemaHelper
#invalid_arguments!, #schema_succesful!
Methods inherited from ApplicationController
#authenticate_user!, #authenticate_user_without_email_verification!, #authorize_user!, #current_user, #safe_boolean
Instance Method Details
#ack ⇒ Object
POST: /inbox/messages/ack Body { ids: [<list of ids to ack>] }
48 49 50 |
# File 'app/controllers/command_tower/inbox/message_controller.rb', line 48 def ack modify(type: CommandTower::InboxService::Message::Modify::VIEWED) end |
#delete ⇒ Object
POST: /inbox/messages/delete Body { ids: [<list of ids to delete>] }
54 55 56 |
# File 'app/controllers/command_tower/inbox/message_controller.rb', line 54 def delete modify(type: CommandTower::InboxService::Message::Modify::DELETE) end |
#message ⇒ Object
GET: /inbox/messages/:id
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/command_tower/inbox/message_controller.rb', line 30 def result = CommandTower::InboxService::Message::Retrieve.(user: current_user, id: params[:id].to_i) if result.success? schema = result. status = 200 schema_succesful!(status:, schema:) else invalid_arguments!( status: 400, message: result.msg, argument_object: result.invalid_argument_hash, schema: CommandTower::Schema::PlainText::LoginRequest ) end end |
#metadata ⇒ Object
GET: /inbox/messages Pagination Available
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/command_tower/inbox/message_controller.rb', line 13 def result = CommandTower::InboxService::Message::Metadata.(user: current_user, pagination: pagination_values) if result.success? schema = result. status = 200 schema_succesful!(status:, schema:) else invalid_arguments!( status: 400, message: result.msg, argument_object: result.invalid_argument_hash, schema: CommandTower::Schema::PlainText::LoginRequest ) end end |