synapseruby 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/synapse_api/client.rb +348 -327
- data/lib/synapse_api/http_request.rb +134 -134
- data/lib/synapse_api/user.rb +675 -671
- data/lib/synapse_api/version.rb +1 -1
- metadata +2 -3
- data/pkg/synapseruby-1.0.7.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56fe27dc75f1d36c7b94c33b80c656b98391f03b
|
4
|
+
data.tar.gz: e8eb6cdc0fd6d4802423fffb9414aa364c272c87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a7227f416426f8974e9194b0786b0f9de8ac1764d4b320c5b3c48da78f09f3c056c4085cc88fc53891fabc047f84c92a7cd7b7c5ecd79daf886fb4ff8e2b42d
|
7
|
+
data.tar.gz: 75a8b983c85b2fd841653fab9ce9f56b8bcb80939724986b0570f2c4d5e31e2da1cf130ac06818942ee6ac56822938fb884e5d38b9a0d6d3f8f0d1918383d913
|
data/lib/synapse_api/client.rb
CHANGED
@@ -5,355 +5,376 @@ module Synapse
|
|
5
5
|
# Initializes various wrapper settings such as development mode and request
|
6
6
|
# header values
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
end
|
8
|
+
class Client
|
9
|
+
VALID_QUERY_PARAMS = [:query, :page, :per_page, :full_dehydrate, :radius, :zip, :lat, :lon, :limit, :currency, :ticker_symbol].freeze
|
10
|
+
|
11
|
+
attr_accessor :http_client
|
12
|
+
|
13
|
+
attr_reader :client_id
|
14
|
+
|
15
|
+
# Alias for #http_client
|
16
|
+
alias_method :client, :http_client
|
17
|
+
|
18
|
+
# @param client_id [String] should be stored in environment variable
|
19
|
+
# @param client_secret [String] should be stored in environment variable
|
20
|
+
# @param ip_address [String] user's IP address
|
21
|
+
# @param fingerprint [String] a hashed value, either unique to user or static
|
22
|
+
# @param development_mode [String] default true
|
23
|
+
# @param raise_for_202 [Boolean]
|
24
|
+
# @param logging [Boolean] (optional) logs to stdout when true
|
25
|
+
# @param log_to [String] (optional) file path to log to file (logging must be true)
|
26
|
+
def initialize(client_id:, client_secret:, ip_address:, fingerprint:nil,development_mode: true, raise_for_202:nil, **options)
|
27
|
+
base_url = if development_mode
|
28
|
+
'https://uat-api.synapsefi.com/v3.1'
|
29
|
+
else
|
30
|
+
'https://api.synapsefi.com/v3.1'
|
31
|
+
end
|
32
|
+
@client_id = client_id
|
33
|
+
@client_secret = client_secret
|
34
|
+
@http_client = HTTPClient.new(base_url: base_url,
|
35
|
+
client_id: client_id,
|
36
|
+
client_secret: client_secret,
|
37
|
+
fingerprint: fingerprint,
|
38
|
+
ip_address: ip_address,
|
39
|
+
raise_for_202: raise_for_202,
|
40
|
+
**options
|
41
|
+
)
|
42
|
+
end
|
44
43
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
end
|
44
|
+
# Queries Synapse API to create a new user
|
45
|
+
# @param payload [Hash]
|
46
|
+
# @param idempotency_key [String] (optional)
|
47
|
+
# @param ip_address [String] (optional)
|
48
|
+
# @param fingerprint [String] (optional)
|
49
|
+
# @return [Synapse::User]
|
50
|
+
# @see https://docs.synapsepay.com/docs/create-a-user payload structure
|
51
|
+
def create_user(payload:, ip_address:, **options)
|
52
|
+
client.update_headers(ip_address: ip_address, fingerprint: options[:fingerprint])
|
53
|
+
|
54
|
+
response = client.post(user_path,payload, options)
|
55
|
+
|
56
|
+
User.new(user_id: response['_id'],
|
57
|
+
refresh_token: response['refresh_token'],
|
58
|
+
client: client,
|
59
|
+
full_dehydrate: "no",
|
60
|
+
payload: response
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
# Update headers in HTTPClient class
|
65
|
+
# for API request headers
|
66
|
+
# @param fingerprint [Hash]
|
67
|
+
# @param idemopotency_key [Hash]
|
68
|
+
# @param ip_address [Hash]
|
69
|
+
def update_headers(fingerprint:nil, idemopotency_key:nil, ip_address:nil)
|
70
|
+
client.update_headers(fingerprint: fingerprint, idemopotency_key: idemopotency_key, ip_address: ip_address)
|
71
|
+
end
|
74
72
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
73
|
+
# Queries Synapse API for a user by user_id
|
74
|
+
# @param user_id [String] id of the user to find
|
75
|
+
# @param full_dehydrate [String] (optional) if true, returns all KYC on user
|
76
|
+
# @param ip_address [String] (optional)
|
77
|
+
# @param fingerprint [String] (optional)
|
78
|
+
# @see https://docs.synapsefi.com/docs/get-user
|
79
|
+
# @return [Synapse::User]
|
80
|
+
def get_user(user_id:, **options)
|
81
|
+
raise ArgumentError, 'client must be a Synapse::Client' unless self.is_a?(Client)
|
82
|
+
raise ArgumentError, 'user_id must be a String' unless user_id.is_a?(String)
|
83
|
+
|
84
|
+
options[:full_dehydrate] = "yes" if options[:full_dehydrate] == true
|
85
|
+
options[:full_dehydrate] = "no" if options[:full_dehydrate] == false
|
86
|
+
|
87
|
+
client.update_headers(ip_address: options[:ip_address], fingerprint: options[:fingerprint])
|
88
|
+
|
89
|
+
path = user_path(user_id: user_id, full_dehydrate: options[:full_dehydrate])
|
90
|
+
response = client.get(path)
|
91
|
+
|
92
|
+
User.new(user_id: response['_id'],
|
93
|
+
refresh_token: response['refresh_token'],
|
94
|
+
client: client,
|
95
|
+
full_dehydrate: options[:full_dehydrate] == "yes" ? true : false,
|
96
|
+
payload: response
|
97
|
+
)
|
98
|
+
end
|
99
|
+
|
100
|
+
# Queries Synapse API for platform users
|
101
|
+
# @param query [String] (optional) response will be filtered to
|
102
|
+
# users with matching name/email
|
103
|
+
# @param page [Integer] (optional) response will default to 1
|
104
|
+
# @param per_page [Integer] (optional) response will default to 20
|
105
|
+
# @return [Array<Synapse::Users>]
|
106
|
+
def get_users(**options)
|
107
|
+
path = user_path(options)
|
108
|
+
response = client.get(path)
|
109
|
+
return [] if response["users"].empty?
|
110
|
+
users = response["users"].map { |user_data| User.new(user_id: user_data['_id'],
|
111
|
+
refresh_token: user_data['refresh_token'],
|
112
|
+
client: client,
|
113
|
+
full_dehydrate: "no",
|
114
|
+
payload: user_data
|
115
|
+
)}
|
116
|
+
Users.new(limit: response["limit"],
|
117
|
+
page: response["page"],
|
118
|
+
page_count: response["page_count"],
|
119
|
+
user_count: response["user_count"],
|
120
|
+
payload: users,
|
121
|
+
http_client: client
|
122
|
+
)
|
123
|
+
end
|
124
|
+
|
125
|
+
# Queries Synapse for all transactions on platform
|
126
|
+
# @param page [Integer] (optional) response will default to 1
|
127
|
+
# @param per_page [Integer] (optional) response will default to 20
|
128
|
+
# @return [Array<Synapse::Transactions>]
|
129
|
+
def get_all_transaction(**options)
|
130
|
+
path = '/trans'
|
131
|
+
|
132
|
+
params = VALID_QUERY_PARAMS.map do |p|
|
133
|
+
options[p] ? "#{p}=#{options[p]}" : nil
|
134
|
+
end.compact
|
135
|
+
|
136
|
+
path += '?' + params.join('&') if params.any?
|
137
|
+
|
138
|
+
trans = client.get(path)
|
139
|
+
|
140
|
+
return [] if trans["trans"].empty?
|
141
|
+
response = trans["trans"].map { |trans_data| Transaction.new(trans_id: trans_data['_id'], payload: trans_data)}
|
142
|
+
Transactions.new(limit: trans["limit"],
|
143
|
+
page: trans["page"],
|
144
|
+
page_count: trans["page_count"],
|
145
|
+
trans_count: trans["trans_count"],
|
146
|
+
payload: response
|
147
|
+
)
|
148
|
+
end
|
149
|
+
|
150
|
+
# Queries Synapse API for all nodes belonging to platform
|
151
|
+
# @param page [Integer] (optional) response will default to 1
|
152
|
+
# @param per_page [Integer] (optional) response will default to 20
|
153
|
+
# @return [Array<Synapse::Nodes>]
|
154
|
+
def get_all_nodes(**options)
|
155
|
+
[options[:page], options[:per_page]].each do |arg|
|
156
|
+
if arg && (!arg.is_a?(Integer) || arg < 1)
|
157
|
+
raise ArgumentError, "#{arg} must be nil or an Integer >= 1"
|
158
|
+
end
|
159
|
+
end
|
160
|
+
path = nodes_path(options: options)
|
161
|
+
nodes = client.get(path)
|
162
|
+
|
163
|
+
return [] if nodes["nodes"].empty?
|
164
|
+
response = nodes["nodes"].map { |node_data| Node.new(node_id: node_data['_id'],
|
165
|
+
user_id: node_data['user_id'],
|
166
|
+
payload: node_data,
|
167
|
+
full_dehydrate: "no"
|
168
|
+
)}
|
169
|
+
Nodes.new(limit: nodes["limit"],
|
170
|
+
page: nodes["page"],
|
171
|
+
page_count: nodes["page_count"],
|
172
|
+
nodes_count: nodes["node_count"],
|
173
|
+
payload: response
|
174
|
+
)
|
175
|
+
end
|
176
|
+
|
177
|
+
# Queries Synapse API for all institutions available for bank logins
|
178
|
+
# @param page [Integer] (optional) response will default to 1
|
179
|
+
# @param per_page [Integer] (optional) response will default to 20
|
180
|
+
# @return API response [Hash]
|
181
|
+
def get_all_institutions(**options)
|
182
|
+
client.get(institutions_path(options))
|
183
|
+
end
|
184
|
+
|
185
|
+
# Queries Synapse API to create a webhook subscriptions for platform
|
186
|
+
# @param scope [Hash]
|
187
|
+
# @param idempotency_key [String] (optional)
|
188
|
+
# @see https://docs.synapsefi.com/docs/create-subscription
|
189
|
+
# @return [Synapse::Subscription]
|
190
|
+
def create_subscriptions(scope:, **options)
|
191
|
+
response = client.post(subscriptions_path , scope, options)
|
192
|
+
|
193
|
+
Subscription.new(subscription_id: response["_id"], url: response["url"], payload: response)
|
194
|
+
end
|
195
|
+
|
196
|
+
# Queries Synapse API for all platform subscriptions
|
197
|
+
# @param page [Integer] (optional) response will default to 1
|
198
|
+
# @param per_page [Integer] (optional) response will default to 20
|
199
|
+
# @return [Array<Synapse::Subscriptions>]
|
200
|
+
def get_all_subscriptions(**options)
|
201
|
+
subscriptions = client.get(subscriptions_path(options))
|
202
|
+
|
203
|
+
return [] if subscriptions["subscriptions"].empty?
|
204
|
+
response = subscriptions["subscriptions"].map { |subscription_data| Subscription.new(subscription_id: subscription_data["_id"],
|
205
|
+
url: subscription_data["url"],
|
206
|
+
payload: subscription_data)}
|
207
|
+
Subscriptions.new(limit: subscriptions["limit"],
|
208
|
+
page: subscriptions["page"],
|
209
|
+
page_count: subscriptions["page_count"],
|
210
|
+
subscriptions_count: subscriptions["subscription_count"],
|
211
|
+
payload: response
|
212
|
+
)
|
213
|
+
end
|
214
|
+
|
215
|
+
# Queries Synapse API for a subscription by subscription_id
|
216
|
+
# @param subscription_id [String]
|
217
|
+
# @return [Synapse::Subscription]
|
218
|
+
def get_subscription(subscription_id:)
|
219
|
+
path = subscriptions_path + "/#{subscription_id}"
|
220
|
+
response = client.get(path)
|
221
|
+
Subscription.new(subscription_id: response["_id"], url: response["url"], payload: response)
|
222
|
+
end
|
223
|
+
|
224
|
+
# Updates subscription platform subscription
|
225
|
+
# @param subscription_id [String]
|
226
|
+
# @param body [Hash]
|
227
|
+
# see https://docs.synapsefi.com/docs/update-subscription
|
228
|
+
# @return [Synapse::Subscription]
|
229
|
+
def update_subscriptions(subscription_id:, body:)
|
230
|
+
path = subscriptions_path + "/#{subscription_id}"
|
231
|
+
|
232
|
+
response = client.patch(path, body)
|
233
|
+
Subscription.new(subscription_id: response["_id"], url: response["url"], payload: response)
|
160
234
|
end
|
161
|
-
end
|
162
|
-
path = nodes_path(options: options)
|
163
|
-
nodes = client.get(path)
|
164
|
-
|
165
|
-
return [] if nodes["nodes"].empty?
|
166
|
-
response = nodes["nodes"].map { |node_data| Node.new(node_id: node_data['_id'],
|
167
|
-
user_id: node_data['user_id'],
|
168
|
-
payload: node_data,
|
169
|
-
full_dehydrate: "no"
|
170
|
-
)}
|
171
|
-
Nodes.new(limit: nodes["limit"],
|
172
|
-
page: nodes["page"],
|
173
|
-
page_count: nodes["page_count"],
|
174
|
-
nodes_count: nodes["node_count"],
|
175
|
-
payload: response
|
176
|
-
)
|
177
|
-
end
|
178
|
-
|
179
|
-
# Queries Synapse API for all institutions available for bank logins
|
180
|
-
# @param page [Integer] (optional) response will default to 1
|
181
|
-
# @param per_page [Integer] (optional) response will default to 20
|
182
|
-
# @return API response [Hash]
|
183
|
-
def get_all_institutions(**options)
|
184
|
-
client.get(institutions_path(options))
|
185
|
-
end
|
186
|
-
|
187
|
-
# Queries Synapse API to create a webhook subscriptions for platform
|
188
|
-
# @param scope [Hash]
|
189
|
-
# @param idempotency_key [String] (optional)
|
190
|
-
# @see https://docs.synapsefi.com/docs/create-subscription
|
191
|
-
# @return [Synapse::Subscription]
|
192
|
-
def create_subscriptions(scope:, **options)
|
193
|
-
response = client.post(subscriptions_path , scope, options)
|
194
|
-
|
195
|
-
Subscription.new(subscription_id: response["_id"], url: response["url"], payload: response)
|
196
|
-
end
|
197
|
-
|
198
|
-
# Queries Synapse API for all platform subscriptions
|
199
|
-
# @param page [Integer] (optional) response will default to 1
|
200
|
-
# @param per_page [Integer] (optional) response will default to 20
|
201
|
-
# @return [Array<Synapse::Subscriptions>]
|
202
|
-
def get_all_subscriptions(**options)
|
203
|
-
subscriptions = client.get(subscriptions_path(options))
|
204
|
-
|
205
|
-
return [] if subscriptions["subscriptions"].empty?
|
206
|
-
response = subscriptions["subscriptions"].map { |subscription_data| Subscription.new(subscription_id: subscription_data["_id"],
|
207
|
-
url: subscription_data["url"],
|
208
|
-
payload: subscription_data)}
|
209
|
-
Subscriptions.new(limit: subscriptions["limit"],
|
210
|
-
page: subscriptions["page"],
|
211
|
-
page_count: subscriptions["page_count"],
|
212
|
-
subscriptions_count: subscriptions["subscription_count"],
|
213
|
-
payload: response
|
214
|
-
)
|
215
|
-
end
|
216
|
-
|
217
|
-
# Queries Synapse API for a subscription by subscription_id
|
218
|
-
# @param subscription_id [String]
|
219
|
-
# @return [Synapse::Subscription]
|
220
|
-
def get_subscription(subscription_id:)
|
221
|
-
path = subscriptions_path + "/#{subscription_id}"
|
222
|
-
response = client.get(path)
|
223
|
-
Subscription.new(subscription_id: response["_id"], url: response["url"], payload: response)
|
224
|
-
end
|
225
|
-
|
226
|
-
# Updates subscription platform subscription
|
227
|
-
# @param subscription_id [String]
|
228
|
-
# @param body [Hash]
|
229
|
-
# see https://docs.synapsefi.com/docs/update-subscription
|
230
|
-
# @return [Synapse::Subscription]
|
231
|
-
def update_subscriptions(subscription_id:, body:)
|
232
|
-
path = subscriptions_path + "/#{subscription_id}"
|
233
|
-
|
234
|
-
response = client.patch(path, body)
|
235
|
-
Subscription.new(subscription_id: response["_id"], url: response["url"], payload: response)
|
236
|
-
end
|
237
235
|
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
236
|
+
# Returns all of the webhooks belonging to client
|
237
|
+
# @return [Hash]
|
238
|
+
def webhook_logs()
|
239
|
+
path = subscriptions_path + "/logs"
|
240
|
+
client.get(path)
|
241
|
+
end
|
244
242
|
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
243
|
+
# Issues public key for client
|
244
|
+
# @param scope [String]
|
245
|
+
# @see https://docs.synapsefi.com/docs/issuing-public-key
|
246
|
+
# @note valid scope "OAUTH|POST,USERS|POST,USERS|GET,USER|GET,USER|PATCH,SUBSCRIPTIONS|GET,SUBSCRIPTIONS|POST,SUBSCRIPTION|GET,SUBSCRIPTION|PATCH,CLIENT|REPORTS,CLIENT|CONTROLS"
|
247
|
+
def issue_public_key(scope:)
|
248
|
+
path = '/client?issue_public_key=YES'
|
249
|
+
path += "&scope=#{scope}"
|
250
|
+
response = client.get(path)
|
251
|
+
response[ "public_key_obj"]
|
252
|
+
end
|
253
|
+
|
254
|
+
# Queries Synapse API for ATMS nearby
|
255
|
+
# @param zip [String]
|
256
|
+
# @param radius [String]
|
257
|
+
# @param lat [String]
|
258
|
+
# @param lon [String]
|
259
|
+
# @see https://docs.synapsefi.com/docs/locate-atms
|
260
|
+
# @return [Hash]
|
261
|
+
def locate_atm(**options)
|
262
|
+
params = VALID_QUERY_PARAMS.map do |p|
|
263
|
+
options[p] ? "#{p}=#{options[p]}" : nil
|
264
|
+
end.compact
|
265
|
+
|
266
|
+
path = "/nodes/atms?"
|
267
|
+
path += params.join('&') if params.any?
|
268
|
+
atms = client.get(path)
|
269
|
+
atms
|
270
|
+
end
|
273
271
|
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
272
|
+
# Queries Synapse API for Crypto Currencies Quotes
|
273
|
+
# @return API response [Hash]
|
274
|
+
def get_crypto_quotes()
|
275
|
+
path = '/nodes/crypto-quotes'
|
276
|
+
params = VALID_QUERY_PARAMS.map do |p|
|
277
|
+
options[p] ? "#{p}=#{options[p]}" : nil
|
278
|
+
end.compact
|
279
|
+
|
280
|
+
path += '?' + params.join('&') if params.any?
|
281
|
+
quotes = client.get(path)
|
282
|
+
quotes
|
283
|
+
end
|
286
284
|
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
285
|
+
# Queries Synapse API for Crypto Currencies Market data
|
286
|
+
# @param limit [Integer]
|
287
|
+
# @param currency [String]
|
288
|
+
# @return API response [Hash]
|
289
|
+
def get_crypto_market_data(**options)
|
290
|
+
path = '/nodes/crypto-market-watch'
|
293
291
|
|
294
|
-
|
295
|
-
|
296
|
-
|
292
|
+
params = VALID_QUERY_PARAMS.map do |p|
|
293
|
+
options[p] ? "#{p}=#{options[p]}" : nil
|
294
|
+
end.compact
|
297
295
|
|
298
|
-
|
296
|
+
path += '?' + params.join('&') if params.any?
|
299
297
|
|
300
|
-
|
301
|
-
|
302
|
-
|
298
|
+
data = client.get(path)
|
299
|
+
data
|
300
|
+
end
|
303
301
|
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
302
|
+
# Queries Synapse API for Trade Market data
|
303
|
+
# @param ticker_symbol [String]
|
304
|
+
# @return API response [Hash]
|
305
|
+
def get_trade_market_data(**options)
|
306
|
+
path = '/nodes/trade-market-watch'
|
308
307
|
|
309
|
-
|
310
|
-
|
311
|
-
|
308
|
+
params = VALID_QUERY_PARAMS.map do |p|
|
309
|
+
options[p] ? "#{p}=#{options[p]}" : nil
|
310
|
+
end.compact
|
312
311
|
|
313
|
-
|
314
|
-
|
315
|
-
|
312
|
+
path += '?' + params.join('&') if params.any?
|
313
|
+
|
314
|
+
market_data = client.get(path)
|
315
|
+
market_data
|
316
|
+
end
|
316
317
|
|
317
|
-
|
318
|
-
|
319
|
-
params = VALID_QUERY_PARAMS.map do |p|
|
320
|
-
options[p] ? "#{p}=#{options[p]}" : nil
|
321
|
-
end.compact
|
318
|
+
def routing_number(payload:)
|
319
|
+
path = '/routing-number-verification'
|
322
320
|
|
323
|
-
|
324
|
-
|
325
|
-
|
321
|
+
response = client.post(path,payload)
|
322
|
+
response
|
323
|
+
end
|
326
324
|
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
end.compact
|
325
|
+
private
|
326
|
+
def user_path(user_id: nil, **options)
|
327
|
+
path = "/users"
|
328
|
+
path += "/#{user_id}" if user_id
|
332
329
|
|
333
|
-
|
334
|
-
|
335
|
-
|
330
|
+
params = VALID_QUERY_PARAMS.map do |p|
|
331
|
+
options[p] ? "#{p}=#{options[p]}" : nil
|
332
|
+
end.compact
|
336
333
|
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
options[p] ? "#{p}=#{options[p]}" : nil
|
341
|
-
end.compact
|
334
|
+
path += '?' + params.join('&') if params.any?
|
335
|
+
path
|
336
|
+
end
|
342
337
|
|
343
|
-
|
344
|
-
|
345
|
-
|
338
|
+
def transactions_path(user_id: nil, node_id: nil, **options)
|
339
|
+
path = "/users/#{user_id}/trans"
|
340
|
+
params = VALID_QUERY_PARAMS.map do |p|
|
341
|
+
options[p] ? "#{p}=#{options[p]}" : nil
|
342
|
+
end.compact
|
343
|
+
|
344
|
+
path += '?' + params.join('&') if params.any?
|
345
|
+
path
|
346
|
+
end
|
346
347
|
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
348
|
+
def nodes_path(**options)
|
349
|
+
path = "/nodes"
|
350
|
+
params = VALID_QUERY_PARAMS.map do |p|
|
351
|
+
options[p] ? "#{p}=#{options[p]}" : nil
|
352
|
+
end.compact
|
352
353
|
|
353
|
-
|
354
|
-
|
354
|
+
path += '?' + params.join('&') if params.any?
|
355
|
+
path
|
356
|
+
end
|
357
|
+
|
358
|
+
def institutions_path(**options)
|
359
|
+
path = "/institutions"
|
360
|
+
params = VALID_QUERY_PARAMS.map do |p|
|
361
|
+
options[p] ? "#{p}=#{options[p]}" : nil
|
362
|
+
end.compact
|
363
|
+
|
364
|
+
path += '?' + params.join('&') if params.any?
|
365
|
+
path
|
366
|
+
end
|
367
|
+
|
368
|
+
def subscriptions_path(**options)
|
369
|
+
path = "/subscriptions"
|
370
|
+
params = VALID_QUERY_PARAMS.map do |p|
|
371
|
+
options[p] ? "#{p}=#{options[p]}" : nil
|
372
|
+
end.compact
|
373
|
+
|
374
|
+
path += '?' + params.join('&') if params.any?
|
375
|
+
path
|
376
|
+
end
|
355
377
|
end
|
356
|
-
end
|
357
378
|
end
|
358
379
|
|
359
380
|
|