Class: Yoti::DynamicSharingService::WantedAttribute
- Inherits:
-
Object
- Object
- Yoti::DynamicSharingService::WantedAttribute
- Defined in:
- lib/yoti/dynamic_share_service/policy/wanted_attribute.rb
Overview
Describes a wanted attribute in a dynamic sharing policy
Instance Attribute Summary collapse
-
#constraints ⇒ Object
readonly
Returns the value of attribute constraints.
-
#derivation ⇒ Object
readonly
Returns the value of attribute derivation.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #accept_self_asserted ⇒ Object
- #as_json(*_args) ⇒ Object
-
#initialize ⇒ WantedAttribute
constructor
A new instance of WantedAttribute.
- #to_json(*_args) ⇒ Object
Constructor Details
#initialize ⇒ WantedAttribute
Returns a new instance of WantedAttribute.
11 12 13 |
# File 'lib/yoti/dynamic_share_service/policy/wanted_attribute.rb', line 11 def initialize @constraints = [] end |
Instance Attribute Details
#constraints ⇒ Object (readonly)
Returns the value of attribute constraints.
9 10 11 |
# File 'lib/yoti/dynamic_share_service/policy/wanted_attribute.rb', line 9 def constraints @constraints end |
#derivation ⇒ Object (readonly)
Returns the value of attribute derivation.
8 9 10 |
# File 'lib/yoti/dynamic_share_service/policy/wanted_attribute.rb', line 8 def derivation @derivation end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/yoti/dynamic_share_service/policy/wanted_attribute.rb', line 7 def name @name end |
Class Method Details
.builder ⇒ Object
35 36 37 |
# File 'lib/yoti/dynamic_share_service/policy/wanted_attribute.rb', line 35 def self.builder WantedAttributeBuilder.new end |
Instance Method Details
#accept_self_asserted ⇒ Object
15 16 17 18 19 |
# File 'lib/yoti/dynamic_share_service/policy/wanted_attribute.rb', line 15 def accept_self_asserted return true if @accept_self_asserted false end |
#as_json(*_args) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/yoti/dynamic_share_service/policy/wanted_attribute.rb', line 25 def as_json(*_args) obj = { name: @name } obj[:derivation] = @derivation if derivation obj[:accept_self_asserted] = @accept_self_asserted if accept_self_asserted obj[:constraints] = @constraints.map(&:as_json) unless constraints.empty? obj end |
#to_json(*_args) ⇒ Object
21 22 23 |
# File 'lib/yoti/dynamic_share_service/policy/wanted_attribute.rb', line 21 def to_json(*_args) as_json.to_json end |