Class: Decidim::BulletinBoard::Voter::GetPendingMessageStatus
- Defined in:
- lib/decidim/bulletin_board/voter/get_pending_message_status.rb
Overview
This command uses the GraphQL client to get the status of a specific pending message.
Instance Attribute Summary
Attributes inherited from Command
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(message_id) ⇒ GetPendingMessageStatus
constructor
Public: Initializes the command.
Methods inherited from Command
#build_message_id, #complete_message, #configure, #sign_message, #unique_election_id
Constructor Details
#initialize(message_id) ⇒ GetPendingMessageStatus
Public: Initializes the command.
form - A form object with the params.
11 12 13 |
# File 'lib/decidim/bulletin_board/voter/get_pending_message_status.rb', line 11 def initialize() @message_id = end |
Instance Method Details
#call ⇒ Object
Executes the command. Broadcasts these events:
-
:ok when everything is valid and the query operation is successful.
-
:error if the form wasn’t valid or the query operation was not successful.
Returns nothing.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/decidim/bulletin_board/voter/get_pending_message_status.rb', line 21 def call = @message_id begin response = graphql.query do query do pendingMessage(messageId: ) do status end end end broadcast(:ok, response.data..status) rescue Graphlient::Errors::ServerError broadcast(:error, "Sorry, something went wrong") end end |