snaptrade 2.0.20 → 2.0.22

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40178dd356fa3c53ef0a09c17cfeccc3ac900992803129689f3df8d605c0aae5
4
- data.tar.gz: 9a1f4f13933f789bb1cf6d69b86195353ad9557c56f5db8ca18b34301aa6a024
3
+ metadata.gz: ca9f4fb79ccef521a81f2574d9cec36c7f620677bff1f425a8e659e029e223f5
4
+ data.tar.gz: 784ea7b28f4ba1616de6300cc5af74aeb68e437b4c5012a048bacfd1b51abbe6
5
5
  SHA512:
6
- metadata.gz: 52650a4f991bed16a72ead70654b6f58a8b1d774ce567b45363362f446e60b17696b98d217d366c67d056febf28bb6f9db0a0f503f2f088e9423b5ab33fb65fd
7
- data.tar.gz: 9e40c527f3b8b9c7c5e7b0d442544ac89d348583aed99a81ea8dc71c3050278e1ed00db14a79293ffc16a34dae3d5854dd617d440e122ac394008bd7a0bc43ba
6
+ metadata.gz: d547cb4e6bcd229bd76bc4d652479c379c79d1c1145d21f376706b42c3385382e488fa06ce1660f9403554daaa943551ddaeaf9b10c2dbcdd84357d12c8e9945
7
+ data.tar.gz: c5033f916bef6cf4d96ef23289cc32ce39d4ab562f124c9b42f63d122986769b25b716041b6c2961ca409a91c3501e35ea899acacd6f1e159729d88b03b64dbd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- snaptrade (2.0.20)
4
+ snaptrade (2.0.22)
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-v2.0.20-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.20)
9
+ [![npm](https://img.shields.io/badge/gem-v2.0.22-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.22)
10
10
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
11
11
 
12
12
  </div>
@@ -69,7 +69,7 @@ Connect brokerage accounts to your app for live positions and trading
69
69
  Add to Gemfile:
70
70
 
71
71
  ```ruby
72
- gem 'snaptrade', '~> 2.0.20'
72
+ gem 'snaptrade', '~> 2.0.22'
73
73
  ```
74
74
 
75
75
  ## Getting Started<a id="getting-started"></a>
@@ -82,7 +82,7 @@ configuration.client_id = ENV["SNAPTRADE_CLIENT_ID"]
82
82
  configuration.consumer_key = ENV["SNAPTRADE_CONSUMER_KEY"]
83
83
  snaptrade = SnapTrade::Client.new(configuration)
84
84
  result = snaptrade.account_information.get_all_user_holdings(
85
- user_id: "John.doe@snaptrade.com",
85
+ user_id: "snaptrade-user-123",
86
86
  user_secret: "USERSECRET123",
87
87
  brokerage_authorizations: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
88
88
  )
@@ -95,7 +95,7 @@ To access the raw HTTP response, suffix any method with `_with_http_info`.
95
95
 
96
96
  ```ruby
97
97
  result = snaptrade.account_information.get_all_user_holdings_with_http_info(
98
- user_id: "John.doe@snaptrade.com",
98
+ user_id: "snaptrade-user-123",
99
99
  user_secret: "USERSECRET123",
100
100
  brokerage_authorizations: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
101
101
  )
@@ -119,7 +119,7 @@ the data returned over the more fine-grained **positions**, **orders** and **bal
119
119
 
120
120
  ```ruby
121
121
  result = snaptrade.account_information.get_all_user_holdings(
122
- user_id: "John.doe@snaptrade.com",
122
+ user_id: "snaptrade-user-123",
123
123
  user_secret: "USERSECRET123",
124
124
  brokerage_authorizations: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
125
125
  )
@@ -155,7 +155,7 @@ A list of account balances for the specified account (one per currency that the
155
155
 
156
156
  ```ruby
157
157
  result = snaptrade.account_information.get_user_account_balance(
158
- user_id: "John.doe@snaptrade.com",
158
+ user_id: "snaptrade-user-123",
159
159
  user_secret: "USERSECRET123",
160
160
  account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
161
161
  )
@@ -192,7 +192,7 @@ including the total account market value.
192
192
 
193
193
  ```ruby
194
194
  result = snaptrade.account_information.get_user_account_details(
195
- user_id: "John.doe@snaptrade.com",
195
+ user_id: "snaptrade-user-123",
196
196
  user_secret: "USERSECRET123",
197
197
  account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
198
198
  )
@@ -227,7 +227,7 @@ Fetch all recent orders from a user's account.
227
227
 
228
228
  ```ruby
229
229
  result = snaptrade.account_information.get_user_account_orders(
230
- user_id: "John.doe@snaptrade.com",
230
+ user_id: "snaptrade-user-123",
231
231
  user_secret: "USERSECRET123",
232
232
  account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
233
233
  state: "all",
@@ -271,7 +271,7 @@ Returns a list of positions in the specified account.
271
271
 
272
272
  ```ruby
273
273
  result = snaptrade.account_information.get_user_account_positions(
274
- user_id: "John.doe@snaptrade.com",
274
+ user_id: "snaptrade-user-123",
275
275
  user_secret: "USERSECRET123",
276
276
  account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
277
277
  )
@@ -310,7 +310,7 @@ data returned over the more fine-grained **positions**, **orders** and **balance
310
310
  ```ruby
311
311
  result = snaptrade.account_information.get_user_holdings(
312
312
  account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
313
- user_id: "John.doe@snaptrade.com",
313
+ user_id: "snaptrade-user-123",
314
314
  user_secret: "USERSECRET123",
315
315
  )
316
316
  p result
@@ -344,7 +344,7 @@ Get a list of all Account objects for the authenticated SnapTrade user.
344
344
 
345
345
  ```ruby
346
346
  result = snaptrade.account_information.list_user_accounts(
347
- user_id: "John.doe@snaptrade.com",
347
+ user_id: "snaptrade-user-123",
348
348
  user_secret: "USERSECRET123",
349
349
  )
350
350
  p result
@@ -375,7 +375,7 @@ Updates various properties of a specified account.
375
375
 
376
376
  ```ruby
377
377
  result = snaptrade.account_information.update_user_account(
378
- user_id: "John.doe@snaptrade.com",
378
+ user_id: "snaptrade-user-123",
379
379
  user_secret: "USERSECRET123",
380
380
  account_id: "accountId_example",
381
381
  )
@@ -434,7 +434,7 @@ Deletes a user you've registered over the SnapTrade API, and any data associated
434
434
 
435
435
  ```ruby
436
436
  result = snaptrade.authentication.delete_snap_trade_user(
437
- user_id: "John.doe@snaptrade.com",
437
+ user_id: "snaptrade-user-123",
438
438
  )
439
439
  p result
440
440
  ```
@@ -465,7 +465,7 @@ JWTs (JSON Web Tokens) instead of standard SnapTrade signature verification.
465
465
 
466
466
  ```ruby
467
467
  result = snaptrade.authentication.get_user_jwt(
468
- user_id: "John.doe@snaptrade.com",
468
+ user_id: "snaptrade-user-123",
469
469
  user_secret: "USERSECRET123",
470
470
  )
471
471
  p result
@@ -516,7 +516,7 @@ Logs in a SnapTrade user and returns an authenticated connection portal URL for
516
516
 
517
517
  ```ruby
518
518
  result = snaptrade.authentication.login_snap_trade_user(
519
- user_id: "John.doe@snaptrade.com",
519
+ user_id: "snaptrade-user-123",
520
520
  user_secret: "USERSECRET123",
521
521
  broker: "ALPACA",
522
522
  immediate_redirect: true,
@@ -584,8 +584,10 @@ p result
584
584
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
585
585
 
586
586
  ##### userId: `String`<a id="userid-string"></a>
587
- SnapTrade User ID. Provided by SnapTrade Partner. Can be any string, as long as
588
- it's unique to a user
587
+ SnapTrade User ID. This is chosen by the API partner and can be any string that
588
+ is a) unique to the user, and b) immutable for the user. It is recommended to
589
+ NOT use email addresses for this property because they are usually not
590
+ immutable.
589
591
 
590
592
  #### 🔄 Return<a id="🔄-return"></a>
591
593
 
@@ -619,8 +621,10 @@ p result
619
621
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
620
622
 
621
623
  ##### userId: `String`<a id="userid-string"></a>
622
- SnapTrade User ID. Provided by SnapTrade Partner. Can be any string, as long as
623
- it's unique to a user
624
+ SnapTrade User ID. This is chosen by the API partner and can be any string that
625
+ is a) unique to the user, and b) immutable for the user. It is recommended to
626
+ NOT use email addresses for this property because they are usually not
627
+ immutable.
624
628
 
625
629
  ##### userSecret: `String`<a id="usersecret-string"></a>
626
630
  SnapTrade User Secret randomly generated by SnapTrade. This should be considered
@@ -649,7 +653,7 @@ Returns a single brokerage authorization object for the specified ID.
649
653
  ```ruby
650
654
  result = snaptrade.connections.detail_brokerage_authorization(
651
655
  authorization_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
652
- user_id: "John.doe@snaptrade.com",
656
+ user_id: "snaptrade-user-123",
653
657
  user_secret: "USERSECRET123",
654
658
  )
655
659
  p result
@@ -683,7 +687,7 @@ Returns a list of Brokerage Authorization objects for the user
683
687
 
684
688
  ```ruby
685
689
  result = snaptrade.connections.list_brokerage_authorizations(
686
- user_id: "John.doe@snaptrade.com",
690
+ user_id: "snaptrade-user-123",
687
691
  user_secret: "USERSECRET123",
688
692
  )
689
693
  p result
@@ -715,7 +719,7 @@ Deletes a specified brokerage authorization given by the ID.
715
719
  ```ruby
716
720
  snaptrade.connections.remove_brokerage_authorization(
717
721
  authorization_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
718
- user_id: "John.doe@snaptrade.com",
722
+ user_id: "snaptrade-user-123",
719
723
  user_secret: "USERSECRET123",
720
724
  )
721
725
  ```
@@ -793,7 +797,7 @@ result = snaptrade.options.get_option_strategy(
793
797
  }
794
798
  ],
795
799
  strategy_type: "CUSTOM",
796
- user_id: "John.doe@snaptrade.com",
800
+ user_id: "snaptrade-user-123",
797
801
  user_secret: "USERSECRET123",
798
802
  account_id: "accountId_example",
799
803
  )
@@ -831,7 +835,7 @@ Returns the option chain for the specified symbol in the specified account.
831
835
 
832
836
  ```ruby
833
837
  result = snaptrade.options.get_options_chain(
834
- user_id: "John.doe@snaptrade.com",
838
+ user_id: "snaptrade-user-123",
835
839
  user_secret: "USERSECRET123",
836
840
  account_id: "accountId_example",
837
841
  symbol: "symbol_example",
@@ -871,7 +875,7 @@ Returns a Strategy Quotes object which has latest market data of the specified o
871
875
 
872
876
  ```ruby
873
877
  result = snaptrade.options.get_options_strategy_quote(
874
- user_id: "John.doe@snaptrade.com",
878
+ user_id: "snaptrade-user-123",
875
879
  user_secret: "USERSECRET123",
876
880
  account_id: "accountId_example",
877
881
  option_strategy_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
@@ -911,7 +915,7 @@ Returns a list of Options Positions.
911
915
 
912
916
  ```ruby
913
917
  result = snaptrade.options.list_option_holdings(
914
- user_id: "John.doe@snaptrade.com",
918
+ user_id: "snaptrade-user-123",
915
919
  user_secret: "USERSECRET123",
916
920
  account_id: "accountId_example",
917
921
  )
@@ -948,7 +952,7 @@ Places the option strategy order and returns the order record received from the
948
952
  result = snaptrade.options.place_option_strategy(
949
953
  order_type: "Limit",
950
954
  time_in_force: "FOK",
951
- user_id: "John.doe@snaptrade.com",
955
+ user_id: "snaptrade-user-123",
952
956
  user_secret: "USERSECRET123",
953
957
  account_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
954
958
  option_strategy_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
@@ -1270,7 +1274,7 @@ provided search string, matching on ticker and name.
1270
1274
 
1271
1275
  ```ruby
1272
1276
  result = snaptrade.reference_data.symbol_search_user_account(
1273
- user_id: "John.doe@snaptrade.com",
1277
+ user_id: "snaptrade-user-123",
1274
1278
  user_secret: "USERSECRET123",
1275
1279
  account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1276
1280
  substring: "apple",
@@ -1309,7 +1313,7 @@ This will only work if the order has not yet been executed.
1309
1313
 
1310
1314
  ```ruby
1311
1315
  result = snaptrade.trading.cancel_user_account_order(
1312
- user_id: "John.doe@snaptrade.com",
1316
+ user_id: "snaptrade-user-123",
1313
1317
  user_secret: "USERSECRET123",
1314
1318
  account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1315
1319
  brokerage_order_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
@@ -1346,7 +1350,7 @@ Return the trade object and it's impact on the account for the specified order.
1346
1350
 
1347
1351
  ```ruby
1348
1352
  result = snaptrade.trading.get_order_impact(
1349
- user_id: "John.doe@snaptrade.com",
1353
+ user_id: "snaptrade-user-123",
1350
1354
  user_secret: "USERSECRET123",
1351
1355
  account_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
1352
1356
  action: "BUY",
@@ -1406,7 +1410,7 @@ Returns live quote(s) from the brokerage for the specified symbol(s).
1406
1410
 
1407
1411
  ```ruby
1408
1412
  result = snaptrade.trading.get_user_account_quotes(
1409
- user_id: "John.doe@snaptrade.com",
1413
+ user_id: "snaptrade-user-123",
1410
1414
  user_secret: "USERSECRET123",
1411
1415
  symbols: "symbols_example",
1412
1416
  account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
@@ -1449,7 +1453,7 @@ Places a specified trade in the specified account.
1449
1453
 
1450
1454
  ```ruby
1451
1455
  result = snaptrade.trading.place_force_order(
1452
- user_id: "John.doe@snaptrade.com",
1456
+ user_id: "snaptrade-user-123",
1453
1457
  user_secret: "USERSECRET123",
1454
1458
  account_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
1455
1459
  action: "BUY",
@@ -1512,7 +1516,7 @@ returns the status of the order from the brokerage.
1512
1516
  ```ruby
1513
1517
  result = snaptrade.trading.place_order(
1514
1518
  trade_id: "tradeId_example",
1515
- user_id: "John.doe@snaptrade.com",
1519
+ user_id: "snaptrade-user-123",
1516
1520
  user_secret: "USERSECRET123",
1517
1521
  wait_to_confirm: true,
1518
1522
  )
@@ -1553,7 +1557,7 @@ Returns activities (transactions) for a user. Specifying start and end date is h
1553
1557
 
1554
1558
  ```ruby
1555
1559
  result = snaptrade.transactions_and_reporting.get_activities(
1556
- user_id: "John.doe@snaptrade.com",
1560
+ user_id: "snaptrade-user-123",
1557
1561
  user_secret: "USERSECRET123",
1558
1562
  start_date: "2022-01-24",
1559
1563
  end_date: "2022-01-24",
@@ -1612,7 +1616,7 @@ Returns performance information (contributions, dividends, rate of return, etc)
1612
1616
  result = snaptrade.transactions_and_reporting.get_reporting_custom_range(
1613
1617
  start_date: "2022-01-24",
1614
1618
  end_date: "2022-01-24",
1615
- user_id: "John.doe@snaptrade.com",
1619
+ user_id: "snaptrade-user-123",
1616
1620
  user_secret: "USERSECRET123",
1617
1621
  accounts: "917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2",
1618
1622
  detailed: true,
@@ -414,7 +414,7 @@ module SnapTrade
414
414
  # Registers a new SnapTrade user under your ClientID.
415
415
  # Most SnapTrade operations require a user to be passed as a parameter.
416
416
  #
417
- # @param user_id [String] SnapTrade User ID. Provided by SnapTrade Partner. Can be any string, as long as it's unique to a user
417
+ # @param user_id [String] SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
418
418
  # @param body [SnapTradeRegisterUserRequestBody]
419
419
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
420
420
  def register_snap_trade_user(user_id: SENTINEL, extra: {})
@@ -430,7 +430,7 @@ module SnapTrade
430
430
  # Registers a new SnapTrade user under your ClientID.
431
431
  # Most SnapTrade operations require a user to be passed as a parameter.
432
432
  #
433
- # @param user_id [String] SnapTrade User ID. Provided by SnapTrade Partner. Can be any string, as long as it's unique to a user
433
+ # @param user_id [String] SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
434
434
  # @param body [SnapTradeRegisterUserRequestBody]
435
435
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
436
436
  def register_snap_trade_user_with_http_info(user_id: SENTINEL, extra: {})
@@ -514,7 +514,7 @@ module SnapTrade
514
514
  # This API is used to generate a new secret for a SnapTrade user. You might use this if a userSecret
515
515
  # is comprimised or lost among other reasons.
516
516
  #
517
- # @param user_id [String] SnapTrade User ID. Provided by SnapTrade Partner. Can be any string, as long as it's unique to a user
517
+ # @param user_id [String] SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
518
518
  # @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.
519
519
  # @param body [UserIDandSecret]
520
520
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
@@ -532,7 +532,7 @@ module SnapTrade
532
532
  # This API is used to generate a new secret for a SnapTrade user. You might use this if a userSecret
533
533
  # is comprimised or lost among other reasons.
534
534
  #
535
- # @param user_id [String] SnapTrade User ID. Provided by SnapTrade Partner. Can be any string, as long as it's unique to a user
535
+ # @param user_id [String] SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
536
536
  # @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.
537
537
  # @param body [UserIDandSecret]
538
538
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
@@ -18,7 +18,7 @@ module SnapTrade
18
18
 
19
19
  attr_accessor :session_id
20
20
 
21
- # SnapTrade User ID. Provided by SnapTrade Partner. Can be any string, as long as it's unique to a user
21
+ # SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
22
22
  attr_accessor :user_id
23
23
 
24
24
  # Time
@@ -16,7 +16,7 @@ module SnapTrade
16
16
  # Delete status
17
17
  attr_accessor :status
18
18
 
19
- # SnapTrade User ID. Provided by SnapTrade Partner. Can be any string, as long as it's unique to a user
19
+ # SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
20
20
  attr_accessor :user_id
21
21
 
22
22
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -18,7 +18,7 @@ module SnapTrade
18
18
 
19
19
  attr_accessor :session_id
20
20
 
21
- # SnapTrade User ID. Provided by SnapTrade Partner. Can be any string, as long as it's unique to a user
21
+ # SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
22
22
  attr_accessor :user_id
23
23
 
24
24
  # Time
@@ -25,6 +25,8 @@ module SnapTrade
25
25
 
26
26
  attr_accessor :institution_name
27
27
 
28
+ attr_accessor :balance
29
+
28
30
  attr_accessor :meta
29
31
 
30
32
  attr_accessor :cash_restrictions
@@ -41,6 +43,7 @@ module SnapTrade
41
43
  :'name' => :'name',
42
44
  :'number' => :'number',
43
45
  :'institution_name' => :'institution_name',
46
+ :'balance' => :'balance',
44
47
  :'meta' => :'meta',
45
48
  :'cash_restrictions' => :'cash_restrictions',
46
49
  :'created_date' => :'created_date'
@@ -61,6 +64,7 @@ module SnapTrade
61
64
  :'name' => :'String',
62
65
  :'number' => :'String',
63
66
  :'institution_name' => :'String',
67
+ :'balance' => :'SnapTradeHoldingsAccountAccountIdBalance',
64
68
  :'meta' => :'Hash<String, Object>',
65
69
  :'cash_restrictions' => :'Array<CashRestriction>',
66
70
  :'created_date' => :'String'
@@ -71,6 +75,7 @@ module SnapTrade
71
75
  def self.openapi_nullable
72
76
  Set.new([
73
77
  :'name',
78
+ :'balance',
74
79
  ])
75
80
  end
76
81
 
@@ -113,6 +118,10 @@ module SnapTrade
113
118
  self.institution_name = attributes[:'institution_name']
114
119
  end
115
120
 
121
+ if attributes.key?(:'balance')
122
+ self.balance = attributes[:'balance']
123
+ end
124
+
116
125
  if attributes.key?(:'meta')
117
126
  if (value = attributes[:'meta']).is_a?(Hash)
118
127
  self.meta = value
@@ -154,6 +163,7 @@ module SnapTrade
154
163
  name == o.name &&
155
164
  number == o.number &&
156
165
  institution_name == o.institution_name &&
166
+ balance == o.balance &&
157
167
  meta == o.meta &&
158
168
  cash_restrictions == o.cash_restrictions &&
159
169
  created_date == o.created_date
@@ -168,7 +178,7 @@ module SnapTrade
168
178
  # Calculates hash code according to all attributes.
169
179
  # @return [Integer] Hash code
170
180
  def hash
171
- [id, brokerage_authorization, portfolio_group, name, number, institution_name, meta, cash_restrictions, created_date].hash
181
+ [id, brokerage_authorization, portfolio_group, name, number, institution_name, balance, meta, cash_restrictions, created_date].hash
172
182
  end
173
183
 
174
184
  # Builds the object from hash
@@ -0,0 +1,224 @@
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 SnapTradeHoldingsAccountAccountIdBalance
15
+ attr_accessor :total
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ :'total' => :'total'
21
+ }
22
+ end
23
+
24
+ # Returns all the JSON keys this model knows about
25
+ def self.acceptable_attributes
26
+ attribute_map.values
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.openapi_types
31
+ {
32
+ :'total' => :'AccountBalanceTotal'
33
+ }
34
+ end
35
+
36
+ # List of attributes with nullable: true
37
+ def self.openapi_nullable
38
+ Set.new([
39
+ :'total'
40
+ ])
41
+ end
42
+
43
+ # List of class defined in allOf (OpenAPI v3)
44
+ def self.openapi_all_of
45
+ [
46
+ :'AccountBalance'
47
+ ]
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::SnapTradeHoldingsAccountAccountIdBalance` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h|
59
+ if (!self.class.attribute_map.key?(k.to_sym))
60
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::SnapTradeHoldingsAccountAccountIdBalance`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ end
62
+ h[k.to_sym] = v
63
+ }
64
+
65
+ if attributes.key?(:'total')
66
+ self.total = attributes[:'total']
67
+ end
68
+ end
69
+
70
+ # Show invalid properties with the reasons. Usually used together with valid?
71
+ # @return Array for valid properties with the reasons
72
+ def list_invalid_properties
73
+ invalid_properties = Array.new
74
+ invalid_properties
75
+ end
76
+
77
+ # Check to see if the all the properties in the model are valid
78
+ # @return true if the model is valid
79
+ def valid?
80
+ true
81
+ end
82
+
83
+ # Checks equality by comparing each attribute.
84
+ # @param [Object] Object to be compared
85
+ def ==(o)
86
+ return true if self.equal?(o)
87
+ self.class == o.class &&
88
+ total == o.total
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Integer] Hash code
99
+ def hash
100
+ [total].hash
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def self.build_from_hash(attributes)
107
+ new.build_from_hash(attributes)
108
+ end
109
+
110
+ # Builds the object from hash
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ # @return [Object] Returns the model itself
113
+ def build_from_hash(attributes)
114
+ return nil unless attributes.is_a?(Hash)
115
+ attributes = attributes.transform_keys(&:to_sym)
116
+ self.class.openapi_types.each_pair do |key, type|
117
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
118
+ self.send("#{key}=", nil)
119
+ elsif type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
123
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
124
+ end
125
+ elsif !attributes[self.class.attribute_map[key]].nil?
126
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
127
+ end
128
+ end
129
+
130
+ self
131
+ end
132
+
133
+ # Deserializes the data based on type
134
+ # @param string type Data type
135
+ # @param string value Value to be deserialized
136
+ # @return [Object] Deserialized data
137
+ def _deserialize(type, value)
138
+ case type.to_sym
139
+ when :Time
140
+ Time.parse(value)
141
+ when :Date
142
+ Date.parse(value)
143
+ when :String
144
+ value.to_s
145
+ when :Integer
146
+ value.to_i
147
+ when :Float
148
+ value.to_f
149
+ when :Boolean
150
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
151
+ true
152
+ else
153
+ false
154
+ end
155
+ when :Object
156
+ # generic object (usually a Hash), return directly
157
+ value
158
+ when /\AArray<(?<inner_type>.+)>\z/
159
+ inner_type = Regexp.last_match[:inner_type]
160
+ value.map { |v| _deserialize(inner_type, v) }
161
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
162
+ k_type = Regexp.last_match[:k_type]
163
+ v_type = Regexp.last_match[:v_type]
164
+ {}.tap do |hash|
165
+ value.each do |k, v|
166
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
167
+ end
168
+ end
169
+ else # model
170
+ # models (e.g. Pet) or oneOf
171
+ klass = SnapTrade.const_get(type)
172
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
173
+ end
174
+ end
175
+
176
+ # Returns the string representation of the object
177
+ # @return [String] String presentation of the object
178
+ def to_s
179
+ to_hash.to_s
180
+ end
181
+
182
+ # to_body is an alias to to_hash (backward compatibility)
183
+ # @return [Hash] Returns the object in the form of hash
184
+ def to_body
185
+ to_hash
186
+ end
187
+
188
+ # Returns the object in the form of hash
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_hash
191
+ hash = {}
192
+ self.class.attribute_map.each_pair do |attr, param|
193
+ value = self.send(attr)
194
+ if value.nil?
195
+ is_nullable = self.class.openapi_nullable.include?(attr)
196
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
197
+ end
198
+
199
+ hash[param] = _to_hash(value)
200
+ end
201
+ hash
202
+ end
203
+
204
+ # Outputs non-array value in the form of hash
205
+ # For object, use to_hash. Otherwise, just return the value
206
+ # @param [Object] value Any valid value
207
+ # @return [Hash] Returns the value in the form of hash
208
+ def _to_hash(value)
209
+ if value.is_a?(Array)
210
+ value.compact.map { |v| _to_hash(v) }
211
+ elsif value.is_a?(Hash)
212
+ {}.tap do |hash|
213
+ value.each { |k, v| hash[k] = _to_hash(v) }
214
+ end
215
+ elsif value.respond_to? :to_hash
216
+ value.to_hash
217
+ else
218
+ value
219
+ end
220
+ end
221
+
222
+ end
223
+
224
+ end
@@ -13,7 +13,7 @@ require 'time'
13
13
  module SnapTrade
14
14
  # Data required to register a user via SnapTrade Partner
15
15
  class SnapTradeRegisterUserRequestBody
16
- # SnapTrade User ID. Provided by SnapTrade Partner. Can be any string, as long as it's unique to a user
16
+ # SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
17
17
  attr_accessor :user_id
18
18
 
19
19
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -13,7 +13,7 @@ require 'time'
13
13
  module SnapTrade
14
14
  # Response when register user is successful
15
15
  class UserIDandSecret
16
- # SnapTrade User ID. Provided by SnapTrade Partner. Can be any string, as long as it's unique to a user
16
+ # SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
17
17
  attr_accessor :user_id
18
18
 
19
19
  # 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.
@@ -8,5 +8,5 @@ Contact: api@snaptrade.com
8
8
  =end
9
9
 
10
10
  module SnapTrade
11
- VERSION = '2.0.20'
11
+ VERSION = '2.0.22'
12
12
  end
data/lib/snaptrade.rb CHANGED
@@ -111,6 +111,7 @@ require 'snaptrade/models/session_event_type'
111
111
  require 'snaptrade/models/snap_trade_api_disclaimer_accept_status'
112
112
  require 'snaptrade/models/snap_trade_holdings_account'
113
113
  require 'snaptrade/models/snap_trade_holdings_account_account_id'
114
+ require 'snaptrade/models/snap_trade_holdings_account_account_id_balance'
114
115
  require 'snaptrade/models/snap_trade_holdings_total_value'
115
116
  require 'snaptrade/models/snap_trade_login_user_request_body'
116
117
  require 'snaptrade/models/snap_trade_register_user_request_body'
@@ -0,0 +1,29 @@
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 'spec_helper'
11
+ require 'json'
12
+ require 'date'
13
+
14
+ # Unit tests for SnapTrade::SnapTradeHoldingsAccountAccountIdBalance
15
+ describe SnapTrade::SnapTradeHoldingsAccountAccountIdBalance do
16
+ let(:instance) { SnapTrade::SnapTradeHoldingsAccountAccountIdBalance.new }
17
+
18
+ describe 'test an instance of SnapTradeHoldingsAccountAccountIdBalance' do
19
+ it 'should create an instance of SnapTradeHoldingsAccountAccountIdBalance' do
20
+ expect(instance).to be_instance_of(SnapTrade::SnapTradeHoldingsAccountAccountIdBalance)
21
+ end
22
+ end
23
+ describe 'test attribute "total"' do
24
+ it 'should work' do
25
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
26
+ end
27
+ end
28
+
29
+ end
@@ -56,6 +56,12 @@ describe SnapTrade::SnapTradeHoldingsAccountAccountId do
56
56
  end
57
57
  end
58
58
 
59
+ describe 'test attribute "balance"' do
60
+ it 'should work' do
61
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
62
+ end
63
+ end
64
+
59
65
  describe 'test attribute "meta"' do
60
66
  it 'should work' do
61
67
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
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.20
4
+ version: 2.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - SnapTrade
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-24 00:00:00.000000000 Z
11
+ date: 2024-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -190,6 +190,7 @@ files:
190
190
  - lib/snaptrade/models/snap_trade_api_disclaimer_accept_status.rb
191
191
  - lib/snaptrade/models/snap_trade_holdings_account.rb
192
192
  - lib/snaptrade/models/snap_trade_holdings_account_account_id.rb
193
+ - lib/snaptrade/models/snap_trade_holdings_account_account_id_balance.rb
193
194
  - lib/snaptrade/models/snap_trade_holdings_total_value.rb
194
195
  - lib/snaptrade/models/snap_trade_login_user_request_body.rb
195
196
  - lib/snaptrade/models/snap_trade_register_user_request_body.rb
@@ -334,6 +335,7 @@ files:
334
335
  - spec/models/session_event_spec.rb
335
336
  - spec/models/session_event_type_spec.rb
336
337
  - spec/models/snap_trade_api_disclaimer_accept_status_spec.rb
338
+ - spec/models/snap_trade_holdings_account_account_id_balance_spec.rb
337
339
  - spec/models/snap_trade_holdings_account_account_id_spec.rb
338
340
  - spec/models/snap_trade_holdings_account_spec.rb
339
341
  - spec/models/snap_trade_holdings_total_value_spec.rb
@@ -543,6 +545,7 @@ test_files:
543
545
  - spec/models/brokerage_authorization_type_read_only_spec.rb
544
546
  - spec/models/symbols_quotes_inner_spec.rb
545
547
  - spec/models/dividend_at_date_spec.rb
548
+ - spec/models/snap_trade_holdings_account_account_id_balance_spec.rb
546
549
  - spec/models/past_value_spec.rb
547
550
  - spec/models/model_portfolio_spec.rb
548
551
  - spec/spec_helper.rb