Module: Api::V1::Invitations::ControllerBase
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/controllers/concerns/api/v1/invitations/controller_base.rb
Defined Under Namespace
Modules: StrongParameters
Instance Method Summary collapse
-
#create ⇒ Object
POST /api/v1/teams/:team_id/invitations.
-
#destroy ⇒ Object
DELETE /api/v1/invitations/:id.
-
#index ⇒ Object
GET /api/v1/teams/:team_id/invitations.
-
#resend ⇒ Object
POST /api/v1/invitations/1/resend.
-
#show ⇒ Object
GET /api/v1/invitations/:id.
Instance Method Details
#create ⇒ Object
POST /api/v1/teams/:team_id/invitations
40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/concerns/api/v1/invitations/controller_base.rb', line 40 def create @invitation.membership.team = current_team # this allows notifications to be sent to a user before they've accepted their invitation. @invitation.membership.user_email = @invitation.email @invitation.from_membership = current_membership if @invitation.save render :show, status: :created, location: [:api, :v1, @invitation] else render json: @invitation.errors, status: :unprocessable_entity end end |
#destroy ⇒ Object
DELETE /api/v1/invitations/:id
63 64 65 |
# File 'app/controllers/concerns/api/v1/invitations/controller_base.rb', line 63 def destroy @invitation.destroy end |
#index ⇒ Object
GET /api/v1/teams/:team_id/invitations
32 33 |
# File 'app/controllers/concerns/api/v1/invitations/controller_base.rb', line 32 def index end |
#resend ⇒ Object
POST /api/v1/invitations/1/resend
53 54 55 56 57 58 59 60 |
# File 'app/controllers/concerns/api/v1/invitations/controller_base.rb', line 53 def resend if @invitation.touch UserMailer.invited(params[:id]).deliver_later render :show, status: :ok, location: [:api, :v1, @invitation] else render json: @invitation.errors, status: :unprocessable_entity end end |
#show ⇒ Object
GET /api/v1/invitations/:id
36 37 |
# File 'app/controllers/concerns/api/v1/invitations/controller_base.rb', line 36 def show end |