Sha256: ae2bba46655046a11ec81387312817d9df14a0fbff4737fb150a0a66ec21ae99

Contents?: true

Size: 946 Bytes

Versions: 9

Compression:

Stored size: 946 Bytes

Contents

# frozen_string_literal: true

module Yoti
  module DynamicSharingService
    # Extension for transactional flows
    class TransactionalFlowExtension
      EXTENSION_TYPE = 'TRANSACTIONAL_FLOW'
      attr_reader :content
      attr_reader :type

      def initialize
        @type = EXTENSION_TYPE
      end

      def to_json(*_args)
        as_json.to_json
      end

      def as_json(*_args)
        {
          content: @content,
          type: @type
        }
      end

      def self.builder
        TransactionalFlowExtensionBuilder.new
      end
    end

    # Builder for TransactionalFlowExtension
    class TransactionalFlowExtensionBuilder
      def initialize
        @extension = TransactionalFlowExtension.new
      end

      def with_content(content)
        @extension.instance_variable_set(:@content, content)
        self
      end

      def build
        Marshal.load Marshal.dump @extension
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
yoti-1.9.0 lib/yoti/dynamic_share_service/extension/transactional_flow_extension.rb
yoti-1.8.0 lib/yoti/dynamic_share_service/extension/transactional_flow_extension.rb
yoti-1.7.1 lib/yoti/dynamic_share_service/extension/transactional_flow_extension.rb
yoti-1.7.0 lib/yoti/dynamic_share_service/extension/transactional_flow_extension.rb
yoti-1.6.4 lib/yoti/dynamic_share_service/extension/transactional_flow_extension.rb
yoti-1.6.3 lib/yoti/dynamic_share_service/extension/transactional_flow_extension.rb
yoti-1.6.2 lib/yoti/dynamic_share_service/extension/transactional_flow_extension.rb
yoti-1.6.1 lib/yoti/dynamic_share_service/extension/transactional_flow_extension.rb
yoti-1.6.0 lib/yoti/dynamic_share_service/extension/transactional_flow_extension.rb