Class: Account::Webhooks::Outgoing::EndpointsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Account::Webhooks::Outgoing::EndpointsController
- Defined in:
- app/controllers/account/webhooks/outgoing/endpoints_controller.rb
Instance Method Summary collapse
-
#activate ⇒ Object
POST /account/webhooks/outgoing/endpoints/:id/activate.
-
#create ⇒ Object
POST /account/teams/:team_id/webhooks/outgoing/endpoints POST /account/teams/:team_id/webhooks/outgoing/endpoints.json.
-
#deactivate ⇒ Object
DELETE /account/webhooks/outgoing/endpoints/:id/deactivate.
-
#destroy ⇒ Object
DELETE /account/webhooks/outgoing/endpoints/:id DELETE /account/webhooks/outgoing/endpoints/:id.json.
-
#edit ⇒ Object
GET /account/webhooks/outgoing/endpoints/:id/edit.
-
#index ⇒ Object
GET /account/teams/:team_id/webhooks/outgoing/endpoints GET /account/teams/:team_id/webhooks/outgoing/endpoints.json.
-
#new ⇒ Object
GET /account/teams/:team_id/webhooks/outgoing/endpoints/new.
-
#rotate_secret ⇒ Object
POST /account/webhooks/outgoing/endpoints/:id/rotate_secret.
-
#show ⇒ Object
GET /account/webhooks/outgoing/endpoints/:id GET /account/webhooks/outgoing/endpoints/:id.json.
-
#update ⇒ Object
PATCH/PUT /account/webhooks/outgoing/endpoints/:id PATCH/PUT /account/webhooks/outgoing/endpoints/:id.json.
Instance Method Details
#activate ⇒ Object
POST /account/webhooks/outgoing/endpoints/:id/activate
78 79 80 81 82 83 84 85 86 87 88 |
# File 'app/controllers/account/webhooks/outgoing/endpoints_controller.rb', line 78 def activate respond_to do |format| if @endpoint.reactivate! format.html { redirect_to [:account, @parent, :webhooks_outgoing_endpoints], notice: I18n.t("webhooks/outgoing/endpoints.notifications.activated") } format.json { render :show, status: :ok, location: [:account, @endpoint] } else format.html { redirect_to [:account, @parent, :webhooks_outgoing_endpoints], alert: I18n.t("webhooks/outgoing/endpoints.notifications.activation_failed") } format.json { render json: @endpoint.errors, status: :unprocessable_entity } end end end |
#create ⇒ Object
POST /account/teams/:team_id/webhooks/outgoing/endpoints POST /account/teams/:team_id/webhooks/outgoing/endpoints.json
30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/account/webhooks/outgoing/endpoints_controller.rb', line 30 def create respond_to do |format| if @endpoint.save format.html { redirect_to [:account, @parent, :webhooks_outgoing_endpoints], notice: I18n.t("webhooks/outgoing/endpoints.notifications.created") } format.json { render :show, status: :created, location: [:account, @endpoint] } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @endpoint.errors, status: :unprocessable_entity } end end end |
#deactivate ⇒ Object
DELETE /account/webhooks/outgoing/endpoints/:id/deactivate
91 92 93 94 95 96 97 98 99 100 101 |
# File 'app/controllers/account/webhooks/outgoing/endpoints_controller.rb', line 91 def deactivate respond_to do |format| if @endpoint.deactivate! format.html { redirect_to [:account, @parent, :webhooks_outgoing_endpoints], notice: I18n.t("webhooks/outgoing/endpoints.notifications.deactivated") } format.json { render :show, status: :ok, location: [:account, @endpoint] } else format.html { redirect_to [:account, @parent, :webhooks_outgoing_endpoints], alert: I18n.t("webhooks/outgoing/endpoints.notifications.deactivation_failed") } format.json { render json: @endpoint.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /account/webhooks/outgoing/endpoints/:id DELETE /account/webhooks/outgoing/endpoints/:id.json
58 59 60 61 62 63 64 |
# File 'app/controllers/account/webhooks/outgoing/endpoints_controller.rb', line 58 def destroy @endpoint.destroy respond_to do |format| format.html { redirect_to [:account, @parent, :webhooks_outgoing_endpoints], notice: I18n.t("webhooks/outgoing/endpoints.notifications.destroyed") } format.json { head :no_content } end end |
#edit ⇒ Object
GET /account/webhooks/outgoing/endpoints/:id/edit
25 26 |
# File 'app/controllers/account/webhooks/outgoing/endpoints_controller.rb', line 25 def edit end |
#index ⇒ Object
GET /account/teams/:team_id/webhooks/outgoing/endpoints GET /account/teams/:team_id/webhooks/outgoing/endpoints.json
10 11 12 13 |
# File 'app/controllers/account/webhooks/outgoing/endpoints_controller.rb', line 10 def index # if you only want these objects shown on their parent's show page, uncomment this: # redirect_to [:account, @team] end |
#new ⇒ Object
GET /account/teams/:team_id/webhooks/outgoing/endpoints/new
21 22 |
# File 'app/controllers/account/webhooks/outgoing/endpoints_controller.rb', line 21 def new end |
#rotate_secret ⇒ Object
POST /account/webhooks/outgoing/endpoints/:id/rotate_secret
67 68 69 70 71 72 73 74 75 |
# File 'app/controllers/account/webhooks/outgoing/endpoints_controller.rb', line 67 def rotate_secret @endpoint ||= Webhooks::Outgoing::Endpoint.accessible_by(current_ability).find(params[:id]) respond_to do |format| if @endpoint.rotate_webhook_secret! format.html { redirect_to [:account, @endpoint], notice: I18n.t("webhooks/outgoing/endpoints.notifications.secret_rotated") } end end end |
#show ⇒ Object
GET /account/webhooks/outgoing/endpoints/:id GET /account/webhooks/outgoing/endpoints/:id.json
17 18 |
# File 'app/controllers/account/webhooks/outgoing/endpoints_controller.rb', line 17 def show end |
#update ⇒ Object
PATCH/PUT /account/webhooks/outgoing/endpoints/:id PATCH/PUT /account/webhooks/outgoing/endpoints/:id.json
44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/controllers/account/webhooks/outgoing/endpoints_controller.rb', line 44 def update respond_to do |format| if @endpoint.update(endpoint_params) format.html { redirect_to [:account, @endpoint], notice: I18n.t("webhooks/outgoing/endpoints.notifications.updated") } format.json { render :show, status: :ok, location: [:account, @endpoint] } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @endpoint.errors, status: :unprocessable_entity } end end end |