Class: CryptomateApi::Management::Credential

Inherits:
Base
  • Object
show all
Defined in:
lib/cryptomate_api/management/credential.rb

Overview

Manage the access you give to each key and the permissions you will have for each blockchain, such as only receiving transactions or only accessing one of the blockchains.

Class Method Summary collapse

Class Method Details

.create_credential(api_key, operation_id) ⇒ Object

Creates a credential for a API-Key and operation. cryptomate.me/docs/management#create-a-credential Response: {

"id": "string",
"key": {
  "api_key": "string",
  "name": "string"
},
"operation": {
  "id": "string",
  "description": "string"
}

}

Parameters:

  • api_key (String)

    (API-Key to create the credential on.)

  • operation_id (String)

    (Id of the operation to give credential.)



64
65
66
# File 'lib/cryptomate_api/management/credential.rb', line 64

def create_credential(api_key, operation_id)
  post('/management/credentials', body: { api_key:, operation_id: }.to_json)
end

.delete_credential(credential_id) ⇒ Object

Parameters:

  • credential_id (String)

    (Id of the credential to delete.)



92
93
94
# File 'lib/cryptomate_api/management/credential.rb', line 92

def delete_credential(credential_id)
  delete("/management/credentials/#{credential_id}")
end

.get_all_credentials(api_key) ⇒ Object

Get all credentials for an API-Key cryptomate.me/docs/management#get-all-credentials-for-a-api-key TODO: check response if it’s an array or a hash Response: {

"id": "string",
"key": {
  "api_key": "string",
  "name": "string"
},
"operation": {
  "id": "string",
  "description": "string"
}

}

Parameters:

  • api_key (String)

    (API-Key to see its credentials.)



25
26
27
# File 'lib/cryptomate_api/management/credential.rb', line 25

def get_all_credentials(api_key)
  get("/management/credentials/api-key/#{api_key}")
end

.get_credential(credential_id) ⇒ Object

Get a credential information by id cryptomate.me/docs/management#get-a-credential-information Response: {

"id": "string",
"key": {
  "api_key": "string",
  "name": "string"
},
"operation": {
  "id": "string",
  "description": "string"
}

}

Parameters:

  • credential_id (String)

    (Credential id to see its information.)



44
45
46
# File 'lib/cryptomate_api/management/credential.rb', line 44

def get_credential(credential_id)
  get("/management/credentials/#{credential_id}")
end

.update_credential(credential_id, api_key, operation_id) ⇒ Object

Modifies a credential by ID. cryptomate.me/docs/management#update-a-credential Response: {

"id": "string",
"key": {
  "api_key": "string",
  "name": "string"
},
"operation": {
  "id": "string",
  "description": "string"
}

}

Parameters:

  • credential_id (String)

    (Id of the credential to modify.)

  • api_key (String)

    (Api-key to modify its credential.)

  • operation_id (String)

    (Id of the operation.)



85
86
87
# File 'lib/cryptomate_api/management/credential.rb', line 85

def update_credential(credential_id, api_key, operation_id)
  put("/management/credentials/#{credential_id}", body: { api_key:, operation_id: }.to_json)
end