Class: Sendeez::ApiKeys
- Inherits:
-
Object
- Object
- Sendeez::ApiKeys
- Defined in:
- lib/sendeez/api_keys.rb
Instance Method Summary collapse
- #create(name, scopes, expires_at: nil, timeout: nil) ⇒ Object
-
#initialize(client) ⇒ ApiKeys
constructor
A new instance of ApiKeys.
- #list(timeout: nil) ⇒ Object
- #remove(id, timeout: nil) ⇒ Object
- #rotate(id, timeout: nil) ⇒ Object
Constructor Details
#initialize(client) ⇒ ApiKeys
Returns a new instance of ApiKeys.
5 6 7 |
# File 'lib/sendeez/api_keys.rb', line 5 def initialize(client) @client = client end |
Instance Method Details
#create(name, scopes, expires_at: nil, timeout: nil) ⇒ Object
9 10 11 12 13 |
# File 'lib/sendeez/api_keys.rb', line 9 def create(name, scopes, expires_at: nil, timeout: nil) body = { "name" => name, "scopes" => scopes } body["expires_at"] = expires_at if expires_at @client.request("POST", "/v1/api-keys", body: body, timeout: timeout) end |
#list(timeout: nil) ⇒ Object
15 16 17 |
# File 'lib/sendeez/api_keys.rb', line 15 def list(timeout: nil) @client.request("GET", "/v1/api-keys", timeout: timeout) end |
#remove(id, timeout: nil) ⇒ Object
23 24 25 |
# File 'lib/sendeez/api_keys.rb', line 23 def remove(id, timeout: nil) @client.request("DELETE", "/v1/api-keys/#{URI.encode_www_form_component(id)}", timeout: timeout) end |
#rotate(id, timeout: nil) ⇒ Object
19 20 21 |
# File 'lib/sendeez/api_keys.rb', line 19 def rotate(id, timeout: nil) @client.request("POST", "/v1/api-keys/#{URI.encode_www_form_component(id)}/rotate", timeout: timeout) end |