Sha256: 74029113de046dd5d291c41eb7f322bb442194e841b758e4e9d79865a6fc42aa
Contents?: true
Size: 1.37 KB
Versions: 3
Compression:
Stored size: 1.37 KB
Contents
# frozen_string_literal: true module Yoti module DynamicSharingService class ThirdPartyAttributeDefinition def initialize(name) @name = name end def to_json(*_args) { name: @name }.to_json end end class ThirdPartyAttributeExtensionBuilder def initialize @expiry_date = nil @definitions = [] end def with_expiry_date(expiry_date) @expiry_date = expiry_date self end def with_definitions(*names) @definitions += names.map do |name| ThirdPartyAttributeDefinition.new(name) end self end def build extension = ThirdPartyAttributeExtension.new extension.instance_variable_get(:@content)[:expiry_date] = @expiry_date extension.instance_variable_get(:@content)[:definitions] = @definitions extension end end class ThirdPartyAttributeExtension EXTENSION_TYPE = 'THIRD_PARTY_ATTRIBUTE' attr_reader :content attr_reader :type def initialize @content = {} @type = EXTENSION_TYPE end def as_json(*_args) { type: @type, content: @content } end def to_json(*_args) as_json.to_json end def self.builder ThirdPartyAttributeExtensionBuilder.new end end end end
Version data entries
3 entries across 3 versions & 1 rubygems