Class: SnapTrade::ConnectionsApi
- Inherits:
-
Object
- Object
- SnapTrade::ConnectionsApi
- Defined in:
- lib/snaptrade/api/connections_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#delete_connection(connection_id:, user_id:, user_secret:, extra: {}) ⇒ Object
Delete connection.
-
#delete_connection_with_http_info(connection_id:, user_id:, user_secret:, extra: {}) ⇒ Object
Delete connection.
-
#detail_brokerage_authorization(authorization_id:, user_id:, user_secret:, extra: {}) ⇒ Object
Get connection detail.
-
#detail_brokerage_authorization_with_http_info(authorization_id:, user_id:, user_secret:, extra: {}) ⇒ Object
Get connection detail.
-
#disable_brokerage_authorization(authorization_id:, user_id:, user_secret:, extra: {}) ⇒ Object
Force disable connection.
-
#disable_brokerage_authorization_with_http_info(authorization_id:, user_id:, user_secret:, extra: {}) ⇒ Object
Force disable connection.
-
#initialize(api_client = ApiClient.default) ⇒ ConnectionsApi
constructor
A new instance of ConnectionsApi.
-
#list_brokerage_authorization_accounts(authorization_id:, user_id:, user_secret:, extra: {}) ⇒ Object
List accounts for a connection.
-
#list_brokerage_authorization_accounts_with_http_info(authorization_id:, user_id:, user_secret:, extra: {}) ⇒ Object
List accounts for a connection.
-
#list_brokerage_authorizations(user_id:, user_secret:, extra: {}) ⇒ Object
List all connections.
-
#list_brokerage_authorizations_with_http_info(user_id:, user_secret:, extra: {}) ⇒ Object
List all connections.
-
#refresh_brokerage_authorization(authorization_id:, user_id:, user_secret:, extra: {}) ⇒ Object
Refresh holdings for a connection.
-
#refresh_brokerage_authorization_with_http_info(authorization_id:, user_id:, user_secret:, extra: {}) ⇒ Object
Refresh holdings for a connection.
-
#remove_brokerage_authorization(authorization_id:, user_id:, user_secret:, extra: {}) ⇒ Object
Delete connection.
-
#remove_brokerage_authorization_with_http_info(authorization_id:, user_id:, user_secret:, extra: {}) ⇒ Object
Delete connection.
-
#return_rates(user_id:, user_secret:, authorization_id:, timeframes: SENTINEL, extra: {}) ⇒ Object
List connection rate of returns.
-
#return_rates_with_http_info(user_id:, user_secret:, authorization_id:, timeframes: SENTINEL, extra: {}) ⇒ Object
List connection rate of returns.
-
#session_events(partner_client_id:, user_id: SENTINEL, session_id: SENTINEL, extra: {}) ⇒ Object
Get all session events for a user.
-
#session_events_with_http_info(partner_client_id:, user_id: SENTINEL, session_id: SENTINEL, extra: {}) ⇒ Object
Get all session events for a user.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ ConnectionsApi
Returns a new instance of ConnectionsApi.
16 17 18 |
# File 'lib/snaptrade/api/connections_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/connections_api.rb', line 14 def api_client @api_client end |
Instance Method Details
#delete_connection(connection_id:, user_id:, user_secret:, extra: {}) ⇒ Object
Delete connection
Deletes the SnapTrade connection specified by the ID. This will also remove the accounts and holdings data associated with the connection from SnapTrade. This action is irreversible. This endpoint is asynchronous, a 200 response indicates that a task has been queued to delete the connection. Listen for the [‘CONNECTION_DELETED` webhook](docs.snaptrade.com/docs/webhooks#webhooks-connection_deleted) webhook to know when the deletion has been completed and the data has been removed.
28 29 30 31 |
# File 'lib/snaptrade/api/connections_api.rb', line 28 def delete_connection(connection_id:, user_id:, user_secret:, extra: {}) data, _status_code, _headers = delete_connection_with_http_info_impl(connection_id, user_id, user_secret, extra) data end |
#delete_connection_with_http_info(connection_id:, user_id:, user_secret:, extra: {}) ⇒ Object
Delete connection
Deletes the SnapTrade connection specified by the ID. This will also remove the accounts and holdings data associated with the connection from SnapTrade. This action is irreversible. This endpoint is asynchronous, a 200 response indicates that a task has been queued to delete the connection. Listen for the [‘CONNECTION_DELETED` webhook](docs.snaptrade.com/docs/webhooks#webhooks-connection_deleted) webhook to know when the deletion has been completed and the data has been removed.
41 42 43 |
# File 'lib/snaptrade/api/connections_api.rb', line 41 def delete_connection_with_http_info(connection_id:, user_id:, user_secret:, extra: {}) delete_connection_with_http_info_impl(connection_id, user_id, user_secret, extra) end |
#detail_brokerage_authorization(authorization_id:, user_id:, user_secret:, extra: {}) ⇒ Object
Get connection detail
Returns a single connection for the specified ID.
131 132 133 134 |
# File 'lib/snaptrade/api/connections_api.rb', line 131 def (authorization_id:, user_id:, user_secret:, extra: {}) data, _status_code, _headers = (, user_id, user_secret, extra) data end |
#detail_brokerage_authorization_with_http_info(authorization_id:, user_id:, user_secret:, extra: {}) ⇒ Object
Get connection detail
Returns a single connection for the specified ID.
144 145 146 |
# File 'lib/snaptrade/api/connections_api.rb', line 144 def (authorization_id:, user_id:, user_secret:, extra: {}) (, user_id, user_secret, extra) end |
#disable_brokerage_authorization(authorization_id:, user_id:, user_secret:, extra: {}) ⇒ Object
Force disable connection
Manually force the specified connection to become disabled. This should only be used for testing a reconnect flow, and never used on production connections. Will trigger a disconnect as if it happened naturally, and send a [‘CONNECTION_BROKEN` webhook](/docs/webhooks#webhooks-connection_broken) for the connection.
This endpoint is available on test keys. If you would like it enabled on production keys as well, please contact support as it is disabled by default.
237 238 239 240 |
# File 'lib/snaptrade/api/connections_api.rb', line 237 def (authorization_id:, user_id:, user_secret:, extra: {}) data, _status_code, _headers = (, user_id, user_secret, extra) data end |
#disable_brokerage_authorization_with_http_info(authorization_id:, user_id:, user_secret:, extra: {}) ⇒ Object
Force disable connection
Manually force the specified connection to become disabled. This should only be used for testing a reconnect flow, and never used on production connections. Will trigger a disconnect as if it happened naturally, and send a [‘CONNECTION_BROKEN` webhook](/docs/webhooks#webhooks-connection_broken) for the connection.
This endpoint is available on test keys. If you would like it enabled on production keys as well, please contact support as it is disabled by default.
253 254 255 |
# File 'lib/snaptrade/api/connections_api.rb', line 253 def (authorization_id:, user_id:, user_secret:, extra: {}) (, user_id, user_secret, extra) end |
#list_brokerage_authorization_accounts(authorization_id:, user_id:, user_secret:, extra: {}) ⇒ Object
List accounts for a connection
Returns all brokerage accounts that belong to the specified connection for the authenticated user.
On real-time plans, this endpoint refreshes each account’s opening date, funding date, and total value live from the brokerage on each call.
On delayed plans, this endpoint returns cached data that is refreshed once a day. To force a refresh, use the [manual refresh endpoint](/reference/Connections/Connections_refreshBrokerageAuthorization).
Check your API key on the [Customer Dashboard billing page](dashboard.snaptrade.com/settings/billing) to see whether your plan includes real-time data.
349 350 351 352 |
# File 'lib/snaptrade/api/connections_api.rb', line 349 def (authorization_id:, user_id:, user_secret:, extra: {}) data, _status_code, _headers = (, user_id, user_secret, extra) data end |
#list_brokerage_authorization_accounts_with_http_info(authorization_id:, user_id:, user_secret:, extra: {}) ⇒ Object
List accounts for a connection
Returns all brokerage accounts that belong to the specified connection for the authenticated user.
On real-time plans, this endpoint refreshes each account’s opening date, funding date, and total value live from the brokerage on each call.
On delayed plans, this endpoint returns cached data that is refreshed once a day. To force a refresh, use the [manual refresh endpoint](/reference/Connections/Connections_refreshBrokerageAuthorization).
Check your API key on the [Customer Dashboard billing page](dashboard.snaptrade.com/settings/billing) to see whether your plan includes real-time data.
368 369 370 |
# File 'lib/snaptrade/api/connections_api.rb', line 368 def (authorization_id:, user_id:, user_secret:, extra: {}) (, user_id, user_secret, extra) end |
#list_brokerage_authorizations(user_id:, user_secret:, extra: {}) ⇒ Object
List all connections
Returns a list of all connections for the specified user. Note that ‘Connection` and `Brokerage Authorization` are interchangeable, but the term `Connection` is preferred and used in the doc for consistency.
A connection is usually tied to a single login at a brokerage. A single connection can contain multiple brokerage accounts.
SnapTrade performs de-duping on connections for a given user. If the user has an existing connection with the brokerage, when connecting the brokerage with the same credentials, SnapTrade will return the existing connection instead of creating a new one.
461 462 463 464 |
# File 'lib/snaptrade/api/connections_api.rb', line 461 def (user_id:, user_secret:, extra: {}) data, _status_code, _headers = (user_id, user_secret, extra) data end |
#list_brokerage_authorizations_with_http_info(user_id:, user_secret:, extra: {}) ⇒ Object
List all connections
Returns a list of all connections for the specified user. Note that ‘Connection` and `Brokerage Authorization` are interchangeable, but the term `Connection` is preferred and used in the doc for consistency.
A connection is usually tied to a single login at a brokerage. A single connection can contain multiple brokerage accounts.
SnapTrade performs de-duping on connections for a given user. If the user has an existing connection with the brokerage, when connecting the brokerage with the same credentials, SnapTrade will return the existing connection instead of creating a new one.
477 478 479 |
# File 'lib/snaptrade/api/connections_api.rb', line 477 def (user_id:, user_secret:, extra: {}) (user_id, user_secret, extra) end |
#refresh_brokerage_authorization(authorization_id:, user_id:, user_secret:, extra: {}) ⇒ Object
Refresh holdings for a connection
Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [‘ACCOUNT_HOLDINGS_UPDATED` webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection. This endpoint will also trigger a transaction sync for the past day if one has not yet occurred.
**Because of the cost of refreshing a connection, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](dashboard.snaptrade.com/settings/billing)** **Please note this endpoint is disabled for real-time plans (ex: PayGo). Real-time plans do not benefit from this feature since data is refreshed when calls are made**
565 566 567 568 |
# File 'lib/snaptrade/api/connections_api.rb', line 565 def (authorization_id:, user_id:, user_secret:, extra: {}) data, _status_code, _headers = (, user_id, user_secret, extra) data end |
#refresh_brokerage_authorization_with_http_info(authorization_id:, user_id:, user_secret:, extra: {}) ⇒ Object
Refresh holdings for a connection
Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [‘ACCOUNT_HOLDINGS_UPDATED` webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection. This endpoint will also trigger a transaction sync for the past day if one has not yet occurred.
**Because of the cost of refreshing a connection, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](dashboard.snaptrade.com/settings/billing)** **Please note this endpoint is disabled for real-time plans (ex: PayGo). Real-time plans do not benefit from this feature since data is refreshed when calls are made**
582 583 584 |
# File 'lib/snaptrade/api/connections_api.rb', line 582 def (authorization_id:, user_id:, user_secret:, extra: {}) (, user_id, user_secret, extra) end |
#remove_brokerage_authorization(authorization_id:, user_id:, user_secret:, extra: {}) ⇒ Object
Delete connection
Deletes the SnapTrade connection specified by the ID. This will also remove the accounts and holdings data associated with the connection from SnapTrade. This action is irreversible. This endpoint is synchronous, a 204 response indicates that the data has been successfully deleted.
672 673 674 675 |
# File 'lib/snaptrade/api/connections_api.rb', line 672 def (authorization_id:, user_id:, user_secret:, extra: {}) (, user_id, user_secret, extra) nil end |
#remove_brokerage_authorization_with_http_info(authorization_id:, user_id:, user_secret:, extra: {}) ⇒ Object
Delete connection
Deletes the SnapTrade connection specified by the ID. This will also remove the accounts and holdings data associated with the connection from SnapTrade. This action is irreversible. This endpoint is synchronous, a 204 response indicates that the data has been successfully deleted.
685 686 687 |
# File 'lib/snaptrade/api/connections_api.rb', line 685 def (authorization_id:, user_id:, user_secret:, extra: {}) (, user_id, user_secret, extra) end |
#return_rates(user_id:, user_secret:, authorization_id:, timeframes: SENTINEL, extra: {}) ⇒ Object
List connection rate of returns
Returns a list of rate of return percents for a given connection.
774 775 776 777 778 |
# File 'lib/snaptrade/api/connections_api.rb', line 774 def return_rates(user_id:, user_secret:, authorization_id:, timeframes: SENTINEL, extra: {}) extra[:timeframes] = timeframes if timeframes != SENTINEL data, _status_code, _headers = return_rates_with_http_info_impl(user_id, user_secret, , extra) data end |
#return_rates_with_http_info(user_id:, user_secret:, authorization_id:, timeframes: SENTINEL, extra: {}) ⇒ Object
List connection rate of returns
Returns a list of rate of return percents for a given connection.
789 790 791 792 |
# File 'lib/snaptrade/api/connections_api.rb', line 789 def return_rates_with_http_info(user_id:, user_secret:, authorization_id:, timeframes: SENTINEL, extra: {}) extra[:timeframes] = timeframes if timeframes != SENTINEL return_rates_with_http_info_impl(user_id, user_secret, , extra) end |
#session_events(partner_client_id:, user_id: SENTINEL, session_id: SENTINEL, extra: {}) ⇒ Object
Get all session events for a user
Returns a list of session events associated with a user.
883 884 885 886 887 888 |
# File 'lib/snaptrade/api/connections_api.rb', line 883 def session_events(partner_client_id:, user_id: SENTINEL, session_id: SENTINEL, extra: {}) extra[:user_id] = user_id if user_id != SENTINEL extra[:session_id] = session_id if session_id != SENTINEL data, _status_code, _headers = session_events_with_http_info_impl(partner_client_id, extra) data end |
#session_events_with_http_info(partner_client_id:, user_id: SENTINEL, session_id: SENTINEL, extra: {}) ⇒ Object
Get all session events for a user
Returns a list of session events associated with a user.
898 899 900 901 902 |
# File 'lib/snaptrade/api/connections_api.rb', line 898 def session_events_with_http_info(partner_client_id:, user_id: SENTINEL, session_id: SENTINEL, extra: {}) extra[:user_id] = user_id if user_id != SENTINEL extra[:session_id] = session_id if session_id != SENTINEL session_events_with_http_info_impl(partner_client_id, extra) end |