snaptrade 2.0.1 → 2.0.2
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/Gemfile.lock +1 -1
- 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 +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec9e0dbe7d3e7c69d00269f23444db2c9208b10a53688128a5f1e68ce19b1783
|
4
|
+
data.tar.gz: 7780d0e966a7189727812916c9b79c945d608cd0671a1554a6e9ef0e42c4ec20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9cad2244d5f0107d326608e94fe7908a101be05a0e63ec3af539e941dc9c5ab76be1beb09ccd3409c836acc30be2056ef1d6095fc4be40fe43f579c21bf905b
|
7
|
+
data.tar.gz: 3cfafe1b77b9553ef62ca93f326d0b221b00b594ccc372c4abe8474f24b012612e52c4ebde558c2fb2a667460683c6547ca740695f6289e3a0aba294683cd30d
|
data/Gemfile.lock
CHANGED
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.2'
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SnapTrade
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01
|
11
|
+
date: 2024-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|