Class: OpenIDConnect::ResponseObject::UserInfo
- Inherits:
-
ConnectObject
- Object
- ConnectObject
- OpenIDConnect::ResponseObject::UserInfo
- Defined in:
- lib/openid_connect/response_object/user_info.rb,
lib/openid_connect/response_object/user_info/address.rb
Defined Under Namespace
Classes: Address
Instance Attribute Summary
Attributes inherited from ConnectObject
Instance Method Summary collapse
- #address=(hash_or_address) ⇒ Object
-
#initialize(attributes = {}) ⇒ UserInfo
constructor
TODO: validate locale.
- #validate_address ⇒ Object
Methods inherited from ConnectObject
all_attributes, #all_attributes, #as_json, #require_at_least_one_attributes, #validate!
Constructor Details
#initialize(attributes = {}) ⇒ UserInfo
TODO: validate locale
38 39 40 41 42 43 44 |
# File 'lib/openid_connect/response_object/user_info.rb', line 38 def initialize(attributes = {}) super (all_attributes - [:email_verified, :phone_number_verified, :address, :updated_at]).each do |key| self.send "#{key}=", self.send(key).try(:to_s) end self.updated_at = updated_at.try(:to_i) end |
Instance Method Details
#address=(hash_or_address) ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/openid_connect/response_object/user_info.rb', line 51 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_address ⇒ Object
46 47 48 |
# File 'lib/openid_connect/response_object/user_info.rb', line 46 def validate_address errors.add :address, address.errors..join(', ') if address.present? && !address.valid? end |