Class: CFC::UserAPIToken
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from APIObject
#initialize, #inspect, #method_missing, opts, relationship, #respond_to_missing?, #to_h, #to_json
Constructor Details
This class inherits a constructor from CFC::APIObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class CFC::APIObject
Class Method Details
.create(name:, policies:, not_before: nil, expires_on: nil, condition: nil) ⇒ Object
27
28
29
30
31
|
# File 'lib/cfc/objects/user_api_token.rb', line 27
def self.create(name:, policies:, not_before: nil, expires_on: nil, condition: nil)
data = { name: name, policies: policies, not_before: not_before, expires_on: expires_on, condition: condition }
data = data.compact
new(@api.post_to_json('user/tokens', data)['result'])
end
|
.delete(identifier) ⇒ Object
19
20
21
|
# File 'lib/cfc/objects/user_api_token.rb', line 19
def self.delete(identifier)
@api.delete_to_json("user/tokens/#{identifier}")
end
|
.details(identifier) ⇒ Object
15
16
17
|
# File 'lib/cfc/objects/user_api_token.rb', line 15
def self.details(identifier)
new(@api.get_json("user/tokens/#{identifier}")['result'])
end
|
.list(page: nil, per_page: nil, direction: nil) ⇒ Object
10
11
12
13
|
# File 'lib/cfc/objects/user_api_token.rb', line 10
def self.list(page: nil, per_page: nil, direction: nil)
params = opts(binding).compact
@api.get_json('user/tokens', params: params)['result'].map { |o| new(o) }
end
|
.roll(identifier) ⇒ Object
23
24
25
|
# File 'lib/cfc/objects/user_api_token.rb', line 23
def self.roll(identifier)
@api.put_to_json("user/tokens/#{identifier}/value", {})
end
|
Instance Method Details
#delete ⇒ Object
37
38
39
|
# File 'lib/cfc/objects/user_api_token.rb', line 37
def delete
CFC::UserAPIToken.delete(id)
end
|
#details ⇒ Object
33
34
35
|
# File 'lib/cfc/objects/user_api_token.rb', line 33
def details
CFC::UserAPIToken.details(id)
end
|
#roll ⇒ Object
41
42
43
|
# File 'lib/cfc/objects/user_api_token.rb', line 41
def roll
CFC::UserAPIToken.roll(id)
end
|