Sha256: 4263d9f91548a8f889dbf8b00abad2a99a77210a2a994d8e2e4efd9d0d9b0da4

Contents?: true

Size: 986 Bytes

Versions: 52

Compression:

Stored size: 986 Bytes

Contents

# typed: strict
# frozen_string_literal: true

class SettingsController < ApplicationController
  extend T::Sig

  include PathParameter::SettingsParameters

  before_action :ensure_json_request
  sig { void }
  def ensure_json_request
    return if request.format.json?

    not_acceptable
  end

  sig { void }
  def new
    @step = T.let(params.fetch(:step, 1).to_i || 1, T.nilable(Integer))
  end

  sig { void }
  def edit
    @step = params.fetch(:step, 1).to_i || 1

    response = YettoService.get_plug_installation(pparam_plug_installation_id)

    if response.unavailable?
      logger.error("Fetching Yetto inbox failed: `#{response}`")

      return not_acceptable
    end

    plug_installation = response.parsed_json_body
    access_token = plug_installation.fetch("credentials", {}).fetch("access_token", "")

    if access_token.blank?
      logger.error("Fetching Yetto access_token failed: `#{response}`")

      return not_acceptable
    end

    not_found
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
hephaestus-0.7.2.3 templates/app/controllers/settings_controller.rb
hephaestus-0.7.2.2 templates/app/controllers/settings_controller.rb
hephaestus-0.7.2.1 templates/app/controllers/settings_controller.rb
hephaestus-0.7.2 templates/app/controllers/settings_controller.rb
hephaestus-0.7.1 templates/app/controllers/settings_controller.rb
hephaestus-0.7.0 templates/app/controllers/settings_controller.rb
hephaestus-0.6.4 templates/app/controllers/settings_controller.rb
hephaestus-0.6.3 templates/app/controllers/settings_controller.rb
hephaestus-0.6.2 templates/app/controllers/settings_controller.rb
hephaestus-0.6.1 templates/app/controllers/settings_controller.rb
hephaestus-0.6.0 templates/app/controllers/settings_controller.rb
hephaestus-0.5.2 templates/app/controllers/settings_controller.rb