Class: SnapTrade::ConnectionsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/snaptrade/api/connections_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_clientObject

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

#detail_brokerage_authorization(authorization_id:, user_id:, user_secret:, extra: {}) ⇒ Object

Get connection detail

Returns a single connection for the specified ID.

Parameters:

  • authorization_id (String)
  • user_id (String)
  • user_secret (String)
  • extra (Hash) (defaults to: {})

    additional parameters to pass along through :header_params, :query_params, or parameter name



28
29
30
31
# File 'lib/snaptrade/api/connections_api.rb', line 28

def detail_brokerage_authorization(authorization_id:, user_id:, user_secret:, extra: {})
  data, _status_code, _headers = detail_brokerage_authorization_with_http_info_impl(authorization_id, 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.

Parameters:

  • authorization_id (String)
  • user_id (String)
  • user_secret (String)
  • extra (Hash) (defaults to: {})

    additional parameters to pass along through :header_params, :query_params, or parameter name



41
42
43
# File 'lib/snaptrade/api/connections_api.rb', line 41

def detail_brokerage_authorization_with_http_info(authorization_id:, user_id:, user_secret:, extra: {})
  detail_brokerage_authorization_with_http_info_impl(authorization_id, 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.

Parameters:

  • authorization_id (String)
  • user_id (String)
  • user_secret (String)
  • extra (Hash) (defaults to: {})

    additional parameters to pass along through :header_params, :query_params, or parameter name



134
135
136
137
# File 'lib/snaptrade/api/connections_api.rb', line 134

def disable_brokerage_authorization(authorization_id:, user_id:, user_secret:, extra: {})
  data, _status_code, _headers = disable_brokerage_authorization_with_http_info_impl(authorization_id, 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.

Parameters:

  • authorization_id (String)
  • user_id (String)
  • user_secret (String)
  • extra (Hash) (defaults to: {})

    additional parameters to pass along through :header_params, :query_params, or parameter name



150
151
152
# File 'lib/snaptrade/api/connections_api.rb', line 150

def disable_brokerage_authorization_with_http_info(authorization_id:, user_id:, user_secret:, extra: {})
  disable_brokerage_authorization_with_http_info_impl(authorization_id, 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.

Parameters:

  • user_id (String)
  • user_secret (String)
  • extra (Hash) (defaults to: {})

    additional parameters to pass along through :header_params, :query_params, or parameter name



243
244
245
246
# File 'lib/snaptrade/api/connections_api.rb', line 243

def list_brokerage_authorizations(user_id:, user_secret:, extra: {})
  data, _status_code, _headers = list_brokerage_authorizations_with_http_info_impl(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.

Parameters:

  • user_id (String)
  • user_secret (String)
  • extra (Hash) (defaults to: {})

    additional parameters to pass along through :header_params, :query_params, or parameter name



259
260
261
# File 'lib/snaptrade/api/connections_api.rb', line 259

def list_brokerage_authorizations_with_http_info(user_id:, user_secret:, extra: {})
  list_brokerage_authorizations_with_http_info_impl(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)**

Parameters:

  • authorization_id (String)
  • user_id (String)
  • user_secret (String)
  • extra (Hash) (defaults to: {})

    additional parameters to pass along through :header_params, :query_params, or parameter name



346
347
348
349
# File 'lib/snaptrade/api/connections_api.rb', line 346

def refresh_brokerage_authorization(authorization_id:, user_id:, user_secret:, extra: {})
  data, _status_code, _headers = refresh_brokerage_authorization_with_http_info_impl(authorization_id, 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)**

Parameters:

  • authorization_id (String)
  • user_id (String)
  • user_secret (String)
  • extra (Hash) (defaults to: {})

    additional parameters to pass along through :header_params, :query_params, or parameter name



362
363
364
# File 'lib/snaptrade/api/connections_api.rb', line 362

def refresh_brokerage_authorization_with_http_info(authorization_id:, user_id:, user_secret:, extra: {})
  refresh_brokerage_authorization_with_http_info_impl(authorization_id, 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.

Parameters:

  • authorization_id (String)
  • user_id (String)
  • user_secret (String)
  • extra (Hash) (defaults to: {})

    additional parameters to pass along through :header_params, :query_params, or parameter name



452
453
454
455
# File 'lib/snaptrade/api/connections_api.rb', line 452

def remove_brokerage_authorization(authorization_id:, user_id:, user_secret:, extra: {})
  remove_brokerage_authorization_with_http_info_impl(authorization_id, 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.

Parameters:

  • authorization_id (String)
  • user_id (String)
  • user_secret (String)
  • extra (Hash) (defaults to: {})

    additional parameters to pass along through :header_params, :query_params, or parameter name



465
466
467
# File 'lib/snaptrade/api/connections_api.rb', line 465

def remove_brokerage_authorization_with_http_info(authorization_id:, user_id:, user_secret:, extra: {})
  remove_brokerage_authorization_with_http_info_impl(authorization_id, user_id, user_secret, extra)
end

#return_rates(user_id:, user_secret:, authorization_id:, extra: {}) ⇒ Object

List connection rate of returns

Returns a list of rate of return percents for a given connection. Will include timeframes available from the brokerage, for example “ALL”, “1Y”, “6M”, “3M”, “1M”

Parameters:

  • user_id (String)
  • user_secret (String)
  • authorization_id (String)
  • extra (Hash) (defaults to: {})

    additional parameters to pass along through :header_params, :query_params, or parameter name



553
554
555
556
# File 'lib/snaptrade/api/connections_api.rb', line 553

def return_rates(user_id:, user_secret:, authorization_id:, extra: {})
  data, _status_code, _headers = return_rates_with_http_info_impl(user_id, user_secret, authorization_id, extra)
  data
end

#return_rates_with_http_info(user_id:, user_secret:, authorization_id:, extra: {}) ⇒ Object

List connection rate of returns

Returns a list of rate of return percents for a given connection. Will include timeframes available from the brokerage, for example “ALL”, “1Y”, “6M”, “3M”, “1M”

Parameters:

  • user_id (String)
  • user_secret (String)
  • authorization_id (String)
  • extra (Hash) (defaults to: {})

    additional parameters to pass along through :header_params, :query_params, or parameter name



566
567
568
# File 'lib/snaptrade/api/connections_api.rb', line 566

def return_rates_with_http_info(user_id:, user_secret:, authorization_id:, extra: {})
  return_rates_with_http_info_impl(user_id, user_secret, authorization_id, 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.

Parameters:

  • partner_client_id (String)
  • user_id (String) (defaults to: SENTINEL)

    Optional comma separated list of user IDs used to filter the request on specific users

  • session_id (String) (defaults to: SENTINEL)

    Optional comma separated list of session IDs used to filter the request on specific users

  • extra (Hash) (defaults to: {})

    additional parameters to pass along through :header_params, :query_params, or parameter name



656
657
658
659
660
661
# File 'lib/snaptrade/api/connections_api.rb', line 656

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.

Parameters:

  • partner_client_id (String)
  • user_id (String) (defaults to: SENTINEL)

    Optional comma separated list of user IDs used to filter the request on specific users

  • session_id (String) (defaults to: SENTINEL)

    Optional comma separated list of session IDs used to filter the request on specific users

  • extra (Hash) (defaults to: {})

    additional parameters to pass along through :header_params, :query_params, or parameter name



671
672
673
674
675
# File 'lib/snaptrade/api/connections_api.rb', line 671

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