Sha256: 9045bf93a7058d17ac726ee63e4f76120c179c7e1ca2d9e5fb8e0046fcab974f

Contents?: true

Size: 892 Bytes

Versions: 13

Compression:

Stored size: 892 Bytes

Contents

# typed: false
# frozen_string_literal: true

class <%= capital_plug_name %>Controller < ApplicationController
  include Authable

  include Constants

  before_action :webhook_from_<%= plug_name %>?, only: [:webhook]
  before_action :<%= plug_name %>_calling_back?, only: [:callback]

  def webhook
    body = request.body.read

    payload = JSON.parse(body, symbolize_names: true)
    # TODO: Get the event and action that triggered the webhook
    #
    # Then, queue up some work to be done in a background job

    okay
  end

  def callback
    code = params[:code]
    state = params[:state]

    state_obj = parse_state(state)
    plug_installation_id = state_obj.fetch(:plug_installation_id, "")
    redirect_to = state_obj.fetch(:redirect_to, "")

    # TODO: Store access credentials you've been given back in Yetto

    redirect_to(redirect_to, allow_other_host: true)
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
hephaestus-0.8.16.1 templates/app/controllers/app_controller.rb.tt
hephaestus-0.8.16 templates/app/controllers/app_controller.rb.tt
hephaestus-0.8.15.5 templates/app/controllers/app_controller.rb.tt
hephaestus-0.8.15.4 templates/app/controllers/app_controller.rb.tt
hephaestus-0.8.15.3 templates/app/controllers/app_controller.rb.tt
hephaestus-0.8.15.2 templates/app/controllers/app_controller.rb.tt
hephaestus-0.8.15.1 templates/app/controllers/app_controller.rb.tt
hephaestus-0.8.15 templates/app/controllers/app_controller.rb.tt
hephaestus-0.8.14 templates/app/controllers/app_controller.rb.tt
hephaestus-0.8.13 templates/app/controllers/app_controller.rb.tt
hephaestus-0.8.12.2 templates/app/controllers/app_controller.rb.tt
hephaestus-0.8.12.1 templates/app/controllers/app_controller.rb.tt
hephaestus-0.8.12 templates/app/controllers/app_controller.rb.tt