sila-ruby 0.0.9 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.idea/.gitignore +8 -0
- data/.idea/misc.xml +4 -0
- data/.idea/modules.xml +8 -0
- data/.idea/sila-ruby.iml +35 -0
- data/.idea/vcs.xml +6 -0
- data/Gemfile.lock +23 -23
- data/lib/sila-ruby/accounts.rb +40 -52
- data/lib/sila-ruby/api_helpers.rb +2 -2
- data/lib/sila-ruby/entities.rb +244 -0
- data/lib/sila-ruby/transactions.rb +36 -12
- data/lib/sila-ruby/version.rb +1 -1
- data/lib/sila-ruby/wallets.rb +81 -0
- data/lib/sila_ruby.rb +2 -1
- data/sila-ruby.gemspec +3 -3
- metadata +13 -7
- data/lib/sila-ruby/banks.rb +0 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1697cab02fc71d78d6d7c780a125fed97b21b29a166cb996bb067f7027da1f9
|
4
|
+
data.tar.gz: 74b2b713bc254411ecc5aad1531e8ddb14ac871c262c046c8e500993a0d8e900
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81ade27710a2a43e644bc3be9c6f488b7df7ae27133773b2e29dafca4def787df965648fb67135d8245525908ccefa74c834fe52aa22bbc11c474a6e7a812bcb
|
7
|
+
data.tar.gz: 03f2f488c93ebe2e5c98573c37480e9c4f4a52caea392026f6c071339a8c604d8aa3544e9a881faf8169fbb48f02c24edb0150fdd0fb7cab2185a1558547f04d
|
data/.idea/.gitignore
ADDED
data/.idea/misc.xml
ADDED
data/.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/sila-ruby.iml" filepath="$PROJECT_DIR$/.idea/sila-ruby.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
data/.idea/sila-ruby.iml
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
4
|
+
<shared />
|
5
|
+
</component>
|
6
|
+
<component name="NewModuleRootManager">
|
7
|
+
<content url="file://$MODULE_DIR$">
|
8
|
+
<sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
|
9
|
+
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
10
|
+
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
11
|
+
</content>
|
12
|
+
<orderEntry type="inheritedJdk" />
|
13
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="addressable (v2.7.0, rbenv: 2.5.1) [gem]" level="application" />
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.17.3, rbenv: 2.5.1) [gem]" level="application" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, rbenv: 2.5.1) [gem]" level="application" />
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="docile (v1.3.2, rbenv: 2.5.1) [gem]" level="application" />
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="dotenv (v2.7.6, rbenv: 2.5.1) [gem]" level="application" />
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="ffi (v1.12.2, rbenv: 2.5.1) [gem]" level="application" />
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="httparty (v0.18.1, rbenv: 2.5.1) [gem]" level="application" />
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="json (v2.3.1, rbenv: 2.5.1) [gem]" level="application" />
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="mime-types (v3.3.1, rbenv: 2.5.1) [gem]" level="application" />
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2020.0512, rbenv: 2.5.1) [gem]" level="application" />
|
24
|
+
<orderEntry type="library" scope="PROVIDED" name="multi_xml (v0.6.0, rbenv: 2.5.1) [gem]" level="application" />
|
25
|
+
<orderEntry type="library" scope="PROVIDED" name="public_suffix (v4.0.5, rbenv: 2.5.1) [gem]" level="application" />
|
26
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.9.0, rbenv: 2.5.1) [gem]" level="application" />
|
27
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.9.2, rbenv: 2.5.1) [gem]" level="application" />
|
28
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.9.2, rbenv: 2.5.1) [gem]" level="application" />
|
29
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.9.1, rbenv: 2.5.1) [gem]" level="application" />
|
30
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.9.3, rbenv: 2.5.1) [gem]" level="application" />
|
31
|
+
<orderEntry type="library" scope="PROVIDED" name="simplecov (v0.16.1, rbenv: 2.5.1) [gem]" level="application" />
|
32
|
+
<orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.10.2, rbenv: 2.5.1) [gem]" level="application" />
|
33
|
+
<orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v1.7.0, rbenv: 2.5.1) [gem]" level="application" />
|
34
|
+
</component>
|
35
|
+
</module>
|
data/.idea/vcs.xml
ADDED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sila-ruby (0.0.
|
4
|
+
sila-ruby (0.0.12)
|
5
5
|
addressable (~> 2.6)
|
6
6
|
dotenv (~> 2.7)
|
7
7
|
eth
|
@@ -15,46 +15,46 @@ GEM
|
|
15
15
|
public_suffix (>= 2.0.2, < 5.0)
|
16
16
|
ansi (1.5.0)
|
17
17
|
diff-lcs (1.3)
|
18
|
-
digest-sha3 (1.1.
|
18
|
+
digest-sha3-patched (1.1.1)
|
19
19
|
docile (1.3.2)
|
20
20
|
dotenv (2.7.5)
|
21
|
-
eth (0.4.
|
22
|
-
digest-sha3 (~> 1.1)
|
21
|
+
eth (0.4.12)
|
22
|
+
digest-sha3-patched (~> 1.1)
|
23
23
|
ffi (~> 1.0)
|
24
24
|
money-tree (~> 0.10.0)
|
25
25
|
rlp (~> 0.7.3)
|
26
26
|
scrypt (~> 3.0.6)
|
27
|
-
ffi (1.
|
27
|
+
ffi (1.12.2)
|
28
28
|
ffi-compiler (1.0.1)
|
29
29
|
ffi (>= 1.0.0)
|
30
30
|
rake
|
31
|
-
httparty (0.
|
31
|
+
httparty (0.18.0)
|
32
32
|
mime-types (~> 3.0)
|
33
33
|
multi_xml (>= 0.5.2)
|
34
|
-
json (2.
|
35
|
-
mime-types (3.3)
|
34
|
+
json (2.3.0)
|
35
|
+
mime-types (3.3.1)
|
36
36
|
mime-types-data (~> 3.2015)
|
37
|
-
mime-types-data (3.
|
37
|
+
mime-types-data (3.2020.0512)
|
38
38
|
money-tree (0.10.0)
|
39
39
|
ffi
|
40
40
|
multi_xml (0.6.0)
|
41
|
-
public_suffix (4.0.
|
41
|
+
public_suffix (4.0.5)
|
42
42
|
rake (10.5.0)
|
43
43
|
rlp (0.7.3)
|
44
|
-
rspec (3.
|
45
|
-
rspec-core (~> 3.
|
46
|
-
rspec-expectations (~> 3.
|
47
|
-
rspec-mocks (~> 3.
|
48
|
-
rspec-core (3.
|
49
|
-
rspec-support (~> 3.
|
50
|
-
rspec-expectations (3.
|
44
|
+
rspec (3.9.0)
|
45
|
+
rspec-core (~> 3.9.0)
|
46
|
+
rspec-expectations (~> 3.9.0)
|
47
|
+
rspec-mocks (~> 3.9.0)
|
48
|
+
rspec-core (3.9.2)
|
49
|
+
rspec-support (~> 3.9.3)
|
50
|
+
rspec-expectations (3.9.2)
|
51
51
|
diff-lcs (>= 1.2.0, < 2.0)
|
52
|
-
rspec-support (~> 3.
|
53
|
-
rspec-mocks (3.
|
52
|
+
rspec-support (~> 3.9.0)
|
53
|
+
rspec-mocks (3.9.1)
|
54
54
|
diff-lcs (>= 1.2.0, < 2.0)
|
55
|
-
rspec-support (~> 3.
|
56
|
-
rspec-support (3.
|
57
|
-
scrypt (3.0.
|
55
|
+
rspec-support (~> 3.9.0)
|
56
|
+
rspec-support (3.9.3)
|
57
|
+
scrypt (3.0.7)
|
58
58
|
ffi-compiler (>= 1.0, < 2.0)
|
59
59
|
simplecov (0.16.1)
|
60
60
|
docile (~> 1.1)
|
@@ -67,7 +67,7 @@ GEM
|
|
67
67
|
simplecov-html (0.10.2)
|
68
68
|
terminal-table (1.8.0)
|
69
69
|
unicode-display_width (~> 1.1, >= 1.1.1)
|
70
|
-
unicode-display_width (1.
|
70
|
+
unicode-display_width (1.7.0)
|
71
71
|
|
72
72
|
PLATFORMS
|
73
73
|
ruby
|
data/lib/sila-ruby/accounts.rb
CHANGED
@@ -14,78 +14,66 @@ module SilaRuby
|
|
14
14
|
include ApiHelpers
|
15
15
|
|
16
16
|
# --------------------------------------------
|
17
|
-
#
|
17
|
+
# LINK-ACCOUNT -------------------------------
|
18
18
|
# --------------------------------------------
|
19
|
-
#
|
20
|
-
def self.
|
19
|
+
# Uses a provided Plaid public token to link a bank account to a verified entity.
|
20
|
+
def self.link_account(handle, params={}, user_key)
|
21
21
|
header = { user_handle: handle }
|
22
|
-
message = '
|
23
|
-
post_signed('check_handle', header, message, nil, nil)
|
24
|
-
end
|
25
|
-
|
26
|
-
# --------------------------------------------
|
27
|
-
# REGISTER -----------------------------------
|
28
|
-
# --------------------------------------------
|
29
|
-
# Attaches KYC and blockchain address to user handle
|
30
|
-
def self.register(handle, params={})
|
31
|
-
header = { user_handle: handle }
|
32
|
-
message = 'entity_msg'
|
22
|
+
message = 'link_account_msg'
|
33
23
|
|
34
24
|
# Example of params passed
|
35
25
|
#
|
36
26
|
# params = {
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
# city: "Green Bay",
|
41
|
-
# state: "WI",
|
42
|
-
# country: "US",
|
43
|
-
# postal_code: "54304"
|
44
|
-
# },
|
45
|
-
# identity: {
|
46
|
-
# identity_alias: "SSN",
|
47
|
-
# identity_value: "123452222"
|
48
|
-
# },
|
49
|
-
# contact: {
|
50
|
-
# contact_alias: "",
|
51
|
-
# phone: "503-123-4567",
|
52
|
-
# email: "example@silamoney.com"
|
53
|
-
# },
|
54
|
-
# crypto_entry: {
|
55
|
-
# crypto_alias: "Address 1",
|
56
|
-
# crypto_address: "0x1234567890abcdef1234567890abcdef12345678",
|
57
|
-
# crypto_code: "ETH"
|
58
|
-
# },
|
59
|
-
# entity: {
|
60
|
-
# birthdate: "1900-01-31",
|
61
|
-
# entity_name: "Example User",
|
62
|
-
# first_name: "Example",
|
63
|
-
# last_name: "User",
|
64
|
-
# relationship: "user"
|
65
|
-
# }
|
27
|
+
# public_token: "public-xxx-xxx",
|
28
|
+
# account_name: "Custom Account Name",
|
29
|
+
# selected_account_id: "optional_selected_account_id"
|
66
30
|
# }
|
67
31
|
|
68
|
-
|
32
|
+
sila_post_signed('link_account', header, message, params, user_key)
|
69
33
|
end
|
70
34
|
|
71
35
|
# --------------------------------------------
|
72
|
-
#
|
36
|
+
# GET-ACCOUNTS -------------------------------
|
73
37
|
# --------------------------------------------
|
74
|
-
#
|
75
|
-
def self.
|
38
|
+
# Gets basic bank account names linked to user handle.
|
39
|
+
def self.get_accounts(handle, user_key)
|
40
|
+
header = { user_handle: handle }
|
41
|
+
message = 'get_accounts_msg'
|
42
|
+
sila_post_signed('get_accounts', header, message, nil, user_key)
|
43
|
+
end
|
44
|
+
|
45
|
+
# --------------------------------------------
|
46
|
+
# GET-ACCOUNT-BALANCE ------------------------
|
47
|
+
# --------------------------------------------
|
48
|
+
# Requests bank account balance data from an end-users linked bank account.
|
49
|
+
def self.get_account_balance(handle, params={}, user_key)
|
76
50
|
header = { user_handle: handle }
|
77
51
|
message = 'header_msg'
|
78
|
-
|
52
|
+
|
53
|
+
# Example of params passed
|
54
|
+
#
|
55
|
+
# params = {
|
56
|
+
# account_name: "Custom Account Name",
|
57
|
+
# }
|
58
|
+
|
59
|
+
sila_post_signed('get_account_balance', header, message, params, user_key)
|
79
60
|
end
|
80
61
|
|
81
62
|
# --------------------------------------------
|
82
|
-
#
|
63
|
+
# PLAID-SAMEDAY-AUTH -------------------------
|
83
64
|
# --------------------------------------------
|
84
|
-
#
|
85
|
-
def self.
|
65
|
+
# Handle a request for a Plaid Link public_token in order to complete Plaid's Same Day Microdeposit Authentication.
|
66
|
+
def self.plaid_sameday_auth(handle, params={}, user_key)
|
86
67
|
header = { user_handle: handle }
|
87
68
|
message = 'header_msg'
|
88
|
-
|
69
|
+
|
70
|
+
# Example of params passed
|
71
|
+
#
|
72
|
+
# params = {
|
73
|
+
# account_name: "Custom Account Name",
|
74
|
+
# }
|
75
|
+
|
76
|
+
sila_post_signed('plaid_sameday_auth', header, message, params, user_key)
|
89
77
|
end
|
90
78
|
|
91
79
|
end
|
@@ -34,9 +34,9 @@ module ApiHelpers
|
|
34
34
|
end
|
35
35
|
|
36
36
|
# --------------------------------------------
|
37
|
-
# POST-SIGNED
|
37
|
+
# SILA-POST-SIGNED ---------------------------
|
38
38
|
# --------------------------------------------
|
39
|
-
def
|
39
|
+
def sila_post_signed(api_group, header={}, message={}, params={}, user_key)
|
40
40
|
# Set the post URL
|
41
41
|
url = "#{sila_uri}/0.2/#{api_group}"
|
42
42
|
# Create the header
|
@@ -0,0 +1,244 @@
|
|
1
|
+
# ================================================
|
2
|
+
# SILA-RUBY ======================================
|
3
|
+
# ================================================
|
4
|
+
module SilaRuby
|
5
|
+
|
6
|
+
# ==============================================
|
7
|
+
# ENTITIES =====================================
|
8
|
+
# ==============================================
|
9
|
+
class Entities
|
10
|
+
|
11
|
+
# --------------------------------------------
|
12
|
+
# INCLUDES -----------------------------------
|
13
|
+
# --------------------------------------------
|
14
|
+
include ApiHelpers
|
15
|
+
|
16
|
+
# --------------------------------------------
|
17
|
+
# CHECK-HANDLE -------------------------------
|
18
|
+
# --------------------------------------------
|
19
|
+
# Check if a specific handle is taken
|
20
|
+
def self.check_handle(handle)
|
21
|
+
header = { user_handle: handle }
|
22
|
+
message = 'header_msg'
|
23
|
+
sila_post_signed('check_handle', header, message, nil, nil)
|
24
|
+
end
|
25
|
+
|
26
|
+
# --------------------------------------------
|
27
|
+
# REGISTER -----------------------------------
|
28
|
+
# --------------------------------------------
|
29
|
+
# Attaches KYC and blockchain address to user handle
|
30
|
+
def self.register(handle, params={})
|
31
|
+
header = { user_handle: handle }
|
32
|
+
message = 'entity_msg'
|
33
|
+
|
34
|
+
# Example of params passed for USER
|
35
|
+
#
|
36
|
+
# params = {
|
37
|
+
# address: {
|
38
|
+
# address_alias: "home",
|
39
|
+
# street_address_1: "123 Main Street",
|
40
|
+
# city: "New City",
|
41
|
+
# state: "OR",
|
42
|
+
# country: "US",
|
43
|
+
# postal_code: "97204-1234"
|
44
|
+
# },
|
45
|
+
# identity: {
|
46
|
+
# identity_alias: "SSN",
|
47
|
+
# identity_value: "123452222"
|
48
|
+
# },
|
49
|
+
# contact: {
|
50
|
+
# phone: "503-123-4567",
|
51
|
+
# contact_alias: "",
|
52
|
+
# email: "example@silamoney.com"
|
53
|
+
# },
|
54
|
+
# crypto_entry: {
|
55
|
+
# crypto_alias: "Address 1",
|
56
|
+
# crypto_address: "0x1234567890abcdef1234567890abcdef12345678",
|
57
|
+
# crypto_code: "ETH"
|
58
|
+
# },
|
59
|
+
# entity: {
|
60
|
+
# birthdate: "1900-01-31",
|
61
|
+
# entity_name: "Example User",
|
62
|
+
# first_name: "Example",
|
63
|
+
# last_name: "User",
|
64
|
+
# relationship: "user"
|
65
|
+
# }
|
66
|
+
# }
|
67
|
+
#
|
68
|
+
#
|
69
|
+
# Example of params passed for BUSINESS
|
70
|
+
#
|
71
|
+
# params = {
|
72
|
+
# identity: {
|
73
|
+
# identity_alias: "EIN",
|
74
|
+
# identity_value: "12-1234567"
|
75
|
+
# },
|
76
|
+
# address: {
|
77
|
+
# address_alias: "Office",
|
78
|
+
# street_address_1: "123 Candelabra Blvd.",
|
79
|
+
# city: "Portland",
|
80
|
+
# state: "OR",
|
81
|
+
# country: "US",
|
82
|
+
# postal_code: "97204"
|
83
|
+
# },
|
84
|
+
# contact: {
|
85
|
+
# phone: "1231231234",
|
86
|
+
# email: "business@businessemail.com"
|
87
|
+
# },
|
88
|
+
# entity: {
|
89
|
+
# type: "business",
|
90
|
+
# entity_name: "Your Business Customer, Inc.",
|
91
|
+
# business_type: "corporation",
|
92
|
+
# business_website: "https://www.yourbusinesscustomer.com",
|
93
|
+
# doing_business_as: "Your Business Customer Alias Co.",
|
94
|
+
# naics_code: 721
|
95
|
+
# },
|
96
|
+
# crypto_entry: {
|
97
|
+
# crypto_code: "ETH",
|
98
|
+
# crypto_address: "0x67CB...E1FB"
|
99
|
+
# }
|
100
|
+
# }
|
101
|
+
|
102
|
+
sila_post_signed('register', header, message, params, nil)
|
103
|
+
end
|
104
|
+
|
105
|
+
# --------------------------------------------
|
106
|
+
# ADD-REGISTRATION ---------------------------
|
107
|
+
# --------------------------------------------
|
108
|
+
# Add a new email, phone number, street address, or identity to a registered entity.
|
109
|
+
def self.add_registration(handle, params={}, valid_path, user_key)
|
110
|
+
header = { user_handle: handle }
|
111
|
+
|
112
|
+
# Valid path options
|
113
|
+
#
|
114
|
+
# email
|
115
|
+
# phone
|
116
|
+
# identity
|
117
|
+
# address
|
118
|
+
#
|
119
|
+
#
|
120
|
+
# Example of params passed
|
121
|
+
#
|
122
|
+
# params = {
|
123
|
+
# email: "test@silamoney.com"
|
124
|
+
# }
|
125
|
+
|
126
|
+
sila_post_signed('add/' + valid_path, header, nil, params, user_key)
|
127
|
+
end
|
128
|
+
|
129
|
+
# --------------------------------------------
|
130
|
+
# UPDATE-REGISTRATION ------------------------
|
131
|
+
# --------------------------------------------
|
132
|
+
# Update an existing email, phone number, street address, identity, or entity (name, birthdate, or business data).
|
133
|
+
def self.update_registration(handle, params={}, valid_path, user_key)
|
134
|
+
header = { user_handle: handle }
|
135
|
+
|
136
|
+
# Valid path options
|
137
|
+
#
|
138
|
+
# email
|
139
|
+
# phone
|
140
|
+
# identity
|
141
|
+
# address
|
142
|
+
# entity
|
143
|
+
#
|
144
|
+
#
|
145
|
+
# Example of params passed
|
146
|
+
#
|
147
|
+
# params = {
|
148
|
+
# uuid: "7f83044b-63c8-4d56-b107-d52fa7ae2d7a",
|
149
|
+
# email: "test@silamoney.com"
|
150
|
+
# }
|
151
|
+
|
152
|
+
sila_post_signed('update/' + valid_path, header, nil, params, user_key)
|
153
|
+
end
|
154
|
+
|
155
|
+
# --------------------------------------------
|
156
|
+
# DELETE-REGISTRATION ------------------------
|
157
|
+
# --------------------------------------------
|
158
|
+
# Delete an existing email, phone number, street address, or identity.
|
159
|
+
def self.delete_registration(handle, params={}, valid_path, user_key)
|
160
|
+
header = { user_handle: handle }
|
161
|
+
|
162
|
+
# Valid path options
|
163
|
+
#
|
164
|
+
# email
|
165
|
+
# phone
|
166
|
+
# identity
|
167
|
+
# address
|
168
|
+
#
|
169
|
+
#
|
170
|
+
# Example of params passed
|
171
|
+
#
|
172
|
+
# params = {
|
173
|
+
# uuid: "7f83044b-63c8-4d56-b107-d52fa7ae2d7a"
|
174
|
+
# }
|
175
|
+
|
176
|
+
sila_post_signed('delete/' + valid_path, header, nil, params, user_key)
|
177
|
+
end
|
178
|
+
|
179
|
+
# --------------------------------------------
|
180
|
+
# LINK-BUSINESS-MEMBER -----------------------
|
181
|
+
# --------------------------------------------
|
182
|
+
#
|
183
|
+
|
184
|
+
# --------------------------------------------
|
185
|
+
# UNLINK-BUSINESS-MEMBER ---------------------
|
186
|
+
# --------------------------------------------
|
187
|
+
#
|
188
|
+
|
189
|
+
# --------------------------------------------
|
190
|
+
# REQUEST-KYC --------------------------------
|
191
|
+
# --------------------------------------------
|
192
|
+
# Start KYC verification process on a registered user handle
|
193
|
+
def self.request_kyc(handle, user_key)
|
194
|
+
header = { user_handle: handle }
|
195
|
+
message = 'header_msg'
|
196
|
+
sila_post_signed('request_kyc', header, message, nil, user_key)
|
197
|
+
end
|
198
|
+
|
199
|
+
# --------------------------------------------
|
200
|
+
# CHECK-KYC ----------------------------------
|
201
|
+
# --------------------------------------------
|
202
|
+
# Whether entity attached to user handle is verified, not valid, or pending
|
203
|
+
def self.check_kyc(handle, user_key)
|
204
|
+
header = { user_handle: handle }
|
205
|
+
message = 'header_msg'
|
206
|
+
sila_post_signed('check_kyc', header, message, nil, user_key)
|
207
|
+
end
|
208
|
+
|
209
|
+
# --------------------------------------------
|
210
|
+
# CERTIFY-BENEFICIAL-OWNER -------------------
|
211
|
+
# --------------------------------------------
|
212
|
+
#
|
213
|
+
|
214
|
+
# --------------------------------------------
|
215
|
+
# CERTIFY-BUSINESS ---------------------------
|
216
|
+
# --------------------------------------------
|
217
|
+
#
|
218
|
+
|
219
|
+
# --------------------------------------------
|
220
|
+
# GET-ENTITIES -------------------------------
|
221
|
+
# --------------------------------------------
|
222
|
+
# Return all end-user and legal entities (businesses) associated with a customer application.
|
223
|
+
# This endpoint allows the listing of all entities registered to an application.
|
224
|
+
def self.get_entities(params={})
|
225
|
+
message = 'header_msg'
|
226
|
+
|
227
|
+
# params = {
|
228
|
+
# entity_type: "individual"
|
229
|
+
# }
|
230
|
+
|
231
|
+
sila_post_signed('get_entities', nil, message, params, nil)
|
232
|
+
end
|
233
|
+
|
234
|
+
# --------------------------------------------
|
235
|
+
# GET-ENTITY ---------------------------------
|
236
|
+
# --------------------------------------------
|
237
|
+
# Gets identifying information about a registered entity.
|
238
|
+
def self.get_entity(handle, user_key)
|
239
|
+
header = { user_handle: handle }
|
240
|
+
sila_post_signed('check_handle', header, nil, nil, user_key)
|
241
|
+
end
|
242
|
+
|
243
|
+
end
|
244
|
+
end
|
@@ -16,7 +16,7 @@ module SilaRuby
|
|
16
16
|
# --------------------------------------------
|
17
17
|
# ISSUE-SILA ---------------------------------
|
18
18
|
# --------------------------------------------
|
19
|
-
# Debits a specified account and issues tokens to the address belonging to the requested handle
|
19
|
+
# Debits a specified account and issues tokens to the address belonging to the requested handle.
|
20
20
|
def self.issue_sila(handle, params={}, user_key)
|
21
21
|
header = { user_handle: handle }
|
22
22
|
message = 'issue_msg'
|
@@ -25,16 +25,19 @@ module SilaRuby
|
|
25
25
|
#
|
26
26
|
# params = {
|
27
27
|
# amount: 1000,
|
28
|
-
# account_name: "default"
|
28
|
+
# account_name: "default",
|
29
|
+
# descriptor: "optional transaction descriptor",
|
30
|
+
# business_uuid: "UUID of a business with an approved ACH name",
|
31
|
+
# processing_type: "STANDARD_ACH" # SAME_DAY_ACH
|
29
32
|
# }
|
30
33
|
|
31
|
-
|
34
|
+
sila_post_signed('issue_sila', header, message, params, user_key)
|
32
35
|
end
|
33
36
|
|
34
37
|
# --------------------------------------------
|
35
38
|
# TRANSFER-SILA ------------------------------
|
36
39
|
# --------------------------------------------
|
37
|
-
# Starts a transfer of the requested amount of SILA to the requested destination handle
|
40
|
+
# Starts a transfer of the requested amount of SILA to the requested destination handle.
|
38
41
|
def self.transfer_sila(handle, params={}, user_key)
|
39
42
|
header = { user_handle: handle }
|
40
43
|
message = 'transfer_msg'
|
@@ -42,17 +45,19 @@ module SilaRuby
|
|
42
45
|
# Example of params passed
|
43
46
|
#
|
44
47
|
# params = {
|
48
|
+
# destination_handle: "user2.silamoney.eth",
|
45
49
|
# amount: 1000,
|
46
|
-
#
|
50
|
+
# descriptor: "optional transaction descriptor",
|
51
|
+
# business_uuid: "UUID of a business with an approved ACH name"
|
47
52
|
# }
|
48
53
|
|
49
|
-
|
54
|
+
sila_post_signed('transfer_sila', header, message, params, user_key)
|
50
55
|
end
|
51
56
|
|
52
57
|
# --------------------------------------------
|
53
58
|
# REDEEM-SILA --------------------------------
|
54
59
|
# --------------------------------------------
|
55
|
-
# Burns given amount of SILA at the handle's blockchain address and credits their named bank account in the equivalent monetary amount
|
60
|
+
# Burns given amount of SILA at the handle's blockchain address and credits their named bank account in the equivalent monetary amount.
|
56
61
|
def self.redeem_sila(handle, params={}, user_key)
|
57
62
|
header = { user_handle: handle }
|
58
63
|
message = 'redeem_msg'
|
@@ -61,16 +66,19 @@ module SilaRuby
|
|
61
66
|
#
|
62
67
|
# params = {
|
63
68
|
# amount: 1000,
|
64
|
-
# account_name: "default"
|
69
|
+
# account_name: "default",
|
70
|
+
# descriptor: "optional transaction descriptor",
|
71
|
+
# business_uuid: "UUID of a business with an approved ACH name",
|
72
|
+
# processing_type: "STANDARD_ACH" # SAME_DAY_ACH
|
65
73
|
# }
|
66
74
|
|
67
|
-
|
75
|
+
sila_post_signed('redeem_sila', header, message, params, user_key)
|
68
76
|
end
|
69
77
|
|
70
78
|
# --------------------------------------------
|
71
79
|
# GET-TRANSACTIONS ---------------------------
|
72
80
|
# --------------------------------------------
|
73
|
-
# Gets array of user handle's transactions with detailed status information
|
81
|
+
# Gets array of user handle's transactions with detailed status information.
|
74
82
|
def self.get_transactions(handle, params={}, user_key)
|
75
83
|
header = { user_handle: handle }
|
76
84
|
message = 'get_transactions_msg'
|
@@ -85,7 +93,7 @@ module SilaRuby
|
|
85
93
|
# sort_ascending: false,
|
86
94
|
# max_sila_amount: 1300,
|
87
95
|
# min_sila_amount: 1000,
|
88
|
-
# statuses: ["
|
96
|
+
# statuses: ["queued", "pending", "failed", "success", "rollback", "review"],
|
89
97
|
# start_epoch: 1234567860,
|
90
98
|
# end_epoch: 1234567891,
|
91
99
|
# page: 1,
|
@@ -94,7 +102,23 @@ module SilaRuby
|
|
94
102
|
# }
|
95
103
|
# }
|
96
104
|
|
97
|
-
|
105
|
+
sila_post_signed('get_transactions', header, message, params, user_key)
|
106
|
+
end
|
107
|
+
|
108
|
+
# --------------------------------------------
|
109
|
+
# CANCEL-TRANSACTION -------------------------
|
110
|
+
# --------------------------------------------
|
111
|
+
# Cancel a pending transaction under certain circumstances.
|
112
|
+
def self.cancel_transaction(handle, params={}, user_key)
|
113
|
+
header = { user_handle: handle }
|
114
|
+
|
115
|
+
# Example of params passed
|
116
|
+
#
|
117
|
+
# params = {
|
118
|
+
# transaction_id: "80aea226-76a3-4b60-a629-25a2db572ec8"
|
119
|
+
# }
|
120
|
+
|
121
|
+
sila_post_signed('cancel_transaction', header, nil, params, user_key)
|
98
122
|
end
|
99
123
|
|
100
124
|
end
|
data/lib/sila-ruby/version.rb
CHANGED
@@ -0,0 +1,81 @@
|
|
1
|
+
# ================================================
|
2
|
+
# SILA-RUBY ======================================
|
3
|
+
# ================================================
|
4
|
+
module SilaRuby
|
5
|
+
|
6
|
+
# ==============================================
|
7
|
+
# WALLETS ======================================
|
8
|
+
# ==============================================
|
9
|
+
class Wallets
|
10
|
+
|
11
|
+
# --------------------------------------------
|
12
|
+
# INCLUDES -----------------------------------
|
13
|
+
# --------------------------------------------
|
14
|
+
include ApiHelpers
|
15
|
+
|
16
|
+
# --------------------------------------------
|
17
|
+
# REGISTER-WALLET ----------------------------
|
18
|
+
# --------------------------------------------
|
19
|
+
# Adds another "wallet"/blockchain address to a user handle.
|
20
|
+
# TODO: https://docs.silamoney.com/docs/register_wallet
|
21
|
+
|
22
|
+
# --------------------------------------------
|
23
|
+
# GET-WALLET ---------------------------------
|
24
|
+
# --------------------------------------------
|
25
|
+
# Gets details about the user wallet used to generate the usersignature header.
|
26
|
+
def self.get_wallet(handle, user_key)
|
27
|
+
header = { user_handle: handle }
|
28
|
+
sila_post_signed('get_wallet', header, nil, nil, user_key)
|
29
|
+
end
|
30
|
+
|
31
|
+
# --------------------------------------------
|
32
|
+
# GET-WALLETS --------------------------------
|
33
|
+
# --------------------------------------------
|
34
|
+
# Gets array of user handle's transactions with detailed status information.
|
35
|
+
def self.get_wallets(handle, params={}, user_key)
|
36
|
+
header = { user_handle: handle }
|
37
|
+
|
38
|
+
# Example of params passed
|
39
|
+
#
|
40
|
+
# params = {
|
41
|
+
# search_filters: {
|
42
|
+
# page: 1,
|
43
|
+
# per_page: 20,
|
44
|
+
# sort_ascending: false,
|
45
|
+
# blockchain_network: "ETH",
|
46
|
+
# blockchain_address: "",
|
47
|
+
# nickname: ""
|
48
|
+
# }
|
49
|
+
# }
|
50
|
+
|
51
|
+
sila_post_signed('get_wallets', header, nil, params, user_key)
|
52
|
+
end
|
53
|
+
|
54
|
+
# --------------------------------------------
|
55
|
+
# UPDATE-WALLET ------------------------------
|
56
|
+
# --------------------------------------------
|
57
|
+
# Updates nickname and/or default status of a wallet.
|
58
|
+
# TODO: https://docs.silamoney.com/docs/update_wallet
|
59
|
+
|
60
|
+
# --------------------------------------------
|
61
|
+
# GET-SILA-BALANCE ---------------------------
|
62
|
+
# --------------------------------------------
|
63
|
+
# Checks token balance on a blockchain address.
|
64
|
+
def self.get_sila_balance(params={})
|
65
|
+
# Example of params passed
|
66
|
+
#
|
67
|
+
# params = {
|
68
|
+
# address: "0x..."
|
69
|
+
# }
|
70
|
+
|
71
|
+
sila_post_signed('get_sila_balance', nil, nil, params, nil)
|
72
|
+
end
|
73
|
+
|
74
|
+
# --------------------------------------------
|
75
|
+
# DELETE-WALLET ------------------------------
|
76
|
+
# --------------------------------------------
|
77
|
+
# Deletes a user wallet.
|
78
|
+
# https://docs.silamoney.com/docs/delete_wallet
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
data/lib/sila_ruby.rb
CHANGED
@@ -10,9 +10,10 @@ require 'eth'
|
|
10
10
|
|
11
11
|
require 'sila-ruby/version'
|
12
12
|
require 'sila-ruby/api_helpers'
|
13
|
+
require 'sila-ruby/entities'
|
13
14
|
require 'sila-ruby/accounts'
|
14
|
-
require 'sila-ruby/banks'
|
15
15
|
require 'sila-ruby/transactions'
|
16
|
+
require 'sila-ruby/wallets'
|
16
17
|
|
17
18
|
# ================================================
|
18
19
|
# SILA-RUBY ======================================
|
data/sila-ruby.gemspec
CHANGED
@@ -7,12 +7,12 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = 'sila-ruby'
|
8
8
|
spec.version = SilaRuby::VERSION
|
9
9
|
spec.licenses = ['MIT']
|
10
|
-
spec.authors = ['
|
11
|
-
spec.email = ['
|
10
|
+
spec.authors = ['Sequoir']
|
11
|
+
spec.email = ['engineering@sequoir.com']
|
12
12
|
|
13
13
|
spec.summary = 'Ruby implementation of the Sila API'
|
14
14
|
spec.description = 'Ruby implementation of the Sila API'
|
15
|
-
spec.homepage = 'https://github.com/
|
15
|
+
spec.homepage = 'https://github.com/sequoir/sila-ruby'
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
18
|
f.match(%r{^(test|spec|features)/})
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sila-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Sequoir
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -152,13 +152,18 @@ dependencies:
|
|
152
152
|
version: 0.5.0
|
153
153
|
description: Ruby implementation of the Sila API
|
154
154
|
email:
|
155
|
-
-
|
155
|
+
- engineering@sequoir.com
|
156
156
|
executables: []
|
157
157
|
extensions: []
|
158
158
|
extra_rdoc_files: []
|
159
159
|
files:
|
160
160
|
- ".DS_Store"
|
161
161
|
- ".gitignore"
|
162
|
+
- ".idea/.gitignore"
|
163
|
+
- ".idea/misc.xml"
|
164
|
+
- ".idea/modules.xml"
|
165
|
+
- ".idea/sila-ruby.iml"
|
166
|
+
- ".idea/vcs.xml"
|
162
167
|
- ".rspec"
|
163
168
|
- Gemfile
|
164
169
|
- Gemfile.lock
|
@@ -170,12 +175,13 @@ files:
|
|
170
175
|
- lib/sila-ruby.rb
|
171
176
|
- lib/sila-ruby/accounts.rb
|
172
177
|
- lib/sila-ruby/api_helpers.rb
|
173
|
-
- lib/sila-ruby/
|
178
|
+
- lib/sila-ruby/entities.rb
|
174
179
|
- lib/sila-ruby/transactions.rb
|
175
180
|
- lib/sila-ruby/version.rb
|
181
|
+
- lib/sila-ruby/wallets.rb
|
176
182
|
- lib/sila_ruby.rb
|
177
183
|
- sila-ruby.gemspec
|
178
|
-
homepage: https://github.com/
|
184
|
+
homepage: https://github.com/sequoir/sila-ruby
|
179
185
|
licenses:
|
180
186
|
- MIT
|
181
187
|
metadata: {}
|
@@ -194,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
200
|
- !ruby/object:Gem::Version
|
195
201
|
version: '0'
|
196
202
|
requirements: []
|
197
|
-
rubygems_version: 3.
|
203
|
+
rubygems_version: 3.1.2
|
198
204
|
signing_key:
|
199
205
|
specification_version: 4
|
200
206
|
summary: Ruby implementation of the Sila API
|
data/lib/sila-ruby/banks.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# ================================================
|
2
|
-
# SILA-RUBY ======================================
|
3
|
-
# ================================================
|
4
|
-
module SilaRuby
|
5
|
-
|
6
|
-
# ==============================================
|
7
|
-
# BANKS ========================================
|
8
|
-
# ==============================================
|
9
|
-
class Banks
|
10
|
-
|
11
|
-
# --------------------------------------------
|
12
|
-
# INCLUDES -----------------------------------
|
13
|
-
# --------------------------------------------
|
14
|
-
include ApiHelpers
|
15
|
-
|
16
|
-
# --------------------------------------------
|
17
|
-
# LINK-ACCOUNT -------------------------------
|
18
|
-
# --------------------------------------------
|
19
|
-
# Uses a provided Plaid public token to link a bank account to a verified entity
|
20
|
-
def self.link_account(handle, params={}, user_key)
|
21
|
-
header = { user_handle: handle }
|
22
|
-
message = 'link_account_msg'
|
23
|
-
|
24
|
-
# Example of params passed
|
25
|
-
#
|
26
|
-
# params = {
|
27
|
-
# public_token: "public-xxx-xxx",
|
28
|
-
# account_name: "Custom Account Name",
|
29
|
-
# selected_account_id: "optional_selected_account_id"
|
30
|
-
# }
|
31
|
-
|
32
|
-
post_signed('link_account', header, message, params, user_key)
|
33
|
-
end
|
34
|
-
|
35
|
-
# --------------------------------------------
|
36
|
-
# GET-ACCOUNTS -------------------------------
|
37
|
-
# --------------------------------------------
|
38
|
-
# Gets basic bank account names linked to user handle
|
39
|
-
def self.get_accounts(handle, user_key)
|
40
|
-
header = { user_handle: handle }
|
41
|
-
message = 'get_accounts_msg'
|
42
|
-
post_signed('get_accounts', header, message, nil, user_key)
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
end
|