Sha256: 38926609aabb4913e711eec456b3d04cd0460fc570d9e7a27119f768ce16b063
Contents?: true
Size: 1.37 KB
Versions: 9
Compression:
Stored size: 1.37 KB
Contents
# frozen_string_literal: true module Yoti module DynamicSharingService # Describes a dynamic share class DynamicScenario attr_reader :policy attr_reader :extensions attr_reader :callback_endpoint def initialize @extensions = [] end def to_json(*_args) as_json.to_json end def as_json(*_args) { policy: @policy, extensions: @extensions, callback_endpoint: @callback_endpoint } end def self.builder DynamicScenarioBuilder.new end end # Builder for DynamicScenario class DynamicScenarioBuilder def initialize @scenario = DynamicScenario.new end def build Marshal.load Marshal.dump @scenario end # # @param [Yoti::DynamicSharingService::DynamicPolicy] policy # def with_policy(policy) @scenario.instance_variable_set(:@policy, policy) self end # # @param [Yoti::DynamicSharingService::Extension] extension # def with_extension(extension) @scenario.instance_variable_get(:@extensions) << extension self end # # @param [String] endpoint # def with_callback_endpoint(endpoint) @scenario.instance_variable_set(:@callback_endpoint, endpoint) self end end end end
Version data entries
9 entries across 9 versions & 1 rubygems