Class: Yoti::DynamicSharingService::WantedAttributeBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/yoti/dynamic_share_service/policy/wanted_attribute.rb

Overview

Builder for WantedAttribute

Instance Method Summary collapse

Constructor Details

#initializeWantedAttributeBuilder

Returns a new instance of WantedAttributeBuilder.



42
43
44
# File 'lib/yoti/dynamic_share_service/policy/wanted_attribute.rb', line 42

def initialize
  @attribute = WantedAttribute.new
end

Instance Method Details

#buildObject



78
79
80
81
82
# File 'lib/yoti/dynamic_share_service/policy/wanted_attribute.rb', line 78

def build
  raise 'Attribute name missing' if @attribute.name.nil? || @attribute.name == ''

  Marshal.load Marshal.dump @attribute
end

#with_accept_self_asserted(accept = true) ⇒ Object

Parameters:

  • accept (Bool) (defaults to: true)


73
74
75
76
# File 'lib/yoti/dynamic_share_service/policy/wanted_attribute.rb', line 73

def with_accept_self_asserted(accept = true)
  @attribute.instance_variable_set(:@accept_self_asserted, accept)
  self
end

#with_constraint(constraint) ⇒ Object

Parameters:

  • constraint

    Constraint to apply to the requested attribute



65
66
67
68
# File 'lib/yoti/dynamic_share_service/policy/wanted_attribute.rb', line 65

def with_constraint(constraint)
  @attribute.constraints.push(constraint)
  self
end

#with_derivation(derivation) ⇒ Object

Parameters:

  • derivation (String)


57
58
59
60
# File 'lib/yoti/dynamic_share_service/policy/wanted_attribute.rb', line 57

def with_derivation(derivation)
  @attribute.instance_variable_set(:@derivation, derivation)
  self
end

#with_name(name) ⇒ Object

Parameters:

  • name (String)


49
50
51
52
# File 'lib/yoti/dynamic_share_service/policy/wanted_attribute.rb', line 49

def with_name(name)
  @attribute.instance_variable_set(:@name, name)
  self
end