Sha256: c207087cd3f8e443b8ac1df15076922bf3be7db5163a0100e7bdbd390c9b482e
Contents?: true
Size: 1.84 KB
Versions: 2
Compression:
Stored size: 1.84 KB
Contents
module OpenIDConnect class ResponseObject module UserInfo class OpenID < ConnectObject attr_optional( :sub, :name, :given_name, :family_name, :middle_name, :nickname, :preferred_username, :profile, :picture, :website, :email, :email_verified, :gender, :birthdate, :zoneinfo, :locale, :phone_number, :address, :updated_time ) alias_method :subject, :sub alias_method :subject=, :sub= validates :email_verified, inclusion: {in: [true, false]}, allow_nil: true validates :gender, inclusion: {in: ['male', 'female']}, allow_nil: true validates :zoneinfo, inclusion: {in: TZInfo::TimezoneProxy.all.collect(&:name)}, allow_nil: true validates :profile, :picture, :website, url: true, allow_nil: true validates :email, email: true, allow_nil: true validate :validate_address validate :require_at_least_one_attributes # TODO: validate locale def initialize(attributes = {}) super (all_attributes - [:email_verified, :address]).each do |key| self.send "#{key}=", self.send(key).try(:to_s) end end def validate_address errors.add :address, address.errors.full_messages.join(', ') if address.present? && !address.valid? end def address=(hash_or_address) @address = case hash_or_address when Hash Address.new hash_or_address when Address hash_or_address end end end end end end Dir[File.dirname(__FILE__) + '/open_id/*.rb'].each do |file| require file end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
openid_connect-0.6.1 | lib/openid_connect/response_object/user_info/open_id.rb |
openid_connect-0.6.0 | lib/openid_connect/response_object/user_info/open_id.rb |