Sha256: 988fb792de4adc3db145de105927e61525ebe5346a51fd90cc86b060f99ab7c4
Contents?: true
Size: 1.23 KB
Versions: 9
Compression:
Stored size: 1.23 KB
Contents
# frozen_string_literal: true module Decidim module BulletinBoard module Authority # This class handles the creation of an election. class CreateElection < Decidim::BulletinBoard::Command def initialize(election_id, election_data) @election_id = election_id @election_data = election_data end def call message_id = message_id(unique_election_id(election_id), "create_election") signed_data = sign_message(message_id, election_data) begin response = client.query do mutation do createElection(messageId: message_id, signedData: signed_data) do election do status end error end end end return broadcast(:error, response.data.create_election.error) if response.data.create_election.error.present? broadcast(:ok, response.data.create_election.election) rescue Graphlient::Errors::ServerError broadcast(:error, "Sorry, something went wrong") end end private attr_reader :election_data, :election_id end end end end
Version data entries
9 entries across 9 versions & 1 rubygems