Class: Account::Platform::ApplicationsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Account::Platform::ApplicationsController
- Defined in:
- app/controllers/account/platform/applications_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /account/teams/:team_id/platform/applications POST /account/teams/:team_id/platform/applications.json.
-
#destroy ⇒ Object
DELETE /account/platform/applications/:id DELETE /account/platform/applications/:id.json.
-
#edit ⇒ Object
GET /account/platform/applications/:id/edit.
-
#index ⇒ Object
GET /account/teams/:team_id/platform/applications GET /account/teams/:team_id/platform/applications.json.
-
#new ⇒ Object
GET /account/teams/:team_id/platform/applications/new.
- #provision ⇒ Object
-
#show ⇒ Object
GET /account/platform/applications/:id GET /account/platform/applications/:id.json.
-
#update ⇒ Object
PATCH/PUT /account/platform/applications/:id PATCH/PUT /account/platform/applications/:id.json.
Instance Method Details
#create ⇒ Object
POST /account/teams/:team_id/platform/applications POST /account/teams/:team_id/platform/applications.json
43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/controllers/account/platform/applications_controller.rb', line 43 def create respond_to do |format| if @application.save format.html { redirect_to [:account, @application], notice: I18n.t("platform/applications.notifications.created") } format.json { render :show, status: :created, location: [:account, @application] } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @application.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /account/platform/applications/:id DELETE /account/platform/applications/:id.json
71 72 73 74 75 76 77 |
# File 'app/controllers/account/platform/applications_controller.rb', line 71 def destroy @application.destroy respond_to do |format| format.html { redirect_to [:account, @team, :platform_applications], notice: I18n.t("platform/applications.notifications.destroyed") } format.json { head :no_content } end end |
#edit ⇒ Object
GET /account/platform/applications/:id/edit
21 22 |
# File 'app/controllers/account/platform/applications_controller.rb', line 21 def edit end |
#index ⇒ Object
GET /account/teams/:team_id/platform/applications GET /account/teams/:team_id/platform/applications.json
6 7 8 9 |
# File 'app/controllers/account/platform/applications_controller.rb', line 6 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/platform/applications/new
17 18 |
# File 'app/controllers/account/platform/applications_controller.rb', line 17 def new end |
#provision ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/account/platform/applications_controller.rb', line 24 def provision if ENV["TESTING_PROVISION_KEY"].present? && params[:key] == ENV["TESTING_PROVISION_KEY"] user = User.create(email: "test@#{SecureRandom.hex}.example.com", password: (password = SecureRandom.hex), password_confirmation: password) provision_team = current_user.teams.create(name: "provision-team-#{SecureRandom.hex}", time_zone: user.time_zone) test_application = Platform::Application.new(name: "test-application-#{SecureRandom.hex}", team: provision_team) if test_application.save access_token = test_application.create_access_token render json: {message: I18n.t("platform/applications.notifications.test_application_created"), team_id: provision_team.id, access_token: access_token.token} else render json: {errors: test_application.errors, status: :unprocessable_entity} end else render json: {message: I18n.t("platform/applications.notifications.test_application_failure")} end end |
#show ⇒ Object
GET /account/platform/applications/:id GET /account/platform/applications/:id.json
13 14 |
# File 'app/controllers/account/platform/applications_controller.rb', line 13 def show end |
#update ⇒ Object
PATCH/PUT /account/platform/applications/:id PATCH/PUT /account/platform/applications/:id.json
57 58 59 60 61 62 63 64 65 66 67 |
# File 'app/controllers/account/platform/applications_controller.rb', line 57 def update respond_to do |format| if @application.update(application_params) format.html { redirect_to [:account, @application], notice: I18n.t("platform/applications.notifications.updated") } format.json { render :show, status: :ok, location: [:account, @application] } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @application.errors, status: :unprocessable_entity } end end end |