Class: AtlasRb::Authentication

Inherits:
Object
  • Object
show all
Extended by:
FaradayHelper
Defined in:
lib/atlas_rb/authentication.rb

Class Method Summary collapse

Class Method Details

.groups(nuid) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/atlas_rb/authentication.rb', line 13

def self.groups(nuid)
  # user_details = login(nuid)
  # token = user_details[:token] ...
  # TODO - need to update atlas login to give back name, id, and token upon logging in
  # result = JSON.parse(connection({ token: token }).post('/users/2/groups')&.body)["user"]["groups"]
  JSON.parse(connection({}, nuid).get('/user')&.body)["groups"]
end

.login(nuid) ⇒ Object



7
8
9
10
11
# File 'lib/atlas_rb/authentication.rb', line 7

def self.(nuid)
  # JSON.parse(connection({ nuid: nuid }).post('/token')&.body)["token"]
  # need hash - id, name, token => ...
  JSON.parse(connection({}, nuid).get('/user')&.body)
end