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.

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from CryptomateApi::Base

Instance 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.)



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

def create_credential(api_key, operation_id)
  self.class.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.)



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

def delete_credential(credential_id)
  self.class.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.)



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

def get_all_credentials(api_key)
  self.class.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.)



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

def get_credential(credential_id)
  self.class.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.)



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

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