lib/applicaster/accounts.rb in omniauth-applicaster-1.5.2 vs lib/applicaster/accounts.rb in omniauth-applicaster-1.6.0
- old
+ new
@@ -58,10 +58,18 @@
else
raise
end
end
+ def user_by_id_and_token(id, token)
+ Applicaster::Accounts::User.new(
+ connection(token: token)
+ .get("/api/v1/users/#{id}.json")
+ .body
+ )
+ end
+
def accounts_from_token(token)
connection(token: token)
.get("/api/v1/accounts.json")
.body
.map {|a| Account.new(a) }
@@ -89,9 +97,13 @@
access_token(omniauth_credentials).get("/api/v1/users/current.json").parsed
end
def accounts
self.class.accounts_from_token(client_credentials_token.token)
+ end
+
+ def find_user_by_id(id)
+ self.class.user_by_id_and_token(id, client_credentials_token.token)
end
def connection(*args)
self.class.connection(*args)
end