Class: AlephAlpha::Tokens

Inherits:
Object
  • Object
show all
Defined in:
lib/aleph-alpha/tokens.rb

Instance Method Summary collapse

Constructor Details

#initialize(access_token: nil) ⇒ Tokens

Returns a new instance of Tokens.



3
4
5
# File 'lib/aleph-alpha/tokens.rb', line 3

def initialize(access_token: nil)
  AlephAlpha.configuration.access_token = access_token if access_token
end

Instance Method Details

#create(parameters: {}) ⇒ Object



11
12
13
# File 'lib/aleph-alpha/tokens.rb', line 11

def create(parameters: {})
  AlephAlpha::Client.json_post(path: "/users/me/tokens", parameters: parameters)
end

#delete(id:) ⇒ Object



15
16
17
# File 'lib/aleph-alpha/tokens.rb', line 15

def delete(id:)
  AlephAlpha::Client.delete(path: "/users/me/tokens/#{id}")
end

#listObject



7
8
9
# File 'lib/aleph-alpha/tokens.rb', line 7

def list
  AlephAlpha::Client.get(path: "/users/me/tokens")
end