Sha256: 4a2c9c2f434103dd7434ab7c581fd08db6c7a26a8ff47b922ed671062eb44729

Contents?: true

Size: 791 Bytes

Versions: 9

Compression:

Stored size: 791 Bytes

Contents

# frozen_string_literal: true

module Yoti
  module DynamicSharingService
    class Extension
      attr_reader :type
      attr_reader :content

      def to_json(*_args)
        as_json.to_json
      end

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

      def self.builder
        ExtensionBuilder.new
      end
    end

    class ExtensionBuilder
      def initialize
        @extension = Extension.new
      end

      def with_type(type)
        @extension.instance_variable_set(:@type, type)
        self
      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/extension.rb
yoti-1.8.0 lib/yoti/dynamic_share_service/extension/extension.rb
yoti-1.7.1 lib/yoti/dynamic_share_service/extension/extension.rb
yoti-1.7.0 lib/yoti/dynamic_share_service/extension/extension.rb
yoti-1.6.4 lib/yoti/dynamic_share_service/extension/extension.rb
yoti-1.6.3 lib/yoti/dynamic_share_service/extension/extension.rb
yoti-1.6.2 lib/yoti/dynamic_share_service/extension/extension.rb
yoti-1.6.1 lib/yoti/dynamic_share_service/extension/extension.rb
yoti-1.6.0 lib/yoti/dynamic_share_service/extension/extension.rb