Class: OpenIDConnect::ResponseObject::UserInfo::OpenID

Inherits:
ConnectObject
  • Object
show all
Defined in:
lib/openid_connect/response_object/userinfo/open_id.rb,
lib/openid_connect/response_object/userinfo/open_id/address.rb

Defined Under Namespace

Classes: Address

Instance Attribute Summary

Attributes inherited from ConnectObject

#raw_attributes

Instance Method Summary collapse

Methods inherited from ConnectObject

all_attributes, #all_attributes, #as_json, #require_at_least_one_attributes, #validate!

Constructor Details

#initialize(attributes = {}) ⇒ OpenID

TODO: validate locale



39
40
41
42
43
44
# File 'lib/openid_connect/response_object/userinfo/open_id.rb', line 39

def initialize(attributes = {})
  super
  (all_attributes - [:email_verified, :phone_number_verified, :address]).each do |key|
    self.send "#{key}=", self.send(key).try(:to_s)
  end
end

Instance Method Details

#address=(hash_or_address) ⇒ Object



50
51
52
53
54
55
56
57
# File 'lib/openid_connect/response_object/userinfo/open_id.rb', line 50

def address=(hash_or_address)
  @address = case hash_or_address
  when Hash
    Address.new hash_or_address
  when Address
    hash_or_address
  end
end

#validate_addressObject



46
47
48
# File 'lib/openid_connect/response_object/userinfo/open_id.rb', line 46

def validate_address
  errors.add :address, address.errors.full_messages.join(', ') if address.present? && !address.valid?
end