Sha256: 51d1f3077e5befc557a916d874bac73d5c3274606f2aaf2c54f795c6ce53d859

Contents?: true

Size: 595 Bytes

Versions: 1

Compression:

Stored size: 595 Bytes

Contents

module Mautic
  # Represent received web hook
  class WebHook

    attr_reader :connection
    # @param [Mautic::Connection] connection
    # @param [ActionController::Parameters] params
    def initialize(connection, params)
      @connection = connection
      @params = params
    end

    def form_submissions
      @forms ||= Array.wrap(@params.require("mautic.form_on_submit")).collect do |data|
        p = data.permit(submission: [:id, form: {}, lead: {}]).to_h
        ::Mautic::Submissions::Form.new(@connection, p["submission"]) if p["submission"]
      end.compact
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mautic-2.2.2 app/models/mautic/web_hook.rb