Last active
March 21, 2016 13:25
-
-
Save stereosupersonic/8dbb8bca20f461c3b342 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Flservice::CoreUser::User < OpenStruct | |
PATH = "/v1/profile" | |
def self.find(uid) | |
response = connection(uid).get PATH | |
self.new JSON.parse(response.body)["user"].except("authentications") | |
end | |
def self.connection(uid) | |
url = "http://0.0.0.0:3000" # TODO RemoteApp.new(:core_user) | |
auth_token = FL::Core::Auth::IdToken.generate(user_id: uid) | |
Faraday.new(url: url") do |faraday| | |
faraday.request :url_encoded | |
faraday.adapter :excon | |
faraday.headers['Authorization']="Bearer #{auth_token}" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment