Method: OpenIDConnect::RequestObject::Claimable#initialize

Defined in:
lib/openid_connect/request_object/claimable.rb

#initialize(attributes = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/openid_connect/request_object/claimable.rb', line 8

def initialize(attributes = {})
  super
  if claims.present?
    _claims_ = {}
    claims.each do |key, value|
      _claims_[key] = case value
      when :optional, :voluntary
        {
          essential: false
        }
      when :required, :essential
        {
          essential: true
        }
      else
        value
      end
    end
    self.claims = _claims_.with_indifferent_access
  end
end