Sha256: 541f7fe9ce008f8d271442bf17723c4a88c6f32e59c2298187681ef3a13348ae

Contents?: true

Size: 766 Bytes

Versions: 9

Compression:

Stored size: 766 Bytes

Contents

module Mautic
  module Submissions
    class Form
      attr_reader :id

      # @param [Mautic::Connection] connection
      # @param [Hash] data
      def initialize(connection, data)
        @connection = connection
        @raw = data
        @id = data["id"].to_i
      end

      # @return [Integer]
      def form_id
        @form_id ||= @raw["form"]["id"].to_i
      end

      # @return [Integer]
      def contact_id
        @contact_id ||= @raw["lead"]["id"]
      end

      # @return [Mautic::Form]
      def form
        @form ||= @connection.forms.new(@raw["form"].merge("fields" => @raw["results"]))
      end

      # @return [Mautic::Contact]
      def contact
        @contact ||= @connection.contacts.new(@raw["lead"])
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mautic-2.3.10 lib/mautic/submissions/form.rb
mautic-2.3.9 lib/mautic/submissions/form.rb
mautic-2.3.8 lib/mautic/submissions/form.rb
mautic-2.3.7 lib/mautic/submissions/form.rb
mautic-2.3.6 lib/mautic/submissions/form.rb
mautic-2.3.5 lib/mautic/submissions/form.rb
mautic-2.3.4 lib/mautic/submissions/form.rb
mautic-2.3.3 lib/mautic/submissions/form.rb
mautic-2.3.1 lib/mautic/submissions/form.rb