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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d421aecc7dea8dcd521a33552545ceccbd90e45f
4
- data.tar.gz: d9edd4a8453c4b6b306864293330d9643b9d5394
3
+ metadata.gz: 56fe27dc75f1d36c7b94c33b80c656b98391f03b
4
+ data.tar.gz: e8eb6cdc0fd6d4802423fffb9414aa364c272c87
5
5
  SHA512:
6
- metadata.gz: 642e5aa4858e473c39564b3ab6206b70c56a7863e130feec2429072026e5cfe44ec942c1e393efce282069a7116b9692a54c78bbbaf5fe8d40e743e73000bc71
7
- data.tar.gz: aed1ce49b260f9a619f4176737e1557c9fba40853381e470a3e6fecdba3094da025cbe61ed944b71e379e08b07ce2a8211d162fbadd2bc45db21da934a8c0420
6
+ metadata.gz: 4a7227f416426f8974e9194b0786b0f9de8ac1764d4b320c5b3c48da78f09f3c056c4085cc88fc53891fabc047f84c92a7cd7b7c5ecd79daf886fb4ff8e2b42d
7
+ data.tar.gz: 75a8b983c85b2fd841653fab9ce9f56b8bcb80939724986b0570f2c4d5e31e2da1cf130ac06818942ee6ac56822938fb884e5d38b9a0d6d3f8f0d1918383d913
@@ -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
- class Client
9
-
10
- VALID_QUERY_PARAMS = [:query, :page, :per_page, :full_dehydrate, :radius, :zip, :lat, :lon, :limit, :currency].freeze
11
-
12
- attr_accessor :http_client
13
-
14
- attr_reader :client_id
15
-
16
- # Alias for #http_client
17
- alias_method :client, :http_client
18
-
19
- # @param client_id [String] should be stored in environment variable
20
- # @param client_secret [String] should be stored in environment variable
21
- # @param ip_address [String] user's IP address
22
- # @param fingerprint [String] a hashed value, either unique to user or static
23
- # @param development_mode [String] default true
24
- # @param raise_for_202 [Boolean]
25
- # @param logging [Boolean] (optional) logs to stdout when true
26
- # @param log_to [String] (optional) file path to log to file (logging must be true)
27
- def initialize(client_id:, client_secret:, ip_address:, fingerprint:nil,development_mode: true, raise_for_202:nil, **options)
28
- base_url = if development_mode
29
- 'https://uat-api.synapsefi.com/v3.1'
30
- else
31
- 'https://api.synapsefi.com/v3.1'
32
- end
33
- @client_id = client_id
34
- @client_secret = client_secret
35
- @http_client = HTTPClient.new(base_url: base_url,
36
- client_id: client_id,
37
- client_secret: client_secret,
38
- fingerprint: fingerprint,
39
- ip_address: ip_address,
40
- raise_for_202: raise_for_202,
41
- **options
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
- # Queries Synapse API to create a new user
46
- # @param payload [Hash]
47
- # @param idempotency_key [String] (optional)
48
- # @param ip_address [String] (optional)
49
- # @param fingerprint [String] (optional)
50
- # @return [Synapse::User]
51
- # @see https://docs.synapsepay.com/docs/create-a-user payload structure
52
- def create_user(payload:, ip_address:, **options)
53
-
54
- client.update_headers(ip_address: ip_address, fingerprint: options[:fingerprint])
55
-
56
- response = client.post(user_path,payload, options)
57
-
58
- User.new(user_id: response['_id'],
59
- refresh_token: response['refresh_token'],
60
- client: client,
61
- full_dehydrate: "no",
62
- payload: response
63
- )
64
- end
65
-
66
- # Update headers in HTTPClient class
67
- # for API request headers
68
- # @param fingerprint [Hash]
69
- # @param idemopotency_key [Hash]
70
- # @param ip_address [Hash]
71
- def update_headers(fingerprint:nil, idemopotency_key:nil, ip_address:nil)
72
- client.update_headers(fingerprint: fingerprint, idemopotency_key: idemopotency_key, ip_address: ip_address)
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
- # Queries Synapse API for a user by user_id
76
- # @param user_id [String] id of the user to find
77
- # @param full_dehydrate [String] (optional) if true, returns all KYC on user
78
- # @param ip_address [String] (optional)
79
- # @param fingerprint [String] (optional)
80
- # @see https://docs.synapsefi.com/docs/get-user
81
- # @return [Synapse::User]
82
- def get_user(user_id:, **options)
83
- raise ArgumentError, 'client must be a Synapse::Client' unless self.is_a?(Client)
84
- raise ArgumentError, 'user_id must be a String' unless user_id.is_a?(String)
85
-
86
- options[:full_dehydrate] = "yes" if options[:full_dehydrate] == true
87
- options[:full_dehydrate] = "no" if options[:full_dehydrate] == false
88
-
89
- client.update_headers(ip_address: options[:ip_address], fingerprint: options[:fingerprint])
90
-
91
- path = user_path(user_id: user_id, full_dehydrate: options[:full_dehydrate])
92
- response = client.get(path)
93
-
94
- User.new(user_id: response['_id'],
95
- refresh_token: response['refresh_token'],
96
- client: client,
97
- full_dehydrate: options[:full_dehydrate] == "yes" ? true : false,
98
- payload: response
99
- )
100
- end
101
-
102
- # Queries Synapse API for platform users
103
- # @param query [String] (optional) response will be filtered to
104
- # users with matching name/email
105
- # @param page [Integer] (optional) response will default to 1
106
- # @param per_page [Integer] (optional) response will default to 20
107
- # @return [Array<Synapse::Users>]
108
- def get_users(**options)
109
- path = user_path(options)
110
- response = client.get(path)
111
- return [] if response["users"].empty?
112
- users = response["users"].map { |user_data| User.new(user_id: user_data['_id'],
113
- refresh_token: user_data['refresh_token'],
114
- client: client,
115
- full_dehydrate: "no",
116
- payload: user_data
117
- )}
118
- Users.new(limit: response["limit"],
119
- page: response["page"],
120
- page_count: response["page_count"],
121
- user_count: response["user_count"],
122
- payload: users,
123
- http_client: client
124
- )
125
- end
126
-
127
- # Queries Synapse for all transactions on platform
128
- # @param page [Integer] (optional) response will default to 1
129
- # @param per_page [Integer] (optional) response will default to 20
130
- # @return [Array<Synapse::Transactions>]
131
- def get_all_transaction(**options)
132
- path = '/trans'
133
-
134
- params = VALID_QUERY_PARAMS.map do |p|
135
- options[p] ? "#{p}=#{options[p]}" : nil
136
- end.compact
137
-
138
- path += '?' + params.join('&') if params.any?
139
-
140
- trans = client.get(path)
141
-
142
- return [] if trans["trans"].empty?
143
- response = trans["trans"].map { |trans_data| Transaction.new(trans_id: trans_data['_id'], payload: trans_data)}
144
- Transactions.new(limit: trans["limit"],
145
- page: trans["page"],
146
- page_count: trans["page_count"],
147
- trans_count: trans["trans_count"],
148
- payload: response
149
- )
150
- end
151
-
152
- # Queries Synapse API for all nodes belonging to platform
153
- # @param page [Integer] (optional) response will default to 1
154
- # @param per_page [Integer] (optional) response will default to 20
155
- # @return [Array<Synapse::Nodes>]
156
- def get_all_nodes(**options)
157
- [options[:page], options[:per_page]].each do |arg|
158
- if arg && (!arg.is_a?(Integer) || arg < 1)
159
- raise ArgumentError, "#{arg} must be nil or an Integer >= 1"
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
- # Returns all of the webhooks belonging to client
239
- # @return [Hash]
240
- def webhook_logs()
241
- path = subscriptions_path + "/logs"
242
- client.get(path)
243
- end
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
- # Issues public key for client
246
- # @param scope [String]
247
- # @see https://docs.synapsefi.com/docs/issuing-public-key
248
- # @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"
249
- def issue_public_key(scope:)
250
- path = '/client?issue_public_key=YES'
251
- path += "&scope=#{scope}"
252
- response = client.get(path)
253
- response[ "public_key_obj"]
254
- end
255
-
256
- # Queries Synapse API for ATMS nearby
257
- # @param zip [String]
258
- # @param radius [String]
259
- # @param lat [String]
260
- # @param lon [String]
261
- # @see https://docs.synapsefi.com/docs/locate-atms
262
- # @return [Hash]
263
- def locate_atm(**options)
264
- params = VALID_QUERY_PARAMS.map do |p|
265
- options[p] ? "#{p}=#{options[p]}" : nil
266
- end.compact
267
-
268
- path = "/nodes/atms?"
269
- path += params.join('&') if params.any?
270
- atms = client.get(path)
271
- atms
272
- end
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
- # Queries Synapse API for Crypto Currencies Quotes
275
- # @return API response [Hash]
276
- def get_crypto_quotes()
277
- path = '/nodes/crypto-quotes'
278
- params = VALID_QUERY_PARAMS.map do |p|
279
- options[p] ? "#{p}=#{options[p]}" : nil
280
- end.compact
281
-
282
- path += '?' + params.join('&') if params.any?
283
- quotes = client.get(path)
284
- quotes
285
- end
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
- # Queries Synapse API for Crypto Currencies Market data
288
- # @param limit [Integer]
289
- # @param currency [String]
290
- # @return API response [Hash]
291
- def get_crypto_market_data(**options)
292
- path = '/nodes/crypto-market-watch'
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
- params = VALID_QUERY_PARAMS.map do |p|
295
- options[p] ? "#{p}=#{options[p]}" : nil
296
- end.compact
292
+ params = VALID_QUERY_PARAMS.map do |p|
293
+ options[p] ? "#{p}=#{options[p]}" : nil
294
+ end.compact
297
295
 
298
- path += '?' + params.join('&') if params.any?
296
+ path += '?' + params.join('&') if params.any?
299
297
 
300
- data = client.get(path)
301
- data
302
- end
298
+ data = client.get(path)
299
+ data
300
+ end
303
301
 
304
- private
305
- def user_path(user_id: nil, **options)
306
- path = "/users"
307
- path += "/#{user_id}" if user_id
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
- params = VALID_QUERY_PARAMS.map do |p|
310
- options[p] ? "#{p}=#{options[p]}" : nil
311
- end.compact
308
+ params = VALID_QUERY_PARAMS.map do |p|
309
+ options[p] ? "#{p}=#{options[p]}" : nil
310
+ end.compact
312
311
 
313
- path += '?' + params.join('&') if params.any?
314
- path
315
- end
312
+ path += '?' + params.join('&') if params.any?
313
+
314
+ market_data = client.get(path)
315
+ market_data
316
+ end
316
317
 
317
- def transactions_path(user_id: nil, node_id: nil, **options)
318
- path = "/users/#{user_id}/trans"
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
- path += '?' + params.join('&') if params.any?
324
- path
325
- end
321
+ response = client.post(path,payload)
322
+ response
323
+ end
326
324
 
327
- def nodes_path(**options)
328
- path = "/nodes"
329
- params = VALID_QUERY_PARAMS.map do |p|
330
- options[p] ? "#{p}=#{options[p]}" : nil
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
- path += '?' + params.join('&') if params.any?
334
- path
335
- end
330
+ params = VALID_QUERY_PARAMS.map do |p|
331
+ options[p] ? "#{p}=#{options[p]}" : nil
332
+ end.compact
336
333
 
337
- def institutions_path(**options)
338
- path = "/institutions"
339
- params = VALID_QUERY_PARAMS.map do |p|
340
- options[p] ? "#{p}=#{options[p]}" : nil
341
- end.compact
334
+ path += '?' + params.join('&') if params.any?
335
+ path
336
+ end
342
337
 
343
- path += '?' + params.join('&') if params.any?
344
- path
345
- end
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
- def subscriptions_path(**options)
348
- path = "/subscriptions"
349
- params = VALID_QUERY_PARAMS.map do |p|
350
- options[p] ? "#{p}=#{options[p]}" : nil
351
- end.compact
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
- path += '?' + params.join('&') if params.any?
354
- path
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