class Yoti::DynamicSharingService::WantedAttributeBuilder

Builder for WantedAttribute

Public Class Methods

new() click to toggle source
# File lib/yoti/dynamic_share_service/policy/wanted_attribute.rb, line 47
def initialize
  @attribute = WantedAttribute.new
end

Public Instance Methods

build() click to toggle source
# File lib/yoti/dynamic_share_service/policy/wanted_attribute.rb, line 83
def build
  raise 'Attribute name missing' if @attribute.name.nil? || @attribute.name == ''

  Marshal.load Marshal.dump @attribute
end
with_accept_self_asserted(accept = true) click to toggle source

@param [Bool] accept

# File lib/yoti/dynamic_share_service/policy/wanted_attribute.rb, line 78
def with_accept_self_asserted(accept = true)
  @attribute.instance_variable_set(:@accept_self_asserted, accept)
  self
end
with_constraint(constraint) click to toggle source

@param constraint Constraint to apply to the requested attribute

# File lib/yoti/dynamic_share_service/policy/wanted_attribute.rb, line 70
def with_constraint(constraint)
  @attribute.constraints.push(constraint)
  self
end
with_derivation(derivation) click to toggle source

@param [String] derivation

# File lib/yoti/dynamic_share_service/policy/wanted_attribute.rb, line 62
def with_derivation(derivation)
  @attribute.instance_variable_set(:@derivation, derivation)
  self
end
with_name(name) click to toggle source

@param [String] name

# File lib/yoti/dynamic_share_service/policy/wanted_attribute.rb, line 54
def with_name(name)
  @attribute.instance_variable_set(:@name, name)
  self
end