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.
- checksums.yaml +4 -4
- data/.rubocop.yml +13 -7
- data/CHANGELOG.md +7 -0
- data/Gemfile +4 -4
- data/Gemfile.lock +67 -0
- data/README.md +0 -2
- data/Rakefile +3 -3
- data/cryptomate_api.gemspec +18 -15
- data/lib/cryptomate_api/base.rb +34 -7
- data/lib/cryptomate_api/management/blockchain.rb +13 -11
- data/lib/cryptomate_api/management/client.rb +51 -49
- data/lib/cryptomate_api/management/configuration.rb +31 -28
- data/lib/cryptomate_api/management/credential.rb +83 -81
- data/lib/cryptomate_api/management/key.rb +58 -56
- data/lib/cryptomate_api/management/operation.rb +23 -21
- data/lib/cryptomate_api/mpc/account.rb +58 -56
- data/lib/cryptomate_api/mpc/wallet.rb +102 -100
- data/lib/cryptomate_api/payment.rb +64 -0
- data/lib/cryptomate_api/version.rb +1 -1
- data/lib/cryptomate_api.rb +2 -2
- metadata +9 -6
- data/lib/cryptomate_api/configuration.rb +0 -21
@@ -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
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
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
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
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
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
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
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
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
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
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
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
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
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
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
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
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
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
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
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
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
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
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
|