snaptrade 2.0.1 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +19 -27
- data/README.md +2 -1
- data/docs/AuthenticationApi.md +60 -0
- data/lib/snaptrade/api/authentication_api.rb +94 -0
- data/lib/snaptrade/version.rb +1 -1
- data/spec/api/authentication_api_spec.rb +11 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b54cbf9eaddffb92b4da468db18ce6cacccbdc7ea903e00b74f5e3d1cc9909a
|
4
|
+
data.tar.gz: a5e9245a51fb85685b6ca483e312525f676cb2106e5b526138a7a283fc5b077e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 073713fa3b855d4f7d658e5f39fd894e99e6d2b0862437bf45739156b675fe13b557edd4db31829429b54f120647526cd905a574d84179dac03a5e7b96ba45b5
|
7
|
+
data.tar.gz: c85a7ba959893aee32ed82f06b57e431b711bc19851968265354f3daca2773eaeff190fb59318a5cd70065567a44c6220d082706a1b01a37ca48a8822c8d2d0f
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
snaptrade (2.0.
|
4
|
+
snaptrade (2.0.3)
|
5
5
|
faraday (>= 1.0.1, < 3.0)
|
6
6
|
faraday-multipart (~> 1.0, >= 1.0.4)
|
7
7
|
|
@@ -9,47 +9,40 @@ GEM
|
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
11
|
ast (2.4.2)
|
12
|
-
base64 (0.1.1)
|
13
12
|
byebug (11.1.3)
|
14
13
|
coderay (1.1.3)
|
15
14
|
debug (1.8.0)
|
16
15
|
irb (>= 1.5.0)
|
17
16
|
reline (>= 0.3.1)
|
18
17
|
diff-lcs (1.5.0)
|
19
|
-
faraday (2.
|
20
|
-
|
21
|
-
faraday-net_http (>= 2.0, < 3.1)
|
22
|
-
ruby2_keywords (>= 0.0.4)
|
18
|
+
faraday (2.9.0)
|
19
|
+
faraday-net_http (>= 2.0, < 3.2)
|
23
20
|
faraday-multipart (1.0.4)
|
24
21
|
multipart-post (~> 2)
|
25
|
-
faraday-net_http (3.0
|
22
|
+
faraday-net_http (3.1.0)
|
23
|
+
net-http
|
26
24
|
io-console (0.6.0)
|
27
|
-
irb (1.
|
28
|
-
|
29
|
-
reline (>= 0.3.8)
|
25
|
+
irb (1.6.4)
|
26
|
+
reline (>= 0.3.0)
|
30
27
|
method_source (1.0.0)
|
31
28
|
multipart-post (2.3.0)
|
29
|
+
net-http (0.4.1)
|
30
|
+
uri
|
32
31
|
parallel (1.23.0)
|
33
|
-
parser (3.2.2.
|
32
|
+
parser (3.2.2.1)
|
34
33
|
ast (~> 2.4.1)
|
35
|
-
racc
|
36
34
|
pry (0.14.2)
|
37
35
|
coderay (~> 1.1)
|
38
36
|
method_source (~> 1.0)
|
39
37
|
pry-byebug (3.10.1)
|
40
38
|
byebug (~> 11.0)
|
41
39
|
pry (>= 0.13, < 0.15)
|
42
|
-
psych (5.1.0)
|
43
|
-
stringio
|
44
|
-
racc (1.7.1)
|
45
40
|
rainbow (3.1.1)
|
46
41
|
rake (13.0.6)
|
47
|
-
|
48
|
-
|
49
|
-
regexp_parser (2.8.1)
|
50
|
-
reline (0.3.8)
|
42
|
+
regexp_parser (2.8.0)
|
43
|
+
reline (0.3.4)
|
51
44
|
io-console (~> 0.5)
|
52
|
-
rexml (3.2.
|
45
|
+
rexml (3.2.5)
|
53
46
|
rspec (3.12.0)
|
54
47
|
rspec-core (~> 3.12.0)
|
55
48
|
rspec-expectations (~> 3.12.0)
|
@@ -59,10 +52,10 @@ GEM
|
|
59
52
|
rspec-expectations (3.12.3)
|
60
53
|
diff-lcs (>= 1.2.0, < 2.0)
|
61
54
|
rspec-support (~> 3.12.0)
|
62
|
-
rspec-mocks (3.12.
|
55
|
+
rspec-mocks (3.12.5)
|
63
56
|
diff-lcs (>= 1.2.0, < 2.0)
|
64
57
|
rspec-support (~> 3.12.0)
|
65
|
-
rspec-support (3.12.
|
58
|
+
rspec-support (3.12.0)
|
66
59
|
rubocop (1.12.1)
|
67
60
|
parallel (~> 1.10)
|
68
61
|
parser (>= 3.0.0.0)
|
@@ -72,15 +65,14 @@ GEM
|
|
72
65
|
rubocop-ast (>= 1.2.0, < 2.0)
|
73
66
|
ruby-progressbar (~> 1.7)
|
74
67
|
unicode-display_width (>= 1.4.0, < 3.0)
|
75
|
-
rubocop-ast (1.
|
68
|
+
rubocop-ast (1.28.1)
|
76
69
|
parser (>= 3.2.1.0)
|
77
70
|
ruby-progressbar (1.13.0)
|
78
|
-
ruby2_keywords (0.0.5)
|
79
|
-
stringio (3.0.8)
|
80
71
|
unicode-display_width (2.4.2)
|
72
|
+
uri (0.13.0)
|
81
73
|
|
82
74
|
PLATFORMS
|
83
|
-
arm64-darwin-
|
75
|
+
arm64-darwin-21
|
84
76
|
|
85
77
|
DEPENDENCIES
|
86
78
|
debug (~> 1.8)
|
@@ -91,4 +83,4 @@ DEPENDENCIES
|
|
91
83
|
snaptrade!
|
92
84
|
|
93
85
|
BUNDLED WITH
|
94
|
-
2.
|
86
|
+
2.3.7
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ For more information, please visit [https://snaptrade.com/](https://snaptrade.co
|
|
9
9
|
Add to Gemfile:
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
gem 'snaptrade', '~> 2.0.
|
12
|
+
gem 'snaptrade', '~> 2.0.3'
|
13
13
|
```
|
14
14
|
|
15
15
|
## Getting Started
|
@@ -57,6 +57,7 @@ Class | Method | HTTP request | Description
|
|
57
57
|
*SnapTrade::AuthenticationApi* | [**list_snap_trade_users**](docs/AuthenticationApi.md#list_snap_trade_users) | **GET** /snapTrade/listUsers | List SnapTrade users
|
58
58
|
*SnapTrade::AuthenticationApi* | [**login_snap_trade_user**](docs/AuthenticationApi.md#login_snap_trade_user) | **POST** /snapTrade/login | Login user & generate connection link
|
59
59
|
*SnapTrade::AuthenticationApi* | [**register_snap_trade_user**](docs/AuthenticationApi.md#register_snap_trade_user) | **POST** /snapTrade/registerUser | Create SnapTrade user
|
60
|
+
*SnapTrade::AuthenticationApi* | [**reset_snap_trade_user_secret**](docs/AuthenticationApi.md#reset_snap_trade_user_secret) | **POST** /snapTrade/resetUserSecret | Obtain a new user secret for a user
|
60
61
|
*SnapTrade::ConnectionsApi* | [**detail_brokerage_authorization**](docs/ConnectionsApi.md#detail_brokerage_authorization) | **GET** /authorizations/{authorizationId} | Get brokerage authorization details
|
61
62
|
*SnapTrade::ConnectionsApi* | [**list_brokerage_authorizations**](docs/ConnectionsApi.md#list_brokerage_authorizations) | **GET** /authorizations | List all brokerage authorizations for the user
|
62
63
|
*SnapTrade::ConnectionsApi* | [**remove_brokerage_authorization**](docs/ConnectionsApi.md#remove_brokerage_authorization) | **DELETE** /authorizations/{authorizationId} | Delete brokerage authorization
|
data/docs/AuthenticationApi.md
CHANGED
@@ -9,6 +9,7 @@ All URIs are relative to *https://api.snaptrade.com/api/v1*
|
|
9
9
|
| [**list_snap_trade_users**](AuthenticationApi.md#list_snap_trade_users) | **GET** /snapTrade/listUsers | List SnapTrade users |
|
10
10
|
| [**login_snap_trade_user**](AuthenticationApi.md#login_snap_trade_user) | **POST** /snapTrade/login | Login user & generate connection link |
|
11
11
|
| [**register_snap_trade_user**](AuthenticationApi.md#register_snap_trade_user) | **POST** /snapTrade/registerUser | Create SnapTrade user |
|
12
|
+
| [**reset_snap_trade_user_secret**](AuthenticationApi.md#reset_snap_trade_user_secret) | **POST** /snapTrade/resetUserSecret | Obtain a new user secret for a user |
|
12
13
|
|
13
14
|
## delete_snap_trade_user
|
14
15
|
|
@@ -318,3 +319,62 @@ end
|
|
318
319
|
|
319
320
|
[**UserIDandSecret**](UserIDandSecret.md)
|
320
321
|
|
322
|
+
## reset_snap_trade_user_secret
|
323
|
+
|
324
|
+
Obtain a new user secret for a user
|
325
|
+
|
326
|
+
### Example
|
327
|
+
|
328
|
+
```ruby
|
329
|
+
require 'snaptrade'
|
330
|
+
|
331
|
+
SnapTrade.client_id = "YOUR_CLIENT_ID"
|
332
|
+
SnapTrade.consumer_key = "YOUR_CONSUMER_KEY"
|
333
|
+
|
334
|
+
user_id = "snaptrade-user-123"
|
335
|
+
user_secret = "h81@cx1lkalablakwjaltkejraj11="
|
336
|
+
|
337
|
+
begin
|
338
|
+
# Obtain a new user secret for a user
|
339
|
+
result = SnapTrade::Authentication.reset_snap_trade_user_secret(
|
340
|
+
user_id: user_id,
|
341
|
+
user_secret: user_secret,
|
342
|
+
)
|
343
|
+
p result
|
344
|
+
rescue SnapTrade::ApiError => e
|
345
|
+
puts "Exception when calling SnapTrade::Authentication.reset_snap_trade_user_secret: #{e}"
|
346
|
+
end
|
347
|
+
```
|
348
|
+
|
349
|
+
#### Using the reset_snap_trade_user_secret_with_http_info variant
|
350
|
+
|
351
|
+
This returns an Array which contains the response data, status code and headers.
|
352
|
+
|
353
|
+
```ruby
|
354
|
+
user_id = "snaptrade-user-123"
|
355
|
+
user_secret = "h81@cx1lkalablakwjaltkejraj11="
|
356
|
+
|
357
|
+
begin
|
358
|
+
# Obtain a new user secret for a user
|
359
|
+
data, status_code, headers, response = SnapTrade::Authentication.reset_snap_trade_user_secret_with_http_info(
|
360
|
+
user_id: user_id,
|
361
|
+
user_secret: user_secret,
|
362
|
+
)
|
363
|
+
p status_code # => 2xx
|
364
|
+
p headers # => { ... }
|
365
|
+
p data # => UserIDandSecret
|
366
|
+
rescue SnapTrade::ApiError => e
|
367
|
+
puts "Exception when calling SnapTrade::Authentication.reset_snap_trade_user_secret: #{e}"
|
368
|
+
end
|
369
|
+
```
|
370
|
+
|
371
|
+
### Parameters
|
372
|
+
|
373
|
+
| Name | Type | Description | Notes |
|
374
|
+
| ---- | ---- | ----------- | ----- |
|
375
|
+
| **user_i_dand_secret** | [**UserIDandSecret**](UserIDandSecret.md) | | |
|
376
|
+
|
377
|
+
### Return type
|
378
|
+
|
379
|
+
[**UserIDandSecret**](UserIDandSecret.md)
|
380
|
+
|
@@ -476,6 +476,100 @@ module SnapTrade
|
|
476
476
|
end
|
477
477
|
return data, status_code, headers, response
|
478
478
|
end
|
479
|
+
|
480
|
+
|
481
|
+
# Obtain a new user secret for a user
|
482
|
+
# @param user_id [String] SnapTrade User ID. Provided by SnapTrade Partner. Can be any string, as long as it's unique to a user
|
483
|
+
# @param user_secret [String] SnapTrade User Secret randomly generated by SnapTrade. This should be considered priviledged information and if compromised, you should delete and re-create this SnapTrade user.
|
484
|
+
# @param body [UserIDandSecret]
|
485
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
486
|
+
def reset_snap_trade_user_secret(user_id: SENTINEL, user_secret: SENTINEL, extra: {})
|
487
|
+
_body = {}
|
488
|
+
_body[:userId] = user_id if user_id != SENTINEL
|
489
|
+
_body[:userSecret] = user_secret if user_secret != SENTINEL
|
490
|
+
user_i_dand_secret = _body
|
491
|
+
data, _status_code, _headers = reset_snap_trade_user_secret_with_http_info_impl(user_i_dand_secret, extra)
|
492
|
+
data
|
493
|
+
end
|
494
|
+
|
495
|
+
# Obtain a new user secret for a user
|
496
|
+
# @param user_id [String] SnapTrade User ID. Provided by SnapTrade Partner. Can be any string, as long as it's unique to a user
|
497
|
+
# @param user_secret [String] SnapTrade User Secret randomly generated by SnapTrade. This should be considered priviledged information and if compromised, you should delete and re-create this SnapTrade user.
|
498
|
+
# @param body [UserIDandSecret]
|
499
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
500
|
+
def reset_snap_trade_user_secret_with_http_info(user_id: SENTINEL, user_secret: SENTINEL, extra: {})
|
501
|
+
_body = {}
|
502
|
+
_body[:userId] = user_id if user_id != SENTINEL
|
503
|
+
_body[:userSecret] = user_secret if user_secret != SENTINEL
|
504
|
+
user_i_dand_secret = _body
|
505
|
+
reset_snap_trade_user_secret_with_http_info_impl(user_i_dand_secret, extra)
|
506
|
+
end
|
507
|
+
|
508
|
+
# Obtain a new user secret for a user
|
509
|
+
# @param user_i_dand_secret [UserIDandSecret]
|
510
|
+
# @param [Hash] opts the optional parameters
|
511
|
+
# @return [UserIDandSecret]
|
512
|
+
def reset_snap_trade_user_secret_impl(user_i_dand_secret, opts = {})
|
513
|
+
data, _status_code, _headers = reset_snap_trade_user_secret_with_http_info(user_i_dand_secret, opts)
|
514
|
+
data
|
515
|
+
end
|
516
|
+
|
517
|
+
# Obtain a new user secret for a user
|
518
|
+
# @param user_i_dand_secret [UserIDandSecret]
|
519
|
+
# @param [Hash] opts the optional parameters
|
520
|
+
# @return [Array<(UserIDandSecret, Integer, Hash)>] UserIDandSecret data, response status code and response headers
|
521
|
+
def reset_snap_trade_user_secret_with_http_info_impl(user_i_dand_secret, opts = {})
|
522
|
+
if @api_client.config.debugging
|
523
|
+
@api_client.config.logger.debug 'Calling API: AuthenticationApi.reset_snap_trade_user_secret ...'
|
524
|
+
end
|
525
|
+
# verify the required parameter 'user_i_dand_secret' is set
|
526
|
+
if @api_client.config.client_side_validation && user_i_dand_secret.nil?
|
527
|
+
fail ArgumentError, "Missing the required parameter 'user_i_dand_secret' when calling AuthenticationApi.reset_snap_trade_user_secret"
|
528
|
+
end
|
529
|
+
# resource path
|
530
|
+
local_var_path = '/snapTrade/resetUserSecret'
|
531
|
+
|
532
|
+
# query parameters
|
533
|
+
query_params = opts[:query_params] || {}
|
534
|
+
|
535
|
+
# header parameters
|
536
|
+
header_params = opts[:header_params] || {}
|
537
|
+
# HTTP header 'Accept' (if needed)
|
538
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
539
|
+
# HTTP header 'Content-Type'
|
540
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
541
|
+
if !content_type.nil?
|
542
|
+
header_params['Content-Type'] = content_type
|
543
|
+
end
|
544
|
+
|
545
|
+
# form parameters
|
546
|
+
form_params = opts[:form_params] || {}
|
547
|
+
|
548
|
+
# http body (model)
|
549
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(user_i_dand_secret)
|
550
|
+
|
551
|
+
# return_type
|
552
|
+
return_type = opts[:debug_return_type] || 'UserIDandSecret'
|
553
|
+
|
554
|
+
# auth_names
|
555
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
556
|
+
|
557
|
+
new_options = opts.merge(
|
558
|
+
:operation => :"AuthenticationApi.reset_snap_trade_user_secret",
|
559
|
+
:header_params => header_params,
|
560
|
+
:query_params => query_params,
|
561
|
+
:form_params => form_params,
|
562
|
+
:body => post_body,
|
563
|
+
:auth_names => auth_names,
|
564
|
+
:return_type => return_type
|
565
|
+
)
|
566
|
+
|
567
|
+
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
568
|
+
if @api_client.config.debugging
|
569
|
+
@api_client.config.logger.debug "API called: AuthenticationApi#reset_snap_trade_user_secret\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
570
|
+
end
|
571
|
+
return data, status_code, headers, response
|
572
|
+
end
|
479
573
|
end
|
480
574
|
|
481
575
|
# top-level client access to avoid having the user to insantiate their own API instances
|
data/lib/snaptrade/version.rb
CHANGED
@@ -88,4 +88,15 @@ describe 'AuthenticationApi' do
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
+
# unit tests for reset_snap_trade_user_secret
|
92
|
+
# Obtain a new user secret for a user
|
93
|
+
# @param user_i_dand_secret
|
94
|
+
# @param [Hash] opts the optional parameters
|
95
|
+
# @return [UserIDandSecret]
|
96
|
+
describe 'reset_snap_trade_user_secret test' do
|
97
|
+
it 'should work' do
|
98
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
91
102
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snaptrade
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SnapTrade
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -528,7 +528,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
528
528
|
- !ruby/object:Gem::Version
|
529
529
|
version: '0'
|
530
530
|
requirements: []
|
531
|
-
rubygems_version: 3.
|
531
|
+
rubygems_version: 3.3.7
|
532
532
|
signing_key:
|
533
533
|
specification_version: 4
|
534
534
|
summary: SnapTrade Ruby Gem
|