Class: SnapTrade::AuthenticationApi
- Inherits:
-
Object
- Object
- SnapTrade::AuthenticationApi
- Defined in:
- lib/snaptrade/api/authentication_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#delete_snap_trade_user(user_id:, extra: {}) ⇒ Object
Delete user.
-
#delete_snap_trade_user_with_http_info(user_id:, extra: {}) ⇒ Object
Delete user.
-
#initialize(api_client = ApiClient.default) ⇒ AuthenticationApi
constructor
A new instance of AuthenticationApi.
-
#list_snap_trade_users(extra: {}) ⇒ Object
List all users.
-
#list_snap_trade_users_with_http_info(extra: {}) ⇒ Object
List all users.
-
#login_snap_trade_user(user_id:, user_secret:, broker: SENTINEL, immediate_redirect: SENTINEL, custom_redirect: SENTINEL, reconnect: SENTINEL, connection_type: 'read', show_close_button: SENTINEL, dark_mode: SENTINEL, connection_portal_version: 'v4', extra: {}) ⇒ Object
Generate Connection Portal URL.
-
#login_snap_trade_user_with_http_info(user_id:, user_secret:, broker: SENTINEL, immediate_redirect: SENTINEL, custom_redirect: SENTINEL, reconnect: SENTINEL, connection_type: 'read', show_close_button: SENTINEL, dark_mode: SENTINEL, connection_portal_version: 'v4', extra: {}) ⇒ Object
Generate Connection Portal URL.
-
#register_snap_trade_user(user_id:, extra: {}) ⇒ Object
Register user.
-
#register_snap_trade_user_with_http_info(user_id:, extra: {}) ⇒ Object
Register user.
-
#reset_snap_trade_user_secret(user_id: SENTINEL, user_secret: SENTINEL, extra: {}) ⇒ Object
Rotate user secret.
-
#reset_snap_trade_user_secret_with_http_info(user_id: SENTINEL, user_secret: SENTINEL, extra: {}) ⇒ Object
Rotate user secret.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ AuthenticationApi
Returns a new instance of AuthenticationApi.
16 17 18 |
# File 'lib/snaptrade/api/authentication_api.rb', line 16 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
14 15 16 |
# File 'lib/snaptrade/api/authentication_api.rb', line 14 def api_client @api_client end |
Instance Method Details
#delete_snap_trade_user(user_id:, extra: {}) ⇒ Object
Delete user
Deletes a registered user and all associated data. This action is irreversible. This API is asynchronous and will return a 200 status code if the request is accepted. The user and all associated data will be queued for deletion. Once deleted, a ‘USER_DELETED` webhook will be sent.
26 27 28 29 |
# File 'lib/snaptrade/api/authentication_api.rb', line 26 def delete_snap_trade_user(user_id:, extra: {}) data, _status_code, _headers = delete_snap_trade_user_with_http_info_impl(user_id, extra) data end |
#delete_snap_trade_user_with_http_info(user_id:, extra: {}) ⇒ Object
Delete user
Deletes a registered user and all associated data. This action is irreversible. This API is asynchronous and will return a 200 status code if the request is accepted. The user and all associated data will be queued for deletion. Once deleted, a ‘USER_DELETED` webhook will be sent.
37 38 39 |
# File 'lib/snaptrade/api/authentication_api.rb', line 37 def delete_snap_trade_user_with_http_info(user_id:, extra: {}) delete_snap_trade_user_with_http_info_impl(user_id, extra) end |
#list_snap_trade_users(extra: {}) ⇒ Object
List all users
Returns a list of all registered user IDs. Please note that the response is not currently paginated.
111 112 113 114 |
# File 'lib/snaptrade/api/authentication_api.rb', line 111 def list_snap_trade_users(extra: {}) data, _status_code, _headers = list_snap_trade_users_with_http_info_impl(extra) data end |
#list_snap_trade_users_with_http_info(extra: {}) ⇒ Object
List all users
Returns a list of all registered user IDs. Please note that the response is not currently paginated.
121 122 123 |
# File 'lib/snaptrade/api/authentication_api.rb', line 121 def list_snap_trade_users_with_http_info(extra: {}) list_snap_trade_users_with_http_info_impl(extra) end |
#login_snap_trade_user(user_id:, user_secret:, broker: SENTINEL, immediate_redirect: SENTINEL, custom_redirect: SENTINEL, reconnect: SENTINEL, connection_type: 'read', show_close_button: SENTINEL, dark_mode: SENTINEL, connection_portal_version: 'v4', extra: {}) ⇒ Object
Generate Connection Portal URL
Authenticates a SnapTrade user and returns the Connection Portal URL used for connecting brokerage accounts. Please check [this guide](/docs/implement-connection-portal) for how to integrate the Connection Portal into your app.
Please note that the returned URL expires in 5 minutes.
201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/snaptrade/api/authentication_api.rb', line 201 def login_snap_trade_user(user_id:, user_secret:, broker: SENTINEL, immediate_redirect: SENTINEL, custom_redirect: SENTINEL, reconnect: SENTINEL, connection_type: 'read', show_close_button: SENTINEL, dark_mode: SENTINEL, connection_portal_version: 'v4', extra: {}) _body = {} _body[:broker] = broker if broker != SENTINEL _body[:immediateRedirect] = immediate_redirect if immediate_redirect != SENTINEL _body[:customRedirect] = custom_redirect if custom_redirect != SENTINEL _body[:reconnect] = reconnect if reconnect != SENTINEL _body[:connectionType] = connection_type if connection_type != SENTINEL _body[:showCloseButton] = if != SENTINEL _body[:darkMode] = dark_mode if dark_mode != SENTINEL _body[:connectionPortalVersion] = connection_portal_version if connection_portal_version != SENTINEL extra[:snap_trade_login_user_request_body] = _body if !_body.empty? data, _status_code, _headers = login_snap_trade_user_with_http_info_impl(user_id, user_secret, extra) data end |
#login_snap_trade_user_with_http_info(user_id:, user_secret:, broker: SENTINEL, immediate_redirect: SENTINEL, custom_redirect: SENTINEL, reconnect: SENTINEL, connection_type: 'read', show_close_button: SENTINEL, dark_mode: SENTINEL, connection_portal_version: 'v4', extra: {}) ⇒ Object
Generate Connection Portal URL
Authenticates a SnapTrade user and returns the Connection Portal URL used for connecting brokerage accounts. Please check [this guide](/docs/implement-connection-portal) for how to integrate the Connection Portal into your app.
Please note that the returned URL expires in 5 minutes.
234 235 236 237 238 239 240 241 242 243 244 245 246 |
# File 'lib/snaptrade/api/authentication_api.rb', line 234 def login_snap_trade_user_with_http_info(user_id:, user_secret:, broker: SENTINEL, immediate_redirect: SENTINEL, custom_redirect: SENTINEL, reconnect: SENTINEL, connection_type: 'read', show_close_button: SENTINEL, dark_mode: SENTINEL, connection_portal_version: 'v4', extra: {}) _body = {} _body[:broker] = broker if broker != SENTINEL _body[:immediateRedirect] = immediate_redirect if immediate_redirect != SENTINEL _body[:customRedirect] = custom_redirect if custom_redirect != SENTINEL _body[:reconnect] = reconnect if reconnect != SENTINEL _body[:connectionType] = connection_type if connection_type != SENTINEL _body[:showCloseButton] = if != SENTINEL _body[:darkMode] = dark_mode if dark_mode != SENTINEL _body[:connectionPortalVersion] = connection_portal_version if connection_portal_version != SENTINEL extra[:snap_trade_login_user_request_body] = _body if !_body.empty? login_snap_trade_user_with_http_info_impl(user_id, user_secret, extra) end |
#register_snap_trade_user(user_id:, extra: {}) ⇒ Object
Register user
Registers a new SnapTrade user under your Client ID. A user secret will be automatically generated for you and must be properly stored in your system. Most SnapTrade operations require a user ID and user secret to be passed in as parameters.
335 336 337 338 339 340 341 |
# File 'lib/snaptrade/api/authentication_api.rb', line 335 def register_snap_trade_user(user_id:, extra: {}) _body = {} _body[:userId] = user_id if user_id != SENTINEL snap_trade_register_user_request_body = _body data, _status_code, _headers = register_snap_trade_user_with_http_info_impl(snap_trade_register_user_request_body, extra) data end |
#register_snap_trade_user_with_http_info(user_id:, extra: {}) ⇒ Object
Register user
Registers a new SnapTrade user under your Client ID. A user secret will be automatically generated for you and must be properly stored in your system. Most SnapTrade operations require a user ID and user secret to be passed in as parameters.
351 352 353 354 355 356 |
# File 'lib/snaptrade/api/authentication_api.rb', line 351 def register_snap_trade_user_with_http_info(user_id:, extra: {}) _body = {} _body[:userId] = user_id if user_id != SENTINEL snap_trade_register_user_request_body = _body register_snap_trade_user_with_http_info_impl(snap_trade_register_user_request_body, extra) end |
#reset_snap_trade_user_secret(user_id: SENTINEL, user_secret: SENTINEL, extra: {}) ⇒ Object
Rotate user secret
Rotates the secret for a SnapTrade user. You might use this if ‘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.
435 436 437 438 439 440 441 442 |
# File 'lib/snaptrade/api/authentication_api.rb', line 435 def reset_snap_trade_user_secret(user_id: SENTINEL, user_secret: SENTINEL, extra: {}) _body = {} _body[:userId] = user_id if user_id != SENTINEL _body[:userSecret] = user_secret if user_secret != SENTINEL user_i_dand_secret = _body data, _status_code, _headers = reset_snap_trade_user_secret_with_http_info_impl(user_i_dand_secret, extra) data end |
#reset_snap_trade_user_secret_with_http_info(user_id: SENTINEL, user_secret: SENTINEL, extra: {}) ⇒ Object
Rotate user secret
Rotates the secret for a SnapTrade user. You might use this if ‘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.
452 453 454 455 456 457 458 |
# File 'lib/snaptrade/api/authentication_api.rb', line 452 def reset_snap_trade_user_secret_with_http_info(user_id: SENTINEL, user_secret: SENTINEL, extra: {}) _body = {} _body[:userId] = user_id if user_id != SENTINEL _body[:userSecret] = user_secret if user_secret != SENTINEL user_i_dand_secret = _body reset_snap_trade_user_secret_with_http_info_impl(user_i_dand_secret, extra) end |