snaptrade 3.0.3 → 3.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9eb41837fba388ae89f7ab2fa9aa827af8d8c794f3c73a55e844af9610f580cb
4
- data.tar.gz: 34b4dbe47256bf59ba913962e86c6ff93c9549398a303e9de5ab3150463c51be
3
+ metadata.gz: 42c6cbd8d70b68fbeaaec9a26b5a4de57bf2439e2c745084657e48ed2b62ecb4
4
+ data.tar.gz: 86de1c293648872d90ba719e82609fbe77a0b626437255f6312e1b3976721272
5
5
  SHA512:
6
- metadata.gz: dae2772d34c712eb5849f2f67d604f0a1a71c92bbdda4c2ff8639ccbb344bd07a778683a98d7b1145af06b5de2411464b8603272db4387ff72395ef4f94b7b6f
7
- data.tar.gz: b12fd9fe328d9ff3f8a590caa0d9bfbbad10e979db80552d640e90613b5894ee218b39a153dd000e9ffa14ff1d0070ce398743526d72465f662c3f64231b1f0e
6
+ metadata.gz: 35e1dbe18c59245ffd5c4235054957ce92e17fdbc78ca34b2e1fa7f6fa7857cf2b7c1d92170fe7089e38bbfccd14c05a563a33fda615f311438dfe3e332ab136
7
+ data.tar.gz: b2e5526daa65b2c159d6692ab4a1141c4e56031d0640c9d16b113d1672b544c3f9a3031048c8f580a70a04f26fcc065be80f67cd1b2abdcffd23ec85ef56001e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- snaptrade (3.0.3)
4
+ snaptrade (3.0.4)
5
5
  faraday (>= 1.0.1, < 3.0)
6
6
  faraday-multipart (~> 1.0, >= 1.0.4)
7
7
 
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-v3.0.3-blue)](https://rubygems.org/gems/snaptrade/versions/3.0.3)
9
+ [![npm](https://img.shields.io/badge/gem-v3.0.4-blue)](https://rubygems.org/gems/snaptrade/versions/3.0.4)
10
10
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
11
11
 
12
12
  </div>
@@ -28,6 +28,7 @@ Connect brokerage accounts to your app for live positions and trading
28
28
  * [`snaptrade.account_information.get_user_account_orders`](#snaptradeaccount_informationget_user_account_orders)
29
29
  * [`snaptrade.account_information.get_user_account_recent_orders`](#snaptradeaccount_informationget_user_account_recent_orders)
30
30
  * [`snaptrade.account_information.get_user_account_return_rates`](#snaptradeaccount_informationget_user_account_return_rates)
31
+ * [`snaptrade.account_information.get_user_aum_percentile`](#snaptradeaccount_informationget_user_aum_percentile)
31
32
  * [`snaptrade.account_information.get_user_holdings`](#snaptradeaccount_informationget_user_holdings)
32
33
  * [`snaptrade.account_information.list_user_accounts`](#snaptradeaccount_informationlist_user_accounts)
33
34
  * [`snaptrade.account_information.update_user_account`](#snaptradeaccount_informationupdate_user_account)
@@ -82,7 +83,7 @@ Connect brokerage accounts to your app for live positions and trading
82
83
  Add to Gemfile:
83
84
 
84
85
  ```ruby
85
- gem 'snaptrade', '~> 3.0.3'
86
+ gem 'snaptrade', '~> 3.0.4'
86
87
  ```
87
88
 
88
89
  ## Getting Started<a id="getting-started"></a>
@@ -542,6 +543,42 @@ returns all six supported timeframes.
542
543
  ---
543
544
 
544
545
 
546
+ ### `snaptrade.account_information.get_user_aum_percentile`<a id="snaptradeaccount_informationget_user_aum_percentile"></a>
547
+
548
+ Returns where the user's total assets sit within the distribution of a cohort of comparable users, as a coarse bucket plus an integer percentile.
549
+
550
+ The cohort is scoped to your own book: a user is only ever compared against your other users, never across SnapTrade customers. (Users on personal-use keys are the exception — they are compared against all other personal-use users, since a personal key has a single user and cannot form a distribution of its own.) The distribution is recomputed monthly, and `as_of` reports which month's distribution the placement came from.
551
+
552
+ `data` is `null` — a 200, not an error — when SnapTrade declines to place the user. That happens when the cohort is too small to publish a distribution, or when the user's own holdings are incomplete or stale (for example they hold a disabled connection). A placement computed from a partial view of a user's assets would understate them, so none is returned.
553
+
554
+
555
+ #### 🛠️ Usage<a id="🛠️-usage"></a>
556
+
557
+ ```ruby
558
+ result = snaptrade.account_information.get_user_aum_percentile(
559
+ user_id: "snaptrade-user-123",
560
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
561
+ )
562
+ p result
563
+ ```
564
+
565
+ #### ⚙️ Parameters<a id="⚙️-parameters"></a>
566
+
567
+ ##### user_id: `String`<a id="user_id-string"></a>
568
+ ##### user_secret: `String`<a id="user_secret-string"></a>
569
+ #### 🔄 Return<a id="🔄-return"></a>
570
+
571
+ [UserAumPercentileResponse](./lib/snaptrade/models/user_aum_percentile_response.rb)
572
+
573
+ #### 🌐 Endpoint<a id="🌐-endpoint"></a>
574
+
575
+ `/aumPercentile` `GET`
576
+
577
+ [🔙 **Back to Table of Contents**](#table-of-contents)
578
+
579
+ ---
580
+
581
+
545
582
  ### `snaptrade.account_information.get_user_holdings`<a id="snaptradeaccount_informationget_user_holdings"></a>
546
583
  ![Deprecated](https://img.shields.io/badge/deprecated-yellow)
547
584
 
@@ -749,6 +786,7 @@ result = snaptrade.authentication.login_snap_trade_user(
749
786
  connection_type: "read",
750
787
  show_close_button: true,
751
788
  dark_mode: true,
789
+ locale: "pt-BR",
752
790
  connection_portal_version: "v4",
753
791
  )
754
792
  p result
@@ -793,6 +831,16 @@ When false, you control closing behavior from your app. Defaults to true.
793
831
  ##### darkMode: `Boolean`<a id="darkmode-boolean"></a>
794
832
  Enable dark mode for the connection portal. Defaults to false.
795
833
 
834
+ ##### locale: `String`<a id="locale-string"></a>
835
+ Language the connection portal renders in. `en` and `pt-BR` are the languages we
836
+ ship; any other language is rejected with a 400. Matching is case- and
837
+ separator-insensitive, so `pt-br`, `pt-BR` and `pt_BR` are equivalent, and a
838
+ regional tag resolves to the language when we ship it, so `en-US` renders `en`.
839
+ Deliberately not an enum: those equivalent spellings are all accepted by the
840
+ API, and an enum would have generated SDKs reject them before the request is
841
+ sent. Screens without translated copy fall back to English individually.
842
+ Defaults to `en`.
843
+
796
844
  ##### connectionPortalVersion: [`ConnectionPortalVersion`](./lib/snaptrade/models/connection_portal_version.rb)<a id="connectionportalversion-connectionportalversionlibsnaptrademodelsconnection_portal_versionrb"></a>
797
845
  Sets the connection portal version to render. Currently only `v4` is supported
798
846
  and is the default. All other versions are deprecated and will automatically be
@@ -1134,6 +1134,109 @@ module SnapTrade
1134
1134
  end
1135
1135
 
1136
1136
 
1137
+ # Get the user's AUM percentile
1138
+ #
1139
+ # Returns where the user's total assets sit within the distribution of a cohort of comparable users, as a coarse bucket plus an integer percentile.
1140
+ #
1141
+ # The cohort is scoped to your own book: a user is only ever compared against your other users, never across SnapTrade customers. (Users on personal-use keys are the exception — they are compared against all other personal-use users, since a personal key has a single user and cannot form a distribution of its own.) The distribution is recomputed monthly, and `as_of` reports which month's distribution the placement came from.
1142
+ #
1143
+ # `data` is `null` — a 200, not an error — when SnapTrade declines to place the user. That happens when the cohort is too small to publish a distribution, or when the user's own holdings are incomplete or stale (for example they hold a disabled connection). A placement computed from a partial view of a user's assets would understate them, so none is returned.
1144
+ #
1145
+ # @param user_id [String]
1146
+ # @param user_secret [String]
1147
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
1148
+ def get_user_aum_percentile(user_id:, user_secret:, extra: {})
1149
+ data, _status_code, _headers = get_user_aum_percentile_with_http_info_impl(user_id, user_secret, extra)
1150
+ data
1151
+ end
1152
+
1153
+ # Get the user's AUM percentile
1154
+ #
1155
+ # Returns where the user's total assets sit within the distribution of a cohort of comparable users, as a coarse bucket plus an integer percentile.
1156
+ #
1157
+ # The cohort is scoped to your own book: a user is only ever compared against your other users, never across SnapTrade customers. (Users on personal-use keys are the exception — they are compared against all other personal-use users, since a personal key has a single user and cannot form a distribution of its own.) The distribution is recomputed monthly, and `as_of` reports which month's distribution the placement came from.
1158
+ #
1159
+ # `data` is `null` — a 200, not an error — when SnapTrade declines to place the user. That happens when the cohort is too small to publish a distribution, or when the user's own holdings are incomplete or stale (for example they hold a disabled connection). A placement computed from a partial view of a user's assets would understate them, so none is returned.
1160
+ #
1161
+ # @param user_id [String]
1162
+ # @param user_secret [String]
1163
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
1164
+ def get_user_aum_percentile_with_http_info(user_id:, user_secret:, extra: {})
1165
+ get_user_aum_percentile_with_http_info_impl(user_id, user_secret, extra)
1166
+ end
1167
+
1168
+ # Get the user's AUM percentile
1169
+ # Returns where the user's total assets sit within the distribution of a cohort of comparable users, as a coarse bucket plus an integer percentile. The cohort is scoped to your own book: a user is only ever compared against your other users, never across SnapTrade customers. (Users on personal-use keys are the exception — they are compared against all other personal-use users, since a personal key has a single user and cannot form a distribution of its own.) The distribution is recomputed monthly, and `as_of` reports which month's distribution the placement came from. `data` is `null` — a 200, not an error — when SnapTrade declines to place the user. That happens when the cohort is too small to publish a distribution, or when the user's own holdings are incomplete or stale (for example they hold a disabled connection). A placement computed from a partial view of a user's assets would understate them, so none is returned.
1170
+ # @param user_id [String]
1171
+ # @param user_secret [String]
1172
+ # @param [Hash] opts the optional parameters
1173
+ # @return [UserAumPercentileResponse]
1174
+ private def get_user_aum_percentile_impl(user_id, user_secret, opts = {})
1175
+ data, _status_code, _headers = get_user_aum_percentile_with_http_info(user_id, user_secret, opts)
1176
+ data
1177
+ end
1178
+
1179
+ # Get the user&#39;s AUM percentile
1180
+ # Returns where the user&#39;s total assets sit within the distribution of a cohort of comparable users, as a coarse bucket plus an integer percentile. The cohort is scoped to your own book: a user is only ever compared against your other users, never across SnapTrade customers. (Users on personal-use keys are the exception — they are compared against all other personal-use users, since a personal key has a single user and cannot form a distribution of its own.) The distribution is recomputed monthly, and &#x60;as_of&#x60; reports which month&#39;s distribution the placement came from. &#x60;data&#x60; is &#x60;null&#x60; — a 200, not an error — when SnapTrade declines to place the user. That happens when the cohort is too small to publish a distribution, or when the user&#39;s own holdings are incomplete or stale (for example they hold a disabled connection). A placement computed from a partial view of a user&#39;s assets would understate them, so none is returned.
1181
+ # @param user_id [String]
1182
+ # @param user_secret [String]
1183
+ # @param [Hash] opts the optional parameters
1184
+ # @return [Array<(UserAumPercentileResponse, Integer, Hash)>] UserAumPercentileResponse data, response status code and response headers
1185
+ private def get_user_aum_percentile_with_http_info_impl(user_id, user_secret, opts = {})
1186
+ if @api_client.config.debugging
1187
+ @api_client.config.logger.debug 'Calling API: AccountInformationApi.get_user_aum_percentile ...'
1188
+ end
1189
+ # verify the required parameter 'user_id' is set
1190
+ if @api_client.config.client_side_validation && user_id.nil?
1191
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling AccountInformationApi.get_user_aum_percentile"
1192
+ end
1193
+ # verify the required parameter 'user_secret' is set
1194
+ if @api_client.config.client_side_validation && user_secret.nil?
1195
+ fail ArgumentError, "Missing the required parameter 'user_secret' when calling AccountInformationApi.get_user_aum_percentile"
1196
+ end
1197
+ # resource path
1198
+ local_var_path = '/aumPercentile'
1199
+
1200
+ # query parameters
1201
+ query_params = opts[:query_params] || {}
1202
+ query_params[:'userId'] = user_id
1203
+ query_params[:'userSecret'] = user_secret
1204
+
1205
+ # header parameters
1206
+ header_params = opts[:header_params] || {}
1207
+ # HTTP header 'Accept' (if needed)
1208
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1209
+
1210
+ # form parameters
1211
+ form_params = opts[:form_params] || {}
1212
+
1213
+ # http body (model)
1214
+ post_body = opts[:debug_body]
1215
+
1216
+ # return_type
1217
+ return_type = opts[:debug_return_type] || 'UserAumPercentileResponse'
1218
+
1219
+ # auth_names
1220
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
1221
+
1222
+ new_options = opts.merge(
1223
+ :operation => :"AccountInformationApi.get_user_aum_percentile",
1224
+ :header_params => header_params,
1225
+ :query_params => query_params,
1226
+ :form_params => form_params,
1227
+ :body => post_body,
1228
+ :auth_names => auth_names,
1229
+ :return_type => return_type
1230
+ )
1231
+
1232
+ data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
1233
+ if @api_client.config.debugging
1234
+ @api_client.config.logger.debug "API called: AccountInformationApi#get_user_aum_percentile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1235
+ end
1236
+ return data, status_code, headers, response
1237
+ end
1238
+
1239
+
1137
1240
  # List account holdings
1138
1241
  #
1139
1242
  # **Deprecated.** Use the finer-grained account data endpoints instead: [balances](/reference/Account%20Information/AccountInformation_getUserAccountBalance), [positions](/reference/Account%20Information/AccountInformation_getAllAccountPositions), and [orders](/reference/Account%20Information/AccountInformation_getUserAccountOrders).
@@ -195,10 +195,11 @@ module SnapTrade
195
195
  # @param connection_type [ConnectionType] Determines connection permissions (default: read) - `read`: Data access only. - `trade`: Data and trading access. - `trade-if-available`: Attempts to establish a trading connection if the brokerage supports it, otherwise falls back to read-only access automatically.
196
196
  # @param show_close_button [Boolean] Controls whether the close (X) button is displayed in the connection portal. When false, you control closing behavior from your app. Defaults to true.
197
197
  # @param dark_mode [Boolean] Enable dark mode for the connection portal. Defaults to false.
198
+ # @param locale [String] Language the connection portal renders in. `en` and `pt-BR` are the languages we ship; any other language is rejected with a 400. Matching is case- and separator-insensitive, so `pt-br`, `pt-BR` and `pt_BR` are equivalent, and a regional tag resolves to the language when we ship it, so `en-US` renders `en`. Deliberately not an enum: those equivalent spellings are all accepted by the API, and an enum would have generated SDKs reject them before the request is sent. Screens without translated copy fall back to English individually. Defaults to `en`.
198
199
  # @param connection_portal_version [ConnectionPortalVersion] Sets the connection portal version to render. Currently only `v4` is supported and is the default. All other versions are deprecated and will automatically be set to v4.
199
200
  # @param body [SnapTradeLoginUserRequestBody]
200
201
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
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: {})
202
+ 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, locale: 'en', connection_portal_version: 'v4', extra: {})
202
203
  _body = {}
203
204
  _body[:broker] = broker if broker != SENTINEL
204
205
  _body[:immediateRedirect] = immediate_redirect if immediate_redirect != SENTINEL
@@ -207,6 +208,7 @@ module SnapTrade
207
208
  _body[:connectionType] = connection_type if connection_type != SENTINEL
208
209
  _body[:showCloseButton] = show_close_button if show_close_button != SENTINEL
209
210
  _body[:darkMode] = dark_mode if dark_mode != SENTINEL
211
+ _body[:locale] = locale if locale != SENTINEL
210
212
  _body[:connectionPortalVersion] = connection_portal_version if connection_portal_version != SENTINEL
211
213
  extra[:snap_trade_login_user_request_body] = _body if !_body.empty?
212
214
  data, _status_code, _headers = login_snap_trade_user_with_http_info_impl(user_id, user_secret, extra)
@@ -228,10 +230,11 @@ module SnapTrade
228
230
  # @param connection_type [ConnectionType] Determines connection permissions (default: read) - `read`: Data access only. - `trade`: Data and trading access. - `trade-if-available`: Attempts to establish a trading connection if the brokerage supports it, otherwise falls back to read-only access automatically.
229
231
  # @param show_close_button [Boolean] Controls whether the close (X) button is displayed in the connection portal. When false, you control closing behavior from your app. Defaults to true.
230
232
  # @param dark_mode [Boolean] Enable dark mode for the connection portal. Defaults to false.
233
+ # @param locale [String] Language the connection portal renders in. `en` and `pt-BR` are the languages we ship; any other language is rejected with a 400. Matching is case- and separator-insensitive, so `pt-br`, `pt-BR` and `pt_BR` are equivalent, and a regional tag resolves to the language when we ship it, so `en-US` renders `en`. Deliberately not an enum: those equivalent spellings are all accepted by the API, and an enum would have generated SDKs reject them before the request is sent. Screens without translated copy fall back to English individually. Defaults to `en`.
231
234
  # @param connection_portal_version [ConnectionPortalVersion] Sets the connection portal version to render. Currently only `v4` is supported and is the default. All other versions are deprecated and will automatically be set to v4.
232
235
  # @param body [SnapTradeLoginUserRequestBody]
233
236
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
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: {})
237
+ 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, locale: 'en', connection_portal_version: 'v4', extra: {})
235
238
  _body = {}
236
239
  _body[:broker] = broker if broker != SENTINEL
237
240
  _body[:immediateRedirect] = immediate_redirect if immediate_redirect != SENTINEL
@@ -240,6 +243,7 @@ module SnapTrade
240
243
  _body[:connectionType] = connection_type if connection_type != SENTINEL
241
244
  _body[:showCloseButton] = show_close_button if show_close_button != SENTINEL
242
245
  _body[:darkMode] = dark_mode if dark_mode != SENTINEL
246
+ _body[:locale] = locale if locale != SENTINEL
243
247
  _body[:connectionPortalVersion] = connection_portal_version if connection_portal_version != SENTINEL
244
248
  extra[:snap_trade_login_user_request_body] = _body if !_body.empty?
245
249
  login_snap_trade_user_with_http_info_impl(user_id, user_secret, extra)
@@ -0,0 +1,41 @@
1
+ =begin
2
+ #SnapTrade
3
+
4
+ #Connect brokerage accounts to your app for live positions and trading
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: api@snaptrade.com
8
+ =end
9
+
10
+ require 'date'
11
+ require 'time'
12
+
13
+ module SnapTrade
14
+ class Bucket
15
+ TOP_1_PERCENT = "TOP_1_PERCENT".freeze
16
+ TOP_5_PERCENT = "TOP_5_PERCENT".freeze
17
+ TOP_10_PERCENT = "TOP_10_PERCENT".freeze
18
+ TOP_25_PERCENT = "TOP_25_PERCENT".freeze
19
+ TOP_50_PERCENT = "TOP_50_PERCENT".freeze
20
+ BOTTOM_50_PERCENT = "BOTTOM_50_PERCENT".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [TOP_1_PERCENT, TOP_5_PERCENT, TOP_10_PERCENT, TOP_25_PERCENT, TOP_50_PERCENT, BOTTOM_50_PERCENT].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ return value if Bucket.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #Bucket"
39
+ end
40
+ end
41
+ end
@@ -34,6 +34,9 @@ module SnapTrade
34
34
  # Enable dark mode for the connection portal. Defaults to false.
35
35
  attr_accessor :dark_mode
36
36
 
37
+ # Language the connection portal renders in. `en` and `pt-BR` are the languages we ship; any other language is rejected with a 400. Matching is case- and separator-insensitive, so `pt-br`, `pt-BR` and `pt_BR` are equivalent, and a regional tag resolves to the language when we ship it, so `en-US` renders `en`. Deliberately not an enum: those equivalent spellings are all accepted by the API, and an enum would have generated SDKs reject them before the request is sent. Screens without translated copy fall back to English individually. Defaults to `en`.
38
+ attr_accessor :locale
39
+
37
40
  # Sets the connection portal version to render. Currently only `v4` is supported and is the default. All other versions are deprecated and will automatically be set to v4.
38
41
  attr_accessor :connection_portal_version
39
42
 
@@ -47,6 +50,7 @@ module SnapTrade
47
50
  :'connection_type' => :'connectionType',
48
51
  :'show_close_button' => :'showCloseButton',
49
52
  :'dark_mode' => :'darkMode',
53
+ :'locale' => :'locale',
50
54
  :'connection_portal_version' => :'connectionPortalVersion'
51
55
  }
52
56
  end
@@ -66,6 +70,7 @@ module SnapTrade
66
70
  :'connection_type' => :'ConnectionType',
67
71
  :'show_close_button' => :'Boolean',
68
72
  :'dark_mode' => :'Boolean',
73
+ :'locale' => :'String',
69
74
  :'connection_portal_version' => :'ConnectionPortalVersion'
70
75
  }
71
76
  end
@@ -121,6 +126,12 @@ module SnapTrade
121
126
  self.dark_mode = attributes[:'dark_mode']
122
127
  end
123
128
 
129
+ if attributes.key?(:'locale')
130
+ self.locale = attributes[:'locale']
131
+ else
132
+ self.locale = 'en'
133
+ end
134
+
124
135
  if attributes.key?(:'connection_portal_version')
125
136
  self.connection_portal_version = attributes[:'connection_portal_version']
126
137
  else
@@ -153,6 +164,7 @@ module SnapTrade
153
164
  connection_type == o.connection_type &&
154
165
  show_close_button == o.show_close_button &&
155
166
  dark_mode == o.dark_mode &&
167
+ locale == o.locale &&
156
168
  connection_portal_version == o.connection_portal_version
157
169
  end
158
170
 
@@ -165,7 +177,7 @@ module SnapTrade
165
177
  # Calculates hash code according to all attributes.
166
178
  # @return [Integer] Hash code
167
179
  def hash
168
- [broker, immediate_redirect, custom_redirect, reconnect, connection_type, show_close_button, dark_mode, connection_portal_version].hash
180
+ [broker, immediate_redirect, custom_redirect, reconnect, connection_type, show_close_button, dark_mode, locale, connection_portal_version].hash
169
181
  end
170
182
 
171
183
  # Builds the object from hash
@@ -0,0 +1,282 @@
1
+ =begin
2
+ #SnapTrade
3
+
4
+ #Connect brokerage accounts to your app for live positions and trading
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: api@snaptrade.com
8
+ =end
9
+
10
+ require 'date'
11
+ require 'time'
12
+
13
+ module SnapTrade
14
+ # A user's AUM placement within a single SnapTrade customer's book
15
+ class UserAumPercentileObject
16
+ # The band the user falls into. Deliberately coarse: the underlying totals are only as current as each brokerage's last sync, so an exact percentile would imply more precision than the data supports.
17
+ attr_accessor :bucket
18
+
19
+ # The percent of the cohort the user's assets are strictly above, 0-100. Integer by design: the distribution is stored as 101 interpolated cutoffs, so a fractional percentile would not mean anything. Prefer `bucket` for anything you display prominently. The distribution is recomputed monthly, so a user's percentile can move a few points on its own as other users' holdings refresh, while their bucket stays put. Users tied on the same total all receive the lowest percentile that total spans.
20
+ attr_accessor :percentile
21
+
22
+ # Number of your users the distribution was computed from.
23
+ attr_accessor :cohort_size
24
+
25
+ # The month whose distribution produced this placement.
26
+ attr_accessor :as_of
27
+
28
+ # The currency the distribution was computed in.
29
+ attr_accessor :currency
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'bucket' => :'bucket',
35
+ :'percentile' => :'percentile',
36
+ :'cohort_size' => :'cohort_size',
37
+ :'as_of' => :'as_of',
38
+ :'currency' => :'currency'
39
+ }
40
+ end
41
+
42
+ # Returns all the JSON keys this model knows about
43
+ def self.acceptable_attributes
44
+ attribute_map.values
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'bucket' => :'Bucket',
51
+ :'percentile' => :'Integer',
52
+ :'cohort_size' => :'Integer',
53
+ :'as_of' => :'Date',
54
+ :'currency' => :'String'
55
+ }
56
+ end
57
+
58
+ # List of attributes with nullable: true
59
+ def self.openapi_nullable
60
+ Set.new([
61
+ ])
62
+ end
63
+
64
+ # Initializes the object
65
+ # @param [Hash] attributes Model attributes in the form of hash
66
+ def initialize(attributes = {})
67
+ if (!attributes.is_a?(Hash))
68
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::UserAumPercentileObject` initialize method"
69
+ end
70
+
71
+ # check to see if the attribute exists and convert string to symbol for hash key
72
+ attributes = attributes.each_with_object({}) { |(k, v), h|
73
+ if (!self.class.attribute_map.key?(k.to_sym))
74
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::UserAumPercentileObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
75
+ end
76
+ h[k.to_sym] = v
77
+ }
78
+
79
+ if attributes.key?(:'bucket')
80
+ self.bucket = attributes[:'bucket']
81
+ end
82
+
83
+ if attributes.key?(:'percentile')
84
+ self.percentile = attributes[:'percentile']
85
+ end
86
+
87
+ if attributes.key?(:'cohort_size')
88
+ self.cohort_size = attributes[:'cohort_size']
89
+ end
90
+
91
+ if attributes.key?(:'as_of')
92
+ self.as_of = attributes[:'as_of']
93
+ end
94
+
95
+ if attributes.key?(:'currency')
96
+ self.currency = attributes[:'currency']
97
+ end
98
+ end
99
+
100
+ # Show invalid properties with the reasons. Usually used together with valid?
101
+ # @return Array for valid properties with the reasons
102
+ def list_invalid_properties
103
+ invalid_properties = Array.new
104
+ if !@percentile.nil? && @percentile > 100
105
+ invalid_properties.push('invalid value for "percentile", must be smaller than or equal to 100.')
106
+ end
107
+
108
+ if !@percentile.nil? && @percentile < 0
109
+ invalid_properties.push('invalid value for "percentile", must be greater than or equal to 0.')
110
+ end
111
+
112
+ invalid_properties
113
+ end
114
+
115
+ # Check to see if the all the properties in the model are valid
116
+ # @return true if the model is valid
117
+ def valid?
118
+ return false if !@percentile.nil? && @percentile > 100
119
+ return false if !@percentile.nil? && @percentile < 0
120
+ true
121
+ end
122
+
123
+ # Custom attribute writer method with validation
124
+ # @param [Object] percentile Value to be assigned
125
+ def percentile=(percentile)
126
+ if !percentile.nil? && percentile > 100
127
+ fail ArgumentError, 'invalid value for "percentile", must be smaller than or equal to 100.'
128
+ end
129
+
130
+ if !percentile.nil? && percentile < 0
131
+ fail ArgumentError, 'invalid value for "percentile", must be greater than or equal to 0.'
132
+ end
133
+
134
+ @percentile = percentile
135
+ end
136
+
137
+ # Checks equality by comparing each attribute.
138
+ # @param [Object] Object to be compared
139
+ def ==(o)
140
+ return true if self.equal?(o)
141
+ self.class == o.class &&
142
+ bucket == o.bucket &&
143
+ percentile == o.percentile &&
144
+ cohort_size == o.cohort_size &&
145
+ as_of == o.as_of &&
146
+ currency == o.currency
147
+ end
148
+
149
+ # @see the `==` method
150
+ # @param [Object] Object to be compared
151
+ def eql?(o)
152
+ self == o
153
+ end
154
+
155
+ # Calculates hash code according to all attributes.
156
+ # @return [Integer] Hash code
157
+ def hash
158
+ [bucket, percentile, cohort_size, as_of, currency].hash
159
+ end
160
+
161
+ # Builds the object from hash
162
+ # @param [Hash] attributes Model attributes in the form of hash
163
+ # @return [Object] Returns the model itself
164
+ def self.build_from_hash(attributes)
165
+ new.build_from_hash(attributes)
166
+ end
167
+
168
+ # Builds the object from hash
169
+ # @param [Hash] attributes Model attributes in the form of hash
170
+ # @return [Object] Returns the model itself
171
+ def build_from_hash(attributes)
172
+ return nil unless attributes.is_a?(Hash)
173
+ attributes = attributes.transform_keys(&:to_sym)
174
+ self.class.openapi_types.each_pair do |key, type|
175
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
176
+ self.send("#{key}=", nil)
177
+ elsif type =~ /\AArray<(.*)>/i
178
+ # check to ensure the input is an array given that the attribute
179
+ # is documented as an array but the input is not
180
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
181
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
182
+ end
183
+ elsif !attributes[self.class.attribute_map[key]].nil?
184
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
185
+ end
186
+ end
187
+
188
+ self
189
+ end
190
+
191
+ # Deserializes the data based on type
192
+ # @param string type Data type
193
+ # @param string value Value to be deserialized
194
+ # @return [Object] Deserialized data
195
+ def _deserialize(type, value)
196
+ case type.to_sym
197
+ when :Time
198
+ Time.parse(value)
199
+ when :Date
200
+ Date.parse(value)
201
+ when :String
202
+ value.to_s
203
+ when :Integer
204
+ value.to_i
205
+ when :Float
206
+ value.to_f
207
+ when :Boolean
208
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
209
+ true
210
+ else
211
+ false
212
+ end
213
+ when :Object
214
+ # generic object (usually a Hash), return directly
215
+ value
216
+ when /\AArray<(?<inner_type>.+)>\z/
217
+ inner_type = Regexp.last_match[:inner_type]
218
+ value.map { |v| _deserialize(inner_type, v) }
219
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
220
+ k_type = Regexp.last_match[:k_type]
221
+ v_type = Regexp.last_match[:v_type]
222
+ {}.tap do |hash|
223
+ value.each do |k, v|
224
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
225
+ end
226
+ end
227
+ else # model
228
+ # models (e.g. Pet) or oneOf
229
+ klass = SnapTrade.const_get(type)
230
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
231
+ end
232
+ end
233
+
234
+ # Returns the string representation of the object
235
+ # @return [String] String presentation of the object
236
+ def to_s
237
+ to_hash.to_s
238
+ end
239
+
240
+ # to_body is an alias to to_hash (backward compatibility)
241
+ # @return [Hash] Returns the object in the form of hash
242
+ def to_body
243
+ to_hash
244
+ end
245
+
246
+ # Returns the object in the form of hash
247
+ # @return [Hash] Returns the object in the form of hash
248
+ def to_hash
249
+ hash = {}
250
+ self.class.attribute_map.each_pair do |attr, param|
251
+ value = self.send(attr)
252
+ if value.nil?
253
+ is_nullable = self.class.openapi_nullable.include?(attr)
254
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
255
+ end
256
+
257
+ hash[param] = _to_hash(value)
258
+ end
259
+ hash
260
+ end
261
+
262
+ # Outputs non-array value in the form of hash
263
+ # For object, use to_hash. Otherwise, just return the value
264
+ # @param [Object] value Any valid value
265
+ # @return [Hash] Returns the value in the form of hash
266
+ def _to_hash(value)
267
+ if value.is_a?(Array)
268
+ value.compact.map { |v| _to_hash(v) }
269
+ elsif value.is_a?(Hash)
270
+ {}.tap do |hash|
271
+ value.each { |k, v| hash[k] = _to_hash(v) }
272
+ end
273
+ elsif value.respond_to? :to_hash
274
+ value.to_hash
275
+ else
276
+ value
277
+ end
278
+ end
279
+
280
+ end
281
+
282
+ end