Class: Rafflesia::ApiKeys
- Inherits:
-
Object
- Object
- Rafflesia::ApiKeys
- Defined in:
- lib/rafflesia/api_keys.rb
Instance Method Summary collapse
-
#create(environment_id:, name:, organization_id:, description: nil, environment_name: nil, environment_type: nil, expires_at: nil, request_options: {}) ⇒ Rafflesia::EnvelopeApiKeyCreateResponse
POST /v1/api-keys.
-
#initialize(client) ⇒ ApiKeys
constructor
A new instance of ApiKeys.
-
#list(organization_id: nil, environment_id: nil, request_options: {}) ⇒ Rafflesia::EnvelopeApiKeyListData
GET /v1/api-keys.
-
#revoke(key_id:, organization_id: nil, environment_id: nil, request_options: {}) ⇒ Rafflesia::EnvelopeApiKeyRevokeData
DELETE /v1/api-keys/key_id.
Constructor Details
#initialize(client) ⇒ ApiKeys
Returns a new instance of ApiKeys.
9 10 11 |
# File 'lib/rafflesia/api_keys.rb', line 9 def initialize(client) @client = client end |
Instance Method Details
#create(environment_id:, name:, organization_id:, description: nil, environment_name: nil, environment_type: nil, expires_at: nil, request_options: {}) ⇒ Rafflesia::EnvelopeApiKeyCreateResponse
POST /v1/api-keys
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/rafflesia/api_keys.rb', line 49 def create( environment_id:, name:, organization_id:, description: nil, environment_name: nil, environment_type: nil, expires_at: nil, request_options: {} ) body = { 'description' => description, 'environment_id' => environment_id, 'environment_name' => environment_name, 'environment_type' => environment_type, 'expires_at' => expires_at, 'name' => name, 'organization_id' => organization_id }.compact response = @client.request( method: :post, path: '/v1/api-keys', auth: true, body: body, request_options: ) result = Rafflesia::EnvelopeApiKeyCreateResponse.new(response.body) result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#list(organization_id: nil, environment_id: nil, request_options: {}) ⇒ Rafflesia::EnvelopeApiKeyListData
GET /v1/api-keys
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rafflesia/api_keys.rb', line 18 def list( organization_id: nil, environment_id: nil, request_options: {} ) params = { 'organization_id' => organization_id, 'environment_id' => environment_id }.compact response = @client.request( method: :get, path: '/v1/api-keys', auth: true, params: params, request_options: ) result = Rafflesia::EnvelopeApiKeyListData.new(response.body) result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#revoke(key_id:, organization_id: nil, environment_id: nil, request_options: {}) ⇒ Rafflesia::EnvelopeApiKeyRevokeData
DELETE /v1/api-keys/key_id
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/rafflesia/api_keys.rb', line 86 def revoke( key_id:, organization_id: nil, environment_id: nil, request_options: {} ) params = { 'organization_id' => organization_id, 'environment_id' => environment_id }.compact response = @client.request( method: :delete, path: "/v1/api-keys/#{Rafflesia::Util.encode_path(key_id)}", auth: true, params: params, request_options: ) result = Rafflesia::EnvelopeApiKeyRevokeData.new(response.body) result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |