cryptomate_api 0.1.4 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,91 +5,93 @@ module CryptomateApi
5
5
  # Manage the access you give to each key and the permissions you will have for each blockchain,
6
6
  # such as only receiving transactions or only accessing one of the blockchains.
7
7
  class Credential < CryptomateApi::Base
8
- # Get all credentials for an API-Key
9
- # https://cryptomate.me/docs/management#get-all-credentials-for-a-api-key
10
- # @param [String] api_key (API-Key to see its credentials.)
11
- # TODO: check response if it's an array or a hash
12
- # Response:
13
- # {
14
- # "id": "string",
15
- # "key": {
16
- # "api_key": "string",
17
- # "name": "string"
18
- # },
19
- # "operation": {
20
- # "id": "string",
21
- # "description": "string"
22
- # }
23
- # }
24
- def get_all_credentials(api_key)
25
- self.class.get("/management/credentials/api-key/#{api_key}")
26
- end
8
+ class << self
9
+ # Get all credentials for an API-Key
10
+ # https://cryptomate.me/docs/management#get-all-credentials-for-a-api-key
11
+ # @param [String] api_key (API-Key to see its credentials.)
12
+ # TODO: check response if it's an array or a hash
13
+ # Response:
14
+ # {
15
+ # "id": "string",
16
+ # "key": {
17
+ # "api_key": "string",
18
+ # "name": "string"
19
+ # },
20
+ # "operation": {
21
+ # "id": "string",
22
+ # "description": "string"
23
+ # }
24
+ # }
25
+ def get_all_credentials(api_key)
26
+ get("/management/credentials/api-key/#{api_key}")
27
+ end
27
28
 
28
- # Get a credential information by id
29
- # https://cryptomate.me/docs/management#get-a-credential-information
30
- # @param [String] credential_id (Credential id to see its information.)
31
- # Response:
32
- # {
33
- # "id": "string",
34
- # "key": {
35
- # "api_key": "string",
36
- # "name": "string"
37
- # },
38
- # "operation": {
39
- # "id": "string",
40
- # "description": "string"
41
- # }
42
- # }
43
- def get_credential(credential_id)
44
- self.class.get("/management/credentials/#{credential_id}")
45
- end
29
+ # Get a credential information by id
30
+ # https://cryptomate.me/docs/management#get-a-credential-information
31
+ # @param [String] credential_id (Credential id to see its information.)
32
+ # Response:
33
+ # {
34
+ # "id": "string",
35
+ # "key": {
36
+ # "api_key": "string",
37
+ # "name": "string"
38
+ # },
39
+ # "operation": {
40
+ # "id": "string",
41
+ # "description": "string"
42
+ # }
43
+ # }
44
+ def get_credential(credential_id)
45
+ get("/management/credentials/#{credential_id}")
46
+ end
46
47
 
47
- # Creates a credential for a API-Key and operation.
48
- # https://cryptomate.me/docs/management#create-a-credential
49
- # @param [String] api_key (API-Key to create the credential on.)
50
- # @param [String] operation_id (Id of the operation to give credential.)
51
- # Response:
52
- # {
53
- # "id": "string",
54
- # "key": {
55
- # "api_key": "string",
56
- # "name": "string"
57
- # },
58
- # "operation": {
59
- # "id": "string",
60
- # "description": "string"
61
- # }
62
- # }
63
- def create_credential(api_key, operation_id)
64
- self.class.post("/management/credentials", body: { api_key:, operation_id: }.to_json)
65
- end
48
+ # Creates a credential for a API-Key and operation.
49
+ # https://cryptomate.me/docs/management#create-a-credential
50
+ # @param [String] api_key (API-Key to create the credential on.)
51
+ # @param [String] operation_id (Id of the operation to give credential.)
52
+ # Response:
53
+ # {
54
+ # "id": "string",
55
+ # "key": {
56
+ # "api_key": "string",
57
+ # "name": "string"
58
+ # },
59
+ # "operation": {
60
+ # "id": "string",
61
+ # "description": "string"
62
+ # }
63
+ # }
64
+ def create_credential(api_key, operation_id)
65
+ post('/management/credentials', body: { api_key:, operation_id: }.to_json)
66
+ end
66
67
 
67
- # Modifies a credential by ID.
68
- # https://cryptomate.me/docs/management#update-a-credential
69
- # @param [String] credential_id (Id of the credential to modify.)
70
- # @param [String] api_key (Api-key to modify its credential.)
71
- # @param [String] operation_id (Id of the operation.)
72
- # Response:
73
- # {
74
- # "id": "string",
75
- # "key": {
76
- # "api_key": "string",
77
- # "name": "string"
78
- # },
79
- # "operation": {
80
- # "id": "string",
81
- # "description": "string"
82
- # }
83
- # }
84
- def update_credential(credential_id, api_key, operation_id)
85
- self.class.put("/management/credentials/#{credential_id}", body: { api_key:, operation_id: }.to_json)
86
- end
68
+ # Modifies a credential by ID.
69
+ # https://cryptomate.me/docs/management#update-a-credential
70
+ # @param [String] credential_id (Id of the credential to modify.)
71
+ # @param [String] api_key (Api-key to modify its credential.)
72
+ # @param [String] operation_id (Id of the operation.)
73
+ # Response:
74
+ # {
75
+ # "id": "string",
76
+ # "key": {
77
+ # "api_key": "string",
78
+ # "name": "string"
79
+ # },
80
+ # "operation": {
81
+ # "id": "string",
82
+ # "description": "string"
83
+ # }
84
+ # }
85
+ def update_credential(credential_id, api_key, operation_id)
86
+ put("/management/credentials/#{credential_id}", body: { api_key:, operation_id: }.to_json)
87
+ end
87
88
 
88
- # Deletes a credential by ID.
89
- # https://cryptomate.me/docs/management#delete-a-credential
90
- # @param [String] credential_id (Id of the credential to delete.)
91
- def delete_credential(credential_id)
92
- self.class.delete("/management/credentials/#{credential_id}")
89
+ # Deletes a credential by ID.
90
+ # https://cryptomate.me/docs/management#delete-a-credential
91
+ # @param [String] credential_id (Id of the credential to delete.)
92
+ def delete_credential(credential_id)
93
+ delete("/management/credentials/#{credential_id}")
94
+ end
93
95
  end
94
96
  end
95
97
  end
@@ -6,66 +6,68 @@ module CryptomateApi
6
6
  # You can create, modify and delete them.
7
7
  # This api-keys are used to authenticate the clients in the platform.
8
8
  class Key < CryptomateApi::Base
9
- # Get all keys
10
- # https://cryptomate.me/docs/management#get-all-keys
11
- # Response:
12
- # [
13
- # {
14
- # "api_key": "string",
15
- # "name": "string"
16
- # }
17
- # ]
18
- def get_all_keys
19
- self.class.get("/management/keys/list")
20
- end
9
+ class << self
10
+ # Get all keys
11
+ # https://cryptomate.me/docs/management#get-all-keys
12
+ # Response:
13
+ # [
14
+ # {
15
+ # "api_key": "string",
16
+ # "name": "string"
17
+ # }
18
+ # ]
19
+ def get_all_keys
20
+ get('/management/keys/list')
21
+ end
21
22
 
22
- # Get a specific key
23
- # https://cryptomate.me/docs/management#get-a-key
24
- # Response:
25
- # [
26
- # {
27
- # "api_key": "string",
28
- # "name": "string"
29
- # }
30
- # ]
31
- def get_key(key_id)
32
- self.class.get("/management/keys/#{key_id}")
33
- end
23
+ # Get a specific key
24
+ # https://cryptomate.me/docs/management#get-a-key
25
+ # Response:
26
+ # [
27
+ # {
28
+ # "api_key": "string",
29
+ # "name": "string"
30
+ # }
31
+ # ]
32
+ def get_key(key_id)
33
+ get("/management/keys/#{key_id}")
34
+ end
34
35
 
35
- # Create a key
36
- # https://cryptomate.me/docs/management#create-a-key
37
- # @param [String] name (Alias name of the API-Key to create.)
38
- # Response:
39
- # [
40
- # {
41
- # "api_key": "string",
42
- # "name": "string"
43
- # }
44
- # ]
45
- def create_key(name)
46
- self.class.post("/management/keys/create", body: { name: }.to_json)
47
- end
36
+ # Create a key
37
+ # https://cryptomate.me/docs/management#create-a-key
38
+ # @param [String] name (Alias name of the API-Key to create.)
39
+ # Response:
40
+ # [
41
+ # {
42
+ # "api_key": "string",
43
+ # "name": "string"
44
+ # }
45
+ # ]
46
+ def create_key(name)
47
+ post('/management/keys/create', body: { name: }.to_json)
48
+ end
48
49
 
49
- # Modify a key
50
- # https://cryptomate.me/docs/management#modify-a-key
51
- # @param [String] key_name (Name of the key to modify.)
52
- # @param [String] new_api_key_value (New api-key value.)
53
- # Response:
54
- # [
55
- # {
56
- # "api_key": "string",
57
- # "name": "string"
58
- # }
59
- # ]
60
- def modify_key(key_name, new_api_key_value)
61
- self.class.put("/management/keys/#{key_name}", body: { api_key: new_api_key_value }.to_json)
62
- end
50
+ # Modify a key
51
+ # https://cryptomate.me/docs/management#modify-a-key
52
+ # @param [String] key_name (Name of the key to modify.)
53
+ # @param [String] new_api_key_value (New api-key value.)
54
+ # Response:
55
+ # [
56
+ # {
57
+ # "api_key": "string",
58
+ # "name": "string"
59
+ # }
60
+ # ]
61
+ def modify_key(key_name, new_api_key_value)
62
+ put("/management/keys/#{key_name}", body: { api_key: new_api_key_value }.to_json)
63
+ end
63
64
 
64
- # Delete a key
65
- # https://cryptomate.me/docs/management#delete-a-key
66
- # @param [String] api_key (Id of the API-Key. Ex: master-ac8ff424-426f-46a7-94c3-13932c6e8adf)
67
- def delete_key(api_key)
68
- self.class.delete("/management/keys/#{api_key}")
65
+ # Delete a key
66
+ # https://cryptomate.me/docs/management#delete-a-key
67
+ # @param [String] api_key (Id of the API-Key. Ex: master-ac8ff424-426f-46a7-94c3-13932c6e8adf)
68
+ def delete_key(api_key)
69
+ delete("/management/keys/#{api_key}")
70
+ end
69
71
  end
70
72
  end
71
73
  end
@@ -5,28 +5,30 @@ module CryptomateApi
5
5
  # Get all the operations available in the platform.
6
6
  # You can use this information to create new credentials for your clients.
7
7
  class Operation < CryptomateApi::Base
8
- # Get all operations
9
- # https://cryptomate.me/docs/management#get-all-operations
10
- # Response:
11
- # [
12
- # {
13
- # "id": "string",
14
- # "description": "string"
15
- # }
16
- # ]
17
- def get_all_operations
18
- self.class.get("/management/operations/list")
19
- end
8
+ class << self
9
+ # Get all operations
10
+ # https://cryptomate.me/docs/management#get-all-operations
11
+ # Response:
12
+ # [
13
+ # {
14
+ # "id": "string",
15
+ # "description": "string"
16
+ # }
17
+ # ]
18
+ def get_all_operations
19
+ get('/management/operations/list')
20
+ end
20
21
 
21
- # Get a specific operation
22
- # https://cryptomate.me/docs/management#get-a-operation
23
- # Response:
24
- # {
25
- # "id": "string",
26
- # "description": "string"
27
- # }
28
- def get_operation(operation_id)
29
- self.class.get("/management/operations/#{operation_id}")
22
+ # Get a specific operation
23
+ # https://cryptomate.me/docs/management#get-a-operation
24
+ # Response:
25
+ # {
26
+ # "id": "string",
27
+ # "description": "string"
28
+ # }
29
+ def get_operation(operation_id)
30
+ get("/management/operations/#{operation_id}")
31
+ end
30
32
  end
31
33
  end
32
34
  end
@@ -6,65 +6,67 @@ module CryptomateApi
6
6
  # This allows you to manage your crypto assets in a more organized manner,
7
7
  # and also allows you to create multiple wallets for the same or different blockchain.
8
8
  class Account < CryptomateApi::Base
9
- # Get all accounts
10
- # https://cryptomate.me/docs/mpc#get-all-accounts
11
- # TODO: check response if it's an array or a hash
12
- # Response:
13
- # {
14
- # "id": "string",
15
- # "alias": "string",
16
- # "wallets": [
17
- # {
18
- # "id": "string",
19
- # "alias": "string",
20
- # "wallet_address": "string",
21
- # "blockchain": "string"
22
- # }
23
- # ]
24
- # }
25
- def get_all_accounts
26
- self.class.get("/mpc/accounts/list")
27
- end
9
+ class << self
10
+ # Get all accounts
11
+ # https://cryptomate.me/docs/mpc#get-all-accounts
12
+ # TODO: check response if it's an array or a hash
13
+ # Response:
14
+ # {
15
+ # "id": "string",
16
+ # "alias": "string",
17
+ # "wallets": [
18
+ # {
19
+ # "id": "string",
20
+ # "alias": "string",
21
+ # "wallet_address": "string",
22
+ # "blockchain": "string"
23
+ # }
24
+ # ]
25
+ # }
26
+ def get_all_accounts
27
+ get('/mpc/accounts/list')
28
+ end
28
29
 
29
- # Create an account
30
- # https://cryptomate.me/docs/mpc/create-an-account
31
- # @param [String] alias_name (Alias name of the account to create.)
32
- # Response:
33
- # {
34
- # "id": "String",
35
- # "alias": "String",
36
- # "wallets": []
37
- # }
38
- def create_account(alias_name)
39
- self.class.post("/mpc/accounts/create", body: { alias: alias_name }.to_json)
40
- end
30
+ # Create an account
31
+ # https://cryptomate.me/docs/mpc/create-an-account
32
+ # @param [String] alias_name (Alias name of the account to create.)
33
+ # Response:
34
+ # {
35
+ # "id": "String",
36
+ # "alias": "String",
37
+ # "wallets": []
38
+ # }
39
+ def create_account(alias_name)
40
+ post('/mpc/accounts/create', body: { alias: alias_name }.to_json)
41
+ end
41
42
 
42
- # Edit account: Modifies the account information.
43
- # https://cryptomate.me/docs/mpc/edit-account
44
- # @param [String] account_id (Id of the account to edit.)
45
- # @param [String] alias_name (New alias name of the account.)
46
- # Response:
47
- # {
48
- # "id": "string",
49
- # "alias": "string",
50
- # "wallets": [
51
- # {
52
- # "id": "string",
53
- # "alias": "string",
54
- # "wallet_address": "string",
55
- # "blockchain": "string"
56
- # }
57
- # ]
58
- # }
59
- def edit_account(account_id, alias_name)
60
- self.class.put("/mpc/account/#{account_id}", body: { alias: alias_name }.to_json)
61
- end
43
+ # Edit account: Modifies the account information.
44
+ # https://cryptomate.me/docs/mpc/edit-account
45
+ # @param [String] account_id (Id of the account to edit.)
46
+ # @param [String] alias_name (New alias name of the account.)
47
+ # Response:
48
+ # {
49
+ # "id": "string",
50
+ # "alias": "string",
51
+ # "wallets": [
52
+ # {
53
+ # "id": "string",
54
+ # "alias": "string",
55
+ # "wallet_address": "string",
56
+ # "blockchain": "string"
57
+ # }
58
+ # ]
59
+ # }
60
+ def edit_account(account_id, alias_name)
61
+ put("/mpc/account/#{account_id}", body: { alias: alias_name }.to_json)
62
+ end
62
63
 
63
- # Delete account
64
- # https://cryptomate.me/docs/mpc/delete-account
65
- # @param [String] account_id (Id of the account to delete.)
66
- def delete_account(account_id)
67
- self.class.delete("/mpc/account/#{account_id}")
64
+ # Delete account
65
+ # https://cryptomate.me/docs/mpc/delete-account
66
+ # @param [String] account_id (Id of the account to delete.)
67
+ def delete_account(account_id)
68
+ delete("/mpc/account/#{account_id}")
69
+ end
68
70
  end
69
71
  end
70
72
  end