Class: OpenIDConnect::Discovery::Provider::Config::Response

Inherits:
SWD::Resource
  • Object
show all
Includes:
AttrOptional
Defined in:
lib/openid_connect/discovery/provider/config/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Response

Returns a new instance of Response.



33
34
35
36
37
38
39
40
41
# File 'lib/openid_connect/discovery/provider/config/response.rb', line 33

def initialize(hash)
  optional_attributes.each do |key|
    self.send "#{key}=", hash[key]
  end
  @user_info_endpoint ||= hash[:userinfo_endpoint]
  @user_info_algs_supported ||= hash[:userinfo_algs_supported]
  @version ||= '3.0'
  @raw = hash
end

Instance Attribute Details

#rawObject (readonly)

Returns the value of attribute raw.



8
9
10
# File 'lib/openid_connect/discovery/provider/config/response.rb', line 8

def raw
  @raw
end

Instance Method Details

#as_json(options = {}) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/openid_connect/discovery/provider/config/response.rb', line 43

def as_json(options = {})
  hash = optional_attributes.inject({}) do |hash, _attr_|
    hash.merge(
      _attr_ => self.send(_attr_)
    )
  end
  hash[:userinfo_endpoint] = hash.delete(:user_info_endpoint)
  hash[:userinfo_algs_supported] = hash.delete(:user_info_algs_supported)
  hash.delete_if do |key, value|
    value.nil?
  end
end