snaptrade 2.0.27 → 2.0.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +6 -41
- data/lib/snaptrade/api/authentication_api.rb +8 -105
- data/lib/snaptrade/models/user_i_dand_secret.rb +1 -1
- data/lib/snaptrade/version.rb +1 -1
- data/spec/api/authentication_api_spec.rb +1 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eda55725a9b97295f947e385aaa5003b02a7d20e8e4603cefa5a17dbdf27215d
|
4
|
+
data.tar.gz: f03cb7a20b125bb83a122fa42ab9948891583bb8f4888d365ec225e51f1220a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dec55a480470054f6c039189d796edf016ff838ab276afa435c2b8f6fd7df6c94687ca474af52311a16c2a039a819043e938fbb228be751d67ccae77ec145590
|
7
|
+
data.tar.gz: 7213d617ae5118e8f7b313bbafa49446e17134c7b5fefc961626cdab60f28e61844bc8345fb40b8b77a2794aabf88b8102df9c2cb3afa1d4ffbc7d854fb35800
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
Connect brokerage accounts to your app for live positions and trading
|
8
8
|
|
9
|
-
[![npm](https://img.shields.io/badge/gem-v2.0.
|
9
|
+
[![npm](https://img.shields.io/badge/gem-v2.0.29-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.29)
|
10
10
|
[![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
|
11
11
|
|
12
12
|
</div>
|
@@ -29,7 +29,6 @@ Connect brokerage accounts to your app for live positions and trading
|
|
29
29
|
* [`snaptrade.account_information.update_user_account`](#snaptradeaccount_informationupdate_user_account)
|
30
30
|
* [`snaptrade.api_status.check`](#snaptradeapi_statuscheck)
|
31
31
|
* [`snaptrade.authentication.delete_snap_trade_user`](#snaptradeauthenticationdelete_snap_trade_user)
|
32
|
-
* [`snaptrade.authentication.get_user_jwt`](#snaptradeauthenticationget_user_jwt)
|
33
32
|
* [`snaptrade.authentication.list_snap_trade_users`](#snaptradeauthenticationlist_snap_trade_users)
|
34
33
|
* [`snaptrade.authentication.login_snap_trade_user`](#snaptradeauthenticationlogin_snap_trade_user)
|
35
34
|
* [`snaptrade.authentication.register_snap_trade_user`](#snaptradeauthenticationregister_snap_trade_user)
|
@@ -71,7 +70,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
71
70
|
Add to Gemfile:
|
72
71
|
|
73
72
|
```ruby
|
74
|
-
gem 'snaptrade', '~> 2.0.
|
73
|
+
gem 'snaptrade', '~> 2.0.29'
|
75
74
|
```
|
76
75
|
|
77
76
|
## Getting Started<a id="getting-started"></a>
|
@@ -457,39 +456,6 @@ p result
|
|
457
456
|
---
|
458
457
|
|
459
458
|
|
460
|
-
### `snaptrade.authentication.get_user_jwt`<a id="snaptradeauthenticationget_user_jwt"></a>
|
461
|
-
|
462
|
-
This API is available to ClientIDs which have opted to use encrypted
|
463
|
-
JWTs (JSON Web Tokens) instead of standard SnapTrade signature verification.
|
464
|
-
|
465
|
-
|
466
|
-
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
467
|
-
|
468
|
-
```ruby
|
469
|
-
result = snaptrade.authentication.get_user_jwt(
|
470
|
-
user_id: "snaptrade-user-123",
|
471
|
-
user_secret: "USERSECRET123",
|
472
|
-
)
|
473
|
-
p result
|
474
|
-
```
|
475
|
-
|
476
|
-
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
477
|
-
|
478
|
-
##### user_id: `String`<a id="user_id-string"></a>
|
479
|
-
##### user_secret: `String`<a id="user_secret-string"></a>
|
480
|
-
#### 🔄 Return<a id="🔄-return"></a>
|
481
|
-
|
482
|
-
[EncryptedResponse](./lib/snaptrade/models/encrypted_response.rb)
|
483
|
-
|
484
|
-
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
485
|
-
|
486
|
-
`/snapTrade/encryptedJWT` `GET`
|
487
|
-
|
488
|
-
[🔙 **Back to Table of Contents**](#table-of-contents)
|
489
|
-
|
490
|
-
---
|
491
|
-
|
492
|
-
|
493
459
|
### `snaptrade.authentication.list_snap_trade_users`<a id="snaptradeauthenticationlist_snap_trade_users"></a>
|
494
460
|
|
495
461
|
Returns a list of users you've registered over the SnapTrade API.
|
@@ -606,8 +572,8 @@ immutable.
|
|
606
572
|
|
607
573
|
### `snaptrade.authentication.reset_snap_trade_user_secret`<a id="snaptradeauthenticationreset_snap_trade_user_secret"></a>
|
608
574
|
|
609
|
-
This API is used to
|
610
|
-
is
|
575
|
+
This API is used to rotate the secret for a SnapTrade user. You might use this if a userSecret
|
576
|
+
is compromised. Please note that if you call this endpoint and fail to save the new secret, you'll no longer be able to access any data for this user, and your only option will be to delete and recreate the user, then ask them to reconnect.
|
611
577
|
|
612
578
|
|
613
579
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
@@ -629,9 +595,8 @@ NOT use email addresses for this property because they are usually not
|
|
629
595
|
immutable.
|
630
596
|
|
631
597
|
##### userSecret: `String`<a id="usersecret-string"></a>
|
632
|
-
SnapTrade User Secret randomly generated by SnapTrade. This
|
633
|
-
|
634
|
-
SnapTrade user.
|
598
|
+
SnapTrade User Secret randomly generated by SnapTrade. This is privileged
|
599
|
+
information and if compromised, should be rotated via the SnapTrade API.
|
635
600
|
|
636
601
|
#### 🔄 Return<a id="🔄-return"></a>
|
637
602
|
|
@@ -103,103 +103,6 @@ module SnapTrade
|
|
103
103
|
end
|
104
104
|
|
105
105
|
|
106
|
-
# Generate encrypted JWT token
|
107
|
-
#
|
108
|
-
# This API is available to ClientIDs which have opted to use encrypted
|
109
|
-
# JWTs (JSON Web Tokens) instead of standard SnapTrade signature verification.
|
110
|
-
#
|
111
|
-
# @param user_id [String]
|
112
|
-
# @param user_secret [String]
|
113
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
114
|
-
def get_user_jwt(user_id:, user_secret:, extra: {})
|
115
|
-
data, _status_code, _headers = get_user_jwt_with_http_info_impl(user_id, user_secret, extra)
|
116
|
-
data
|
117
|
-
end
|
118
|
-
|
119
|
-
# Generate encrypted JWT token
|
120
|
-
#
|
121
|
-
# This API is available to ClientIDs which have opted to use encrypted
|
122
|
-
# JWTs (JSON Web Tokens) instead of standard SnapTrade signature verification.
|
123
|
-
#
|
124
|
-
# @param user_id [String]
|
125
|
-
# @param user_secret [String]
|
126
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
127
|
-
def get_user_jwt_with_http_info(user_id:, user_secret:, extra: {})
|
128
|
-
get_user_jwt_with_http_info_impl(user_id, user_secret, extra)
|
129
|
-
end
|
130
|
-
|
131
|
-
# Generate encrypted JWT token
|
132
|
-
# This API is available to ClientIDs which have opted to use encrypted JWTs (JSON Web Tokens) instead of standard SnapTrade signature verification.
|
133
|
-
# @param user_id [String]
|
134
|
-
# @param user_secret [String]
|
135
|
-
# @param [Hash] opts the optional parameters
|
136
|
-
# @return [EncryptedResponse]
|
137
|
-
private def get_user_jwt_impl(user_id, user_secret, opts = {})
|
138
|
-
data, _status_code, _headers = get_user_jwt_with_http_info(user_id, user_secret, opts)
|
139
|
-
data
|
140
|
-
end
|
141
|
-
|
142
|
-
# Generate encrypted JWT token
|
143
|
-
# This API is available to ClientIDs which have opted to use encrypted JWTs (JSON Web Tokens) instead of standard SnapTrade signature verification.
|
144
|
-
# @param user_id [String]
|
145
|
-
# @param user_secret [String]
|
146
|
-
# @param [Hash] opts the optional parameters
|
147
|
-
# @return [Array<(EncryptedResponse, Integer, Hash)>] EncryptedResponse data, response status code and response headers
|
148
|
-
private def get_user_jwt_with_http_info_impl(user_id, user_secret, opts = {})
|
149
|
-
if @api_client.config.debugging
|
150
|
-
@api_client.config.logger.debug 'Calling API: AuthenticationApi.get_user_jwt ...'
|
151
|
-
end
|
152
|
-
# verify the required parameter 'user_id' is set
|
153
|
-
if @api_client.config.client_side_validation && user_id.nil?
|
154
|
-
fail ArgumentError, "Missing the required parameter 'user_id' when calling AuthenticationApi.get_user_jwt"
|
155
|
-
end
|
156
|
-
# verify the required parameter 'user_secret' is set
|
157
|
-
if @api_client.config.client_side_validation && user_secret.nil?
|
158
|
-
fail ArgumentError, "Missing the required parameter 'user_secret' when calling AuthenticationApi.get_user_jwt"
|
159
|
-
end
|
160
|
-
# resource path
|
161
|
-
local_var_path = '/snapTrade/encryptedJWT'
|
162
|
-
|
163
|
-
# query parameters
|
164
|
-
query_params = opts[:query_params] || {}
|
165
|
-
query_params[:'userId'] = user_id
|
166
|
-
query_params[:'userSecret'] = user_secret
|
167
|
-
|
168
|
-
# header parameters
|
169
|
-
header_params = opts[:header_params] || {}
|
170
|
-
# HTTP header 'Accept' (if needed)
|
171
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
172
|
-
|
173
|
-
# form parameters
|
174
|
-
form_params = opts[:form_params] || {}
|
175
|
-
|
176
|
-
# http body (model)
|
177
|
-
post_body = opts[:debug_body]
|
178
|
-
|
179
|
-
# return_type
|
180
|
-
return_type = opts[:debug_return_type] || 'EncryptedResponse'
|
181
|
-
|
182
|
-
# auth_names
|
183
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
184
|
-
|
185
|
-
new_options = opts.merge(
|
186
|
-
:operation => :"AuthenticationApi.get_user_jwt",
|
187
|
-
:header_params => header_params,
|
188
|
-
:query_params => query_params,
|
189
|
-
:form_params => form_params,
|
190
|
-
:body => post_body,
|
191
|
-
:auth_names => auth_names,
|
192
|
-
:return_type => return_type
|
193
|
-
)
|
194
|
-
|
195
|
-
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
196
|
-
if @api_client.config.debugging
|
197
|
-
@api_client.config.logger.debug "API called: AuthenticationApi#get_user_jwt\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
198
|
-
end
|
199
|
-
return data, status_code, headers, response
|
200
|
-
end
|
201
|
-
|
202
|
-
|
203
106
|
# List SnapTrade users
|
204
107
|
#
|
205
108
|
# Returns a list of users you've registered over the SnapTrade API.
|
@@ -511,11 +414,11 @@ module SnapTrade
|
|
511
414
|
|
512
415
|
# Obtain a new user secret for a user
|
513
416
|
#
|
514
|
-
# This API is used to
|
515
|
-
# is
|
417
|
+
# This API is used to rotate the secret for a SnapTrade user. You might use this if a userSecret
|
418
|
+
# is compromised. Please note that if you call this endpoint and fail to save the new secret, you'll no longer be able to access any data for this user, and your only option will be to delete and recreate the user, then ask them to reconnect.
|
516
419
|
#
|
517
420
|
# @param user_id [String] SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
|
518
|
-
# @param user_secret [String] SnapTrade User Secret randomly generated by SnapTrade. This
|
421
|
+
# @param user_secret [String] SnapTrade User Secret randomly generated by SnapTrade. This is privileged information and if compromised, should be rotated via the SnapTrade API.
|
519
422
|
# @param body [UserIDandSecret]
|
520
423
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
521
424
|
def reset_snap_trade_user_secret(user_id: SENTINEL, user_secret: SENTINEL, extra: {})
|
@@ -529,11 +432,11 @@ module SnapTrade
|
|
529
432
|
|
530
433
|
# Obtain a new user secret for a user
|
531
434
|
#
|
532
|
-
# This API is used to
|
533
|
-
# is
|
435
|
+
# This API is used to rotate the secret for a SnapTrade user. You might use this if a userSecret
|
436
|
+
# is compromised. Please note that if you call this endpoint and fail to save the new secret, you'll no longer be able to access any data for this user, and your only option will be to delete and recreate the user, then ask them to reconnect.
|
534
437
|
#
|
535
438
|
# @param user_id [String] SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
|
536
|
-
# @param user_secret [String] SnapTrade User Secret randomly generated by SnapTrade. This
|
439
|
+
# @param user_secret [String] SnapTrade User Secret randomly generated by SnapTrade. This is privileged information and if compromised, should be rotated via the SnapTrade API.
|
537
440
|
# @param body [UserIDandSecret]
|
538
441
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
539
442
|
def reset_snap_trade_user_secret_with_http_info(user_id: SENTINEL, user_secret: SENTINEL, extra: {})
|
@@ -545,7 +448,7 @@ module SnapTrade
|
|
545
448
|
end
|
546
449
|
|
547
450
|
# Obtain a new user secret for a user
|
548
|
-
# This API is used to
|
451
|
+
# This API is used to rotate the secret for a SnapTrade user. You might use this if a userSecret is compromised. Please note that if you call this endpoint and fail to save the new secret, you'll no longer be able to access any data for this user, and your only option will be to delete and recreate the user, then ask them to reconnect.
|
549
452
|
# @param user_i_dand_secret [UserIDandSecret]
|
550
453
|
# @param [Hash] opts the optional parameters
|
551
454
|
# @return [UserIDandSecret]
|
@@ -555,7 +458,7 @@ module SnapTrade
|
|
555
458
|
end
|
556
459
|
|
557
460
|
# Obtain a new user secret for a user
|
558
|
-
# This API is used to
|
461
|
+
# This API is used to rotate the secret for a SnapTrade user. You might use this if a userSecret is compromised. Please note that if you call this endpoint and fail to save the new secret, you'll no longer be able to access any data for this user, and your only option will be to delete and recreate the user, then ask them to reconnect.
|
559
462
|
# @param user_i_dand_secret [UserIDandSecret]
|
560
463
|
# @param [Hash] opts the optional parameters
|
561
464
|
# @return [Array<(UserIDandSecret, Integer, Hash)>] UserIDandSecret data, response status code and response headers
|
@@ -16,7 +16,7 @@ module SnapTrade
|
|
16
16
|
# SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
|
17
17
|
attr_accessor :user_id
|
18
18
|
|
19
|
-
# SnapTrade User Secret randomly generated by SnapTrade. This
|
19
|
+
# SnapTrade User Secret randomly generated by SnapTrade. This is privileged information and if compromised, should be rotated via the SnapTrade API.
|
20
20
|
attr_accessor :user_secret
|
21
21
|
|
22
22
|
# Attribute mapping from ruby-style variable name to JSON key.
|
data/lib/snaptrade/version.rb
CHANGED
@@ -39,19 +39,6 @@ describe 'AuthenticationApi' do
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
# unit tests for get_user_jwt
|
43
|
-
# Generate encrypted JWT token
|
44
|
-
# This API is available to ClientIDs which have opted to use encrypted JWTs (JSON Web Tokens) instead of standard SnapTrade signature verification.
|
45
|
-
# @param user_id
|
46
|
-
# @param user_secret
|
47
|
-
# @param [Hash] opts the optional parameters
|
48
|
-
# @return [EncryptedResponse]
|
49
|
-
describe 'get_user_jwt test' do
|
50
|
-
it 'should work' do
|
51
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
42
|
# unit tests for list_snap_trade_users
|
56
43
|
# List SnapTrade users
|
57
44
|
# Returns a list of users you've registered over the SnapTrade API.
|
@@ -91,7 +78,7 @@ describe 'AuthenticationApi' do
|
|
91
78
|
|
92
79
|
# unit tests for reset_snap_trade_user_secret
|
93
80
|
# Obtain a new user secret for a user
|
94
|
-
# This API is used to
|
81
|
+
# This API is used to rotate the secret for a SnapTrade user. You might use this if a userSecret is compromised. Please note that if you call this endpoint and fail to save the new secret, you'll no longer be able to access any data for this user, and your only option will be to delete and recreate the user, then ask them to reconnect.
|
95
82
|
# @param user_i_dand_secret
|
96
83
|
# @param [Hash] opts the optional parameters
|
97
84
|
# @return [UserIDandSecret]
|
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.29
|
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-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|