hotfix: remove person api v1
This commit is contained in:
Родитель
eba4269711
Коммит
f66123785a
|
@ -4,7 +4,6 @@ require_relative 'mozilla_iam/serializer_extensions/duplicate_accounts'
|
|||
require_relative 'mozilla_iam/serializer_extensions/mozilla_iam'
|
||||
require_relative 'mozilla_iam/api'
|
||||
require_relative 'mozilla_iam/api/oauth'
|
||||
require_relative 'mozilla_iam/api/person'
|
||||
require_relative 'mozilla_iam/api/person_v2'
|
||||
require_relative 'mozilla_iam/api/management'
|
||||
require_relative 'mozilla_iam/application_extensions'
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
module MozillaIAM
|
||||
module API
|
||||
class Person < OAuth
|
||||
|
||||
def initialize(config={})
|
||||
config = {
|
||||
url: SiteSetting.mozilla_iam_person_api_url + "/v1",
|
||||
aud: SiteSetting.mozilla_iam_person_api_aud
|
||||
}.merge(config)
|
||||
super(config)
|
||||
end
|
||||
|
||||
def profile(uid)
|
||||
res = get("profile/#{uid}")
|
||||
Profile.new(MultiJson.load(res[:body], symbolize_keys: true))
|
||||
end
|
||||
|
||||
class Profile
|
||||
attr_reader :secondary_emails
|
||||
|
||||
def initialize(raw)
|
||||
@raw = raw
|
||||
@secondary_emails = process_emails
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def process_emails
|
||||
emails = @raw[:emails]
|
||||
if emails
|
||||
primary = emails.select do |x|
|
||||
x[:verified] &&
|
||||
x[:primary]
|
||||
end.map { |x| x[:value] }
|
||||
emails.select do |x|
|
||||
x[:verified] &&
|
||||
!x[:primary] &&
|
||||
primary.exclude?(x[:value])
|
||||
end.map { |x| x[:value] }.uniq
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Загрузка…
Ссылка в новой задаче