Class: Decidim::Conferences::DeclineInvitation

Inherits:
Decidim::Command show all
Defined in:
decidim-conferences/app/commands/decidim/conferences/decline_invitation.rb

Overview

This command is executed when the user declines an invite to the conference.

Instance Method Summary collapse

Methods inherited from Decidim::Command

call, #evaluate, #method_missing, #respond_to_missing?, #transaction, #with_events

Constructor Details

#initialize(conference, user) ⇒ DeclineInvitation

Initializes a DeclineInvitation Command.

conference - The current instance of the conference where user has been invited. user - The user that declines their invitation



11
12
13
14
# File 'decidim-conferences/app/commands/decidim/conferences/decline_invitation.rb', line 11

def initialize(conference, user)
  @conference = conference
  @user = user
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Decidim::Command

Instance Method Details

#callObject

Creates a conference registration if the conference has registrations enabled and there are available slots.

Broadcasts :ok if successful, :invalid otherwise.



20
21
22
23
24
25
26
# File 'decidim-conferences/app/commands/decidim/conferences/decline_invitation.rb', line 20

def call
  return broadcast(:invalid) unless can_decline_invitation?

  decline_invitation

  broadcast(:ok)
end