Module: DiscourseApi::API::ApiKey
- Included in:
- Client
- Defined in:
- lib/discourse_api/api/api_key.rb
Instance Method Summary collapse
- #create_api_key(args) ⇒ Object
- #delete_api_key(id) ⇒ Object
- #list_api_keys ⇒ Object
- #revoke_api_key(id) ⇒ Object
- #undo_revoke_api_key(id) ⇒ Object
Instance Method Details
#create_api_key(args) ⇒ Object
10 11 12 13 |
# File 'lib/discourse_api/api/api_key.rb', line 10 def create_api_key(args) args = API.params(args).required(:key).to_h post("/admin/api/keys", args) end |
#delete_api_key(id) ⇒ Object
23 24 25 |
# File 'lib/discourse_api/api/api_key.rb', line 23 def delete_api_key(id) delete("/admin/api/keys/#{id}") end |
#list_api_keys ⇒ Object
5 6 7 8 |
# File 'lib/discourse_api/api/api_key.rb', line 5 def list_api_keys response = get("/admin/api/keys") response[:body] end |
#revoke_api_key(id) ⇒ Object
15 16 17 |
# File 'lib/discourse_api/api/api_key.rb', line 15 def revoke_api_key(id) post("/admin/api/keys/#{id}/revoke") end |
#undo_revoke_api_key(id) ⇒ Object
19 20 21 |
# File 'lib/discourse_api/api/api_key.rb', line 19 def undo_revoke_api_key(id) post("/admin/api/keys/#{id}/undo-revoke") end |