Class: Datahen::Client::AuthToken
- Inherits:
-
Base
- Object
- Base
- Datahen::Client::AuthToken
show all
- Defined in:
- lib/datahen/client/auth_token.rb
Constant Summary
Constants inherited
from Base
Base::CHECK_EMPTY_BODY, Base::CHECK_NIL, Base::DEFAULT_RETRY_LIMIT
Instance Method Summary
collapse
Methods inherited from Base
#auth_token, #auth_token=, #default_retry_limit, #env_api_url, env_auth_token, env_ignore_ssl, #ignore_ssl, #initialize, #left_merge, random_delay, #retry
Instance Method Details
#all(opts = {}) ⇒ Object
9
10
11
12
|
# File 'lib/datahen/client/auth_token.rb', line 9
def all(opts={})
params = @options.merge(opts)
self.class.get("/auth_tokens", params)
end
|
#create(role, description, opts = {}) ⇒ Object
14
15
16
17
18
19
20
21
|
# File 'lib/datahen/client/auth_token.rb', line 14
def create(role, description, opts={})
body = {
role: role,
description: description}
params = @options.merge({body: body.to_json}).merge(opts)
self.class.post("/auth_tokens", params)
end
|
#create_on_account(account_id, role, description) ⇒ Object
23
24
25
26
27
28
29
30
|
# File 'lib/datahen/client/auth_token.rb', line 23
def create_on_account(account_id, role, description)
body = {
role: role,
description: description}
params = @options.merge({body: body.to_json})
self.class.post("/accounts/#{account_id}/auth_tokens", params)
end
|
#delete(token, opts = {}) ⇒ Object
42
43
44
45
46
47
|
# File 'lib/datahen/client/auth_token.rb', line 42
def delete(token, opts={})
body = {}
params = @options.merge({body: body.to_json})
self.class.delete("/auth_tokens/#{token}", params)
end
|
#find(token) ⇒ Object
5
6
7
|
# File 'lib/datahen/client/auth_token.rb', line 5
def find(token)
self.class.get("/auth_tokens/#{token}", @options)
end
|
#update(token, role, description = "", opts = {}) ⇒ Object
32
33
34
35
36
37
38
39
40
|
# File 'lib/datahen/client/auth_token.rb', line 32
def update(token, role, description="", opts={})
body = {}
body[:role] = role
body[:description] = description if description.present?
params = @options.merge({body: body.to_json})
self.class.put("/auth_tokens/#{token}", params)
end
|