95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
# File 'lib/copies_omniauth.rb', line 95
def copy_from_omniauth(omniauth)
validate_provider omniauth["provider"]
validate_uid omniauth["uid"]
copies_omniauth_attributes.each do |attr,omniauth_key|
case omniauth_key
when Array
value = omniauth_key.inject(omniauth) do |hash,key|
hash[key] unless hash.nil?
end
when String
value = omniauth[omniauth_key]
when Symbol
value = omniauth[omniauth_key.to_s]
end
if copies_omniauth_options[:overwrite] || send(attr).nil?
self.send("#{attr}=",value)
end
end
self
end
|