snaptrade 3.0.48 → 3.0.50
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 +4 -4
- data/README.md +2 -2
- data/lib/snaptrade/models/annuity_account.rb +11 -1
- data/lib/snaptrade/models/connection_account_status.rb +39 -0
- data/lib/snaptrade/models/deposit_account.rb +11 -1
- data/lib/snaptrade/models/investment_account.rb +11 -1
- data/lib/snaptrade/models/line_of_credit_account.rb +11 -1
- data/lib/snaptrade/models/model404_account_unavailable_response.rb +222 -0
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +2 -0
- data/spec/models/annuity_account_spec.rb +6 -0
- data/spec/models/connection_account_status_spec.rb +23 -0
- data/spec/models/deposit_account_spec.rb +6 -0
- data/spec/models/investment_account_spec.rb +6 -0
- data/spec/models/line_of_credit_account_spec.rb +6 -0
- data/spec/models/model404_account_unavailable_response_spec.rb +29 -0
- metadata +283 -277
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4b5109788e9e31a37c04e7202c7f7889ab9db9ee36d76538f18a69638224869e
|
|
4
|
+
data.tar.gz: 1436b4c3401205d388b0781cd934ebf8dbf69a115afbf9a9944624393a3f396d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 031c6bc9bc6ab4f6d507a265c25808401ccf70da8bf8e5ec95d96f3da1cd633d3429b5f2745174c68c10f83376cd9a955849962e63426baf92e587d232953c79
|
|
7
|
+
data.tar.gz: e407d8115941865131e54b074fd29d446c811b0d1f77868a38885a0dae951fedcdda6400182f946db0c856187c6fc8fed2f977bb9fe7413a04a21530dc4f0a3f
|
data/README.md
CHANGED
|
@@ -63,7 +63,7 @@ backoff with jitter rather than from the headers.
|
|
|
63
63
|
See https://docs.snaptrade.com/docs/ratelimiting.
|
|
64
64
|
|
|
65
65
|
|
|
66
|
-
[](https://rubygems.org/gems/snaptrade/versions/3.0.50)
|
|
67
67
|
[](https://snaptrade.com/)
|
|
68
68
|
|
|
69
69
|
</div>
|
|
@@ -147,7 +147,7 @@ See https://docs.snaptrade.com/docs/ratelimiting.
|
|
|
147
147
|
Add to Gemfile:
|
|
148
148
|
|
|
149
149
|
```ruby
|
|
150
|
-
gem 'snaptrade', '~> 3.0.
|
|
150
|
+
gem 'snaptrade', '~> 3.0.50'
|
|
151
151
|
```
|
|
152
152
|
|
|
153
153
|
## Getting Started<a id="getting-started"></a>
|
|
@@ -22,6 +22,9 @@ module SnapTrade
|
|
|
22
22
|
# Unique identifier for the connection (brokerage_authorization_id). This is the UUID used to reference the connection in SnapTrade.
|
|
23
23
|
attr_accessor :connection_id
|
|
24
24
|
|
|
25
|
+
# The current status of the account. Omitted when the status is unknown or not provided by the institution. - `open`: The account is open. - `closed`: The account is closed. - `archived`: The account is archived. - `unavailable`: The account is no longer available through the institution's API. Accounts with this status are excluded from account list responses.
|
|
26
|
+
attr_accessor :status
|
|
27
|
+
|
|
25
28
|
# A display name for the account. Either assigned by the user or by the institution itself.
|
|
26
29
|
attr_accessor :display_name
|
|
27
30
|
|
|
@@ -50,6 +53,7 @@ module SnapTrade
|
|
|
50
53
|
:'kind' => :'kind',
|
|
51
54
|
:'id' => :'id',
|
|
52
55
|
:'connection_id' => :'connection_id',
|
|
56
|
+
:'status' => :'status',
|
|
53
57
|
:'display_name' => :'display_name',
|
|
54
58
|
:'masked_account_number' => :'masked_account_number',
|
|
55
59
|
:'institution_account_id' => :'institution_account_id',
|
|
@@ -72,6 +76,7 @@ module SnapTrade
|
|
|
72
76
|
:'kind' => :'AnnuityAccountKind',
|
|
73
77
|
:'id' => :'String',
|
|
74
78
|
:'connection_id' => :'String',
|
|
79
|
+
:'status' => :'ConnectionAccountStatus',
|
|
75
80
|
:'display_name' => :'String',
|
|
76
81
|
:'masked_account_number' => :'String',
|
|
77
82
|
:'institution_account_id' => :'String',
|
|
@@ -121,6 +126,10 @@ module SnapTrade
|
|
|
121
126
|
self.connection_id = attributes[:'connection_id']
|
|
122
127
|
end
|
|
123
128
|
|
|
129
|
+
if attributes.key?(:'status')
|
|
130
|
+
self.status = attributes[:'status']
|
|
131
|
+
end
|
|
132
|
+
|
|
124
133
|
if attributes.key?(:'display_name')
|
|
125
134
|
self.display_name = attributes[:'display_name']
|
|
126
135
|
end
|
|
@@ -200,6 +209,7 @@ module SnapTrade
|
|
|
200
209
|
kind == o.kind &&
|
|
201
210
|
id == o.id &&
|
|
202
211
|
connection_id == o.connection_id &&
|
|
212
|
+
status == o.status &&
|
|
203
213
|
display_name == o.display_name &&
|
|
204
214
|
masked_account_number == o.masked_account_number &&
|
|
205
215
|
institution_account_id == o.institution_account_id &&
|
|
@@ -219,7 +229,7 @@ module SnapTrade
|
|
|
219
229
|
# Calculates hash code according to all attributes.
|
|
220
230
|
# @return [Integer] Hash code
|
|
221
231
|
def hash
|
|
222
|
-
[kind, id, connection_id, display_name, masked_account_number, institution_account_id, institution_id, opening_date, sync_status, raw_type, net_value].hash
|
|
232
|
+
[kind, id, connection_id, status, display_name, masked_account_number, institution_account_id, institution_id, opening_date, sync_status, raw_type, net_value].hash
|
|
223
233
|
end
|
|
224
234
|
|
|
225
235
|
# Builds the object from hash
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#SnapTrade
|
|
3
|
+
|
|
4
|
+
#Connect brokerage accounts to your app for live positions and trading. ## Rate limiting Two limits apply to requests signed with your `clientId`. The stricter one wins, and exceeding either returns `429 Too Many Requests`. - **Customer-level** — 250 requests/minute by default, scoped to your `clientId` and applied across all endpoints. Reported in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. - **Account-level** — 10 requests/minute per account, scoped to (`clientId`, `accountId`). All covered operations for one account draw on the same bucket — reading balances and reading positions share it — and enforcement does not depend on the HTTP method, so updating an account consumes the same bucket as reading it. Only enforced for Personal users, and only for integrations it has been rolled out to — it is not yet in force for every Personal integration. It also does not apply on every operation that documents a 429 below. Where it applies it is reported in `X-RateLimit-Account-Limit`, `X-RateLimit-Account-Remaining` and `X-RateLimit-Account-Reset`. Do not read the absence of those headers as proof the limit is off — some configurations omit the rate limit headers while still enforcing the limit, so header absence tells you nothing about your allowance. On a 429, `X-RateLimit-Remaining: 0` means you hit the customer-level limit and `X-RateLimit-Account-Remaining: 0` means the account-level one. Wait for the corresponding `*-Reset` value (seconds) before retrying, or fall back to exponential backoff with jitter. Not every 429 is explained by those headers. A separate per-authenticated-user limit, reported in no `X-RateLimit-*` header, covers OAuth-authenticated requests and signed requests in configurations where the customer-level limit is not in effect — on the operations that use the default throttles. A few operations override those and are governed by the customer-level limit alone. The two do not stack: a signed request governed by the customer-level limit above is not additionally subject to the per-user one. If a 429 arrives with no header at zero — or with no `X-RateLimit-*` headers at all — honour `Retry-After` and back off. Treat the remaining counts as a hint, not a guarantee that the next request will succeed. Because the customer-level limit applies everywhere, any signed request can return 429. **OAuth-authenticated requests are an exception.** They are not subject to the customer-level limit and do not receive `X-RateLimit-Limit`, `X-RateLimit-Remaining` or `X-RateLimit-Reset` — do not wait on those headers or design around a customer-level allowance on this path. The account-level limit still applies to them on the account-data endpoints above, reported in the `X-RateLimit-Account-*` headers. On operations using the default throttles the per-user limit above applies to them as well, so an OAuth request can be rejected while the account headers still show capacity; on the few operations that override those throttles, OAuth callers have no per-user ceiling at all. Drive retries from `Retry-After` and exponential backoff with jitter rather than from the headers. See https://docs.snaptrade.com/docs/ratelimiting.
|
|
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 ConnectionAccountStatus
|
|
15
|
+
OPEN = "open".freeze
|
|
16
|
+
CLOSED = "closed".freeze
|
|
17
|
+
ARCHIVED = "archived".freeze
|
|
18
|
+
UNAVAILABLE = "unavailable".freeze
|
|
19
|
+
|
|
20
|
+
def self.all_vars
|
|
21
|
+
@all_vars ||= [OPEN, CLOSED, ARCHIVED, UNAVAILABLE].freeze
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Builds the enum from string
|
|
25
|
+
# @param [String] The enum value in the form of the string
|
|
26
|
+
# @return [String] The enum value
|
|
27
|
+
def self.build_from_hash(value)
|
|
28
|
+
new.build_from_hash(value)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Builds the enum from string
|
|
32
|
+
# @param [String] The enum value in the form of the string
|
|
33
|
+
# @return [String] The enum value
|
|
34
|
+
def build_from_hash(value)
|
|
35
|
+
return value if ConnectionAccountStatus.all_vars.include?(value)
|
|
36
|
+
raise "Invalid ENUM value #{value} for class #ConnectionAccountStatus"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -22,6 +22,9 @@ module SnapTrade
|
|
|
22
22
|
# Unique identifier for the connection (brokerage_authorization_id). This is the UUID used to reference the connection in SnapTrade.
|
|
23
23
|
attr_accessor :connection_id
|
|
24
24
|
|
|
25
|
+
# The current status of the account. Omitted when the status is unknown or not provided by the institution. - `open`: The account is open. - `closed`: The account is closed. - `archived`: The account is archived. - `unavailable`: The account is no longer available through the institution's API. Accounts with this status are excluded from account list responses.
|
|
26
|
+
attr_accessor :status
|
|
27
|
+
|
|
25
28
|
# A display name for the account. Either assigned by the user or by the institution itself.
|
|
26
29
|
attr_accessor :display_name
|
|
27
30
|
|
|
@@ -50,6 +53,7 @@ module SnapTrade
|
|
|
50
53
|
:'kind' => :'kind',
|
|
51
54
|
:'id' => :'id',
|
|
52
55
|
:'connection_id' => :'connection_id',
|
|
56
|
+
:'status' => :'status',
|
|
53
57
|
:'display_name' => :'display_name',
|
|
54
58
|
:'masked_account_number' => :'masked_account_number',
|
|
55
59
|
:'institution_account_id' => :'institution_account_id',
|
|
@@ -72,6 +76,7 @@ module SnapTrade
|
|
|
72
76
|
:'kind' => :'DepositAccountKind',
|
|
73
77
|
:'id' => :'String',
|
|
74
78
|
:'connection_id' => :'String',
|
|
79
|
+
:'status' => :'ConnectionAccountStatus',
|
|
75
80
|
:'display_name' => :'String',
|
|
76
81
|
:'masked_account_number' => :'String',
|
|
77
82
|
:'institution_account_id' => :'String',
|
|
@@ -121,6 +126,10 @@ module SnapTrade
|
|
|
121
126
|
self.connection_id = attributes[:'connection_id']
|
|
122
127
|
end
|
|
123
128
|
|
|
129
|
+
if attributes.key?(:'status')
|
|
130
|
+
self.status = attributes[:'status']
|
|
131
|
+
end
|
|
132
|
+
|
|
124
133
|
if attributes.key?(:'display_name')
|
|
125
134
|
self.display_name = attributes[:'display_name']
|
|
126
135
|
end
|
|
@@ -200,6 +209,7 @@ module SnapTrade
|
|
|
200
209
|
kind == o.kind &&
|
|
201
210
|
id == o.id &&
|
|
202
211
|
connection_id == o.connection_id &&
|
|
212
|
+
status == o.status &&
|
|
203
213
|
display_name == o.display_name &&
|
|
204
214
|
masked_account_number == o.masked_account_number &&
|
|
205
215
|
institution_account_id == o.institution_account_id &&
|
|
@@ -219,7 +229,7 @@ module SnapTrade
|
|
|
219
229
|
# Calculates hash code according to all attributes.
|
|
220
230
|
# @return [Integer] Hash code
|
|
221
231
|
def hash
|
|
222
|
-
[kind, id, connection_id, display_name, masked_account_number, institution_account_id, institution_id, opening_date, sync_status, raw_type, net_value].hash
|
|
232
|
+
[kind, id, connection_id, status, display_name, masked_account_number, institution_account_id, institution_id, opening_date, sync_status, raw_type, net_value].hash
|
|
223
233
|
end
|
|
224
234
|
|
|
225
235
|
# Builds the object from hash
|
|
@@ -22,6 +22,9 @@ module SnapTrade
|
|
|
22
22
|
# Unique identifier for the connection (brokerage_authorization_id). This is the UUID used to reference the connection in SnapTrade.
|
|
23
23
|
attr_accessor :connection_id
|
|
24
24
|
|
|
25
|
+
# The current status of the account. Omitted when the status is unknown or not provided by the institution. - `open`: The account is open. - `closed`: The account is closed. - `archived`: The account is archived. - `unavailable`: The account is no longer available through the institution's API. Accounts with this status are excluded from account list responses.
|
|
26
|
+
attr_accessor :status
|
|
27
|
+
|
|
25
28
|
# A display name for the account. Either assigned by the user or by the institution itself.
|
|
26
29
|
attr_accessor :display_name
|
|
27
30
|
|
|
@@ -59,6 +62,7 @@ module SnapTrade
|
|
|
59
62
|
:'kind' => :'kind',
|
|
60
63
|
:'id' => :'id',
|
|
61
64
|
:'connection_id' => :'connection_id',
|
|
65
|
+
:'status' => :'status',
|
|
62
66
|
:'display_name' => :'display_name',
|
|
63
67
|
:'masked_account_number' => :'masked_account_number',
|
|
64
68
|
:'institution_account_id' => :'institution_account_id',
|
|
@@ -84,6 +88,7 @@ module SnapTrade
|
|
|
84
88
|
:'kind' => :'Kind',
|
|
85
89
|
:'id' => :'String',
|
|
86
90
|
:'connection_id' => :'String',
|
|
91
|
+
:'status' => :'ConnectionAccountStatus',
|
|
87
92
|
:'display_name' => :'String',
|
|
88
93
|
:'masked_account_number' => :'String',
|
|
89
94
|
:'institution_account_id' => :'String',
|
|
@@ -137,6 +142,10 @@ module SnapTrade
|
|
|
137
142
|
self.connection_id = attributes[:'connection_id']
|
|
138
143
|
end
|
|
139
144
|
|
|
145
|
+
if attributes.key?(:'status')
|
|
146
|
+
self.status = attributes[:'status']
|
|
147
|
+
end
|
|
148
|
+
|
|
140
149
|
if attributes.key?(:'display_name')
|
|
141
150
|
self.display_name = attributes[:'display_name']
|
|
142
151
|
end
|
|
@@ -233,6 +242,7 @@ module SnapTrade
|
|
|
233
242
|
kind == o.kind &&
|
|
234
243
|
id == o.id &&
|
|
235
244
|
connection_id == o.connection_id &&
|
|
245
|
+
status == o.status &&
|
|
236
246
|
display_name == o.display_name &&
|
|
237
247
|
masked_account_number == o.masked_account_number &&
|
|
238
248
|
institution_account_id == o.institution_account_id &&
|
|
@@ -255,7 +265,7 @@ module SnapTrade
|
|
|
255
265
|
# Calculates hash code according to all attributes.
|
|
256
266
|
# @return [Integer] Hash code
|
|
257
267
|
def hash
|
|
258
|
-
[kind, id, connection_id, display_name, masked_account_number, institution_account_id, institution_id, opening_date, funding_date, sync_status, raw_type, cash_or_margin, is_paper, net_value].hash
|
|
268
|
+
[kind, id, connection_id, status, display_name, masked_account_number, institution_account_id, institution_id, opening_date, funding_date, sync_status, raw_type, cash_or_margin, is_paper, net_value].hash
|
|
259
269
|
end
|
|
260
270
|
|
|
261
271
|
# Builds the object from hash
|
|
@@ -22,6 +22,9 @@ module SnapTrade
|
|
|
22
22
|
# Unique identifier for the connection (brokerage_authorization_id). This is the UUID used to reference the connection in SnapTrade.
|
|
23
23
|
attr_accessor :connection_id
|
|
24
24
|
|
|
25
|
+
# The current status of the account. Omitted when the status is unknown or not provided by the institution. - `open`: The account is open. - `closed`: The account is closed. - `archived`: The account is archived. - `unavailable`: The account is no longer available through the institution's API. Accounts with this status are excluded from account list responses.
|
|
26
|
+
attr_accessor :status
|
|
27
|
+
|
|
25
28
|
# A display name for the account. Either assigned by the user or by the institution itself.
|
|
26
29
|
attr_accessor :display_name
|
|
27
30
|
|
|
@@ -57,6 +60,7 @@ module SnapTrade
|
|
|
57
60
|
:'kind' => :'kind',
|
|
58
61
|
:'id' => :'id',
|
|
59
62
|
:'connection_id' => :'connection_id',
|
|
63
|
+
:'status' => :'status',
|
|
60
64
|
:'display_name' => :'display_name',
|
|
61
65
|
:'masked_account_number' => :'masked_account_number',
|
|
62
66
|
:'institution_account_id' => :'institution_account_id',
|
|
@@ -82,6 +86,7 @@ module SnapTrade
|
|
|
82
86
|
:'kind' => :'LineOfCreditAccountKind',
|
|
83
87
|
:'id' => :'String',
|
|
84
88
|
:'connection_id' => :'String',
|
|
89
|
+
:'status' => :'ConnectionAccountStatus',
|
|
85
90
|
:'display_name' => :'String',
|
|
86
91
|
:'masked_account_number' => :'String',
|
|
87
92
|
:'institution_account_id' => :'String',
|
|
@@ -137,6 +142,10 @@ module SnapTrade
|
|
|
137
142
|
self.connection_id = attributes[:'connection_id']
|
|
138
143
|
end
|
|
139
144
|
|
|
145
|
+
if attributes.key?(:'status')
|
|
146
|
+
self.status = attributes[:'status']
|
|
147
|
+
end
|
|
148
|
+
|
|
140
149
|
if attributes.key?(:'display_name')
|
|
141
150
|
self.display_name = attributes[:'display_name']
|
|
142
151
|
end
|
|
@@ -228,6 +237,7 @@ module SnapTrade
|
|
|
228
237
|
kind == o.kind &&
|
|
229
238
|
id == o.id &&
|
|
230
239
|
connection_id == o.connection_id &&
|
|
240
|
+
status == o.status &&
|
|
231
241
|
display_name == o.display_name &&
|
|
232
242
|
masked_account_number == o.masked_account_number &&
|
|
233
243
|
institution_account_id == o.institution_account_id &&
|
|
@@ -250,7 +260,7 @@ module SnapTrade
|
|
|
250
260
|
# Calculates hash code according to all attributes.
|
|
251
261
|
# @return [Integer] Hash code
|
|
252
262
|
def hash
|
|
253
|
-
[kind, id, connection_id, display_name, masked_account_number, institution_account_id, institution_id, opening_date, sync_status, raw_type, net_value, minimum_payment_amount, available_credit, next_payment_date].hash
|
|
263
|
+
[kind, id, connection_id, status, display_name, masked_account_number, institution_account_id, institution_id, opening_date, sync_status, raw_type, net_value, minimum_payment_amount, available_credit, next_payment_date].hash
|
|
254
264
|
end
|
|
255
265
|
|
|
256
266
|
# Builds the object from hash
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#SnapTrade
|
|
3
|
+
|
|
4
|
+
#Connect brokerage accounts to your app for live positions and trading. ## Rate limiting Two limits apply to requests signed with your `clientId`. The stricter one wins, and exceeding either returns `429 Too Many Requests`. - **Customer-level** — 250 requests/minute by default, scoped to your `clientId` and applied across all endpoints. Reported in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. - **Account-level** — 10 requests/minute per account, scoped to (`clientId`, `accountId`). All covered operations for one account draw on the same bucket — reading balances and reading positions share it — and enforcement does not depend on the HTTP method, so updating an account consumes the same bucket as reading it. Only enforced for Personal users, and only for integrations it has been rolled out to — it is not yet in force for every Personal integration. It also does not apply on every operation that documents a 429 below. Where it applies it is reported in `X-RateLimit-Account-Limit`, `X-RateLimit-Account-Remaining` and `X-RateLimit-Account-Reset`. Do not read the absence of those headers as proof the limit is off — some configurations omit the rate limit headers while still enforcing the limit, so header absence tells you nothing about your allowance. On a 429, `X-RateLimit-Remaining: 0` means you hit the customer-level limit and `X-RateLimit-Account-Remaining: 0` means the account-level one. Wait for the corresponding `*-Reset` value (seconds) before retrying, or fall back to exponential backoff with jitter. Not every 429 is explained by those headers. A separate per-authenticated-user limit, reported in no `X-RateLimit-*` header, covers OAuth-authenticated requests and signed requests in configurations where the customer-level limit is not in effect — on the operations that use the default throttles. A few operations override those and are governed by the customer-level limit alone. The two do not stack: a signed request governed by the customer-level limit above is not additionally subject to the per-user one. If a 429 arrives with no header at zero — or with no `X-RateLimit-*` headers at all — honour `Retry-After` and back off. Treat the remaining counts as a hint, not a guarantee that the next request will succeed. Because the customer-level limit applies everywhere, any signed request can return 429. **OAuth-authenticated requests are an exception.** They are not subject to the customer-level limit and do not receive `X-RateLimit-Limit`, `X-RateLimit-Remaining` or `X-RateLimit-Reset` — do not wait on those headers or design around a customer-level allowance on this path. The account-level limit still applies to them on the account-data endpoints above, reported in the `X-RateLimit-Account-*` headers. On operations using the default throttles the per-user limit above applies to them as well, so an OAuth request can be rejected while the account headers still show capacity; on the few operations that override those throttles, OAuth callers have no per-user ceiling at all. Drive retries from `Retry-After` and exponential backoff with jitter rather than from the headers. See https://docs.snaptrade.com/docs/ratelimiting.
|
|
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
|
+
# The account is unavailable over the brokerage API
|
|
15
|
+
class Model404AccountUnavailableResponse
|
|
16
|
+
attr_accessor :error
|
|
17
|
+
|
|
18
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
19
|
+
def self.attribute_map
|
|
20
|
+
{
|
|
21
|
+
:'error' => :'error'
|
|
22
|
+
}
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Returns all the JSON keys this model knows about
|
|
26
|
+
def self.acceptable_attributes
|
|
27
|
+
attribute_map.values
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Attribute type mapping.
|
|
31
|
+
def self.openapi_types
|
|
32
|
+
{
|
|
33
|
+
:'error' => :'String'
|
|
34
|
+
}
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# List of attributes with nullable: true
|
|
38
|
+
def self.openapi_nullable
|
|
39
|
+
Set.new([
|
|
40
|
+
])
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Initializes the object
|
|
44
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
45
|
+
def initialize(attributes = {})
|
|
46
|
+
if (!attributes.is_a?(Hash))
|
|
47
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::Model404AccountUnavailableResponse` initialize method"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
51
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
52
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
53
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::Model404AccountUnavailableResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
54
|
+
end
|
|
55
|
+
h[k.to_sym] = v
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if attributes.key?(:'error')
|
|
59
|
+
self.error = attributes[:'error']
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
64
|
+
# @return Array for valid properties with the reasons
|
|
65
|
+
def list_invalid_properties
|
|
66
|
+
invalid_properties = Array.new
|
|
67
|
+
if @error.nil?
|
|
68
|
+
invalid_properties.push('invalid value for "error", error cannot be nil.')
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
invalid_properties
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Check to see if the all the properties in the model are valid
|
|
75
|
+
# @return true if the model is valid
|
|
76
|
+
def valid?
|
|
77
|
+
return false if @error.nil?
|
|
78
|
+
true
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Checks equality by comparing each attribute.
|
|
82
|
+
# @param [Object] Object to be compared
|
|
83
|
+
def ==(o)
|
|
84
|
+
return true if self.equal?(o)
|
|
85
|
+
self.class == o.class &&
|
|
86
|
+
error == o.error
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# @see the `==` method
|
|
90
|
+
# @param [Object] Object to be compared
|
|
91
|
+
def eql?(o)
|
|
92
|
+
self == o
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Calculates hash code according to all attributes.
|
|
96
|
+
# @return [Integer] Hash code
|
|
97
|
+
def hash
|
|
98
|
+
[error].hash
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Builds the object from hash
|
|
102
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
103
|
+
# @return [Object] Returns the model itself
|
|
104
|
+
def self.build_from_hash(attributes)
|
|
105
|
+
new.build_from_hash(attributes)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Builds the object from hash
|
|
109
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
110
|
+
# @return [Object] Returns the model itself
|
|
111
|
+
def build_from_hash(attributes)
|
|
112
|
+
return nil unless attributes.is_a?(Hash)
|
|
113
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
114
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
115
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
116
|
+
self.send("#{key}=", nil)
|
|
117
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
118
|
+
# check to ensure the input is an array given that the attribute
|
|
119
|
+
# is documented as an array but the input is not
|
|
120
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
121
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
122
|
+
end
|
|
123
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
124
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
self
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Deserializes the data based on type
|
|
132
|
+
# @param string type Data type
|
|
133
|
+
# @param string value Value to be deserialized
|
|
134
|
+
# @return [Object] Deserialized data
|
|
135
|
+
def _deserialize(type, value)
|
|
136
|
+
case type.to_sym
|
|
137
|
+
when :Time
|
|
138
|
+
Time.parse(value)
|
|
139
|
+
when :Date
|
|
140
|
+
Date.parse(value)
|
|
141
|
+
when :String
|
|
142
|
+
value.to_s
|
|
143
|
+
when :Integer
|
|
144
|
+
value.to_i
|
|
145
|
+
when :Float
|
|
146
|
+
value.to_f
|
|
147
|
+
when :Boolean
|
|
148
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
149
|
+
true
|
|
150
|
+
else
|
|
151
|
+
false
|
|
152
|
+
end
|
|
153
|
+
when :Object
|
|
154
|
+
# generic object (usually a Hash), return directly
|
|
155
|
+
value
|
|
156
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
157
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
158
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
159
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
160
|
+
k_type = Regexp.last_match[:k_type]
|
|
161
|
+
v_type = Regexp.last_match[:v_type]
|
|
162
|
+
{}.tap do |hash|
|
|
163
|
+
value.each do |k, v|
|
|
164
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
else # model
|
|
168
|
+
# models (e.g. Pet) or oneOf
|
|
169
|
+
klass = SnapTrade.const_get(type)
|
|
170
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Returns the string representation of the object
|
|
175
|
+
# @return [String] String presentation of the object
|
|
176
|
+
def to_s
|
|
177
|
+
to_hash.to_s
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
181
|
+
# @return [Hash] Returns the object in the form of hash
|
|
182
|
+
def to_body
|
|
183
|
+
to_hash
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
# Returns the object in the form of hash
|
|
187
|
+
# @return [Hash] Returns the object in the form of hash
|
|
188
|
+
def to_hash
|
|
189
|
+
hash = {}
|
|
190
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
191
|
+
value = self.send(attr)
|
|
192
|
+
if value.nil?
|
|
193
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
194
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
hash[param] = _to_hash(value)
|
|
198
|
+
end
|
|
199
|
+
hash
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
# Outputs non-array value in the form of hash
|
|
203
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
204
|
+
# @param [Object] value Any valid value
|
|
205
|
+
# @return [Hash] Returns the value in the form of hash
|
|
206
|
+
def _to_hash(value)
|
|
207
|
+
if value.is_a?(Array)
|
|
208
|
+
value.compact.map { |v| _to_hash(v) }
|
|
209
|
+
elsif value.is_a?(Hash)
|
|
210
|
+
{}.tap do |hash|
|
|
211
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
212
|
+
end
|
|
213
|
+
elsif value.respond_to? :to_hash
|
|
214
|
+
value.to_hash
|
|
215
|
+
else
|
|
216
|
+
value
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
end
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
|
@@ -106,6 +106,7 @@ require 'snaptrade/models/complex_order_response'
|
|
|
106
106
|
require 'snaptrade/models/complex_order_response_type'
|
|
107
107
|
require 'snaptrade/models/connected_asset_partner_stats'
|
|
108
108
|
require 'snaptrade/models/connection_account'
|
|
109
|
+
require 'snaptrade/models/connection_account_status'
|
|
109
110
|
require 'snaptrade/models/connection_account_sync_status'
|
|
110
111
|
require 'snaptrade/models/connection_accounts_response'
|
|
111
112
|
require 'snaptrade/models/connection_portal_version'
|
|
@@ -185,6 +186,7 @@ require 'snaptrade/models/model402_brokerage_auth_already_disabled_exception'
|
|
|
185
186
|
require 'snaptrade/models/model402_brokerage_auth_disabled_response'
|
|
186
187
|
require 'snaptrade/models/model403_failed_request_response'
|
|
187
188
|
require 'snaptrade/models/model403_feature_not_enabled_response'
|
|
189
|
+
require 'snaptrade/models/model404_account_unavailable_response'
|
|
188
190
|
require 'snaptrade/models/model404_failed_request_response'
|
|
189
191
|
require 'snaptrade/models/model425_failed_request_response'
|
|
190
192
|
require 'snaptrade/models/model429_too_many_requests_response'
|
|
@@ -38,6 +38,12 @@ describe SnapTrade::AnnuityAccount do
|
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
+
describe 'test attribute "status"' do
|
|
42
|
+
it 'should work' do
|
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
41
47
|
describe 'test attribute "display_name"' do
|
|
42
48
|
it 'should work' do
|
|
43
49
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#SnapTrade
|
|
3
|
+
|
|
4
|
+
#Connect brokerage accounts to your app for live positions and trading. ## Rate limiting Two limits apply to requests signed with your `clientId`. The stricter one wins, and exceeding either returns `429 Too Many Requests`. - **Customer-level** — 250 requests/minute by default, scoped to your `clientId` and applied across all endpoints. Reported in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. - **Account-level** — 10 requests/minute per account, scoped to (`clientId`, `accountId`). All covered operations for one account draw on the same bucket — reading balances and reading positions share it — and enforcement does not depend on the HTTP method, so updating an account consumes the same bucket as reading it. Only enforced for Personal users, and only for integrations it has been rolled out to — it is not yet in force for every Personal integration. It also does not apply on every operation that documents a 429 below. Where it applies it is reported in `X-RateLimit-Account-Limit`, `X-RateLimit-Account-Remaining` and `X-RateLimit-Account-Reset`. Do not read the absence of those headers as proof the limit is off — some configurations omit the rate limit headers while still enforcing the limit, so header absence tells you nothing about your allowance. On a 429, `X-RateLimit-Remaining: 0` means you hit the customer-level limit and `X-RateLimit-Account-Remaining: 0` means the account-level one. Wait for the corresponding `*-Reset` value (seconds) before retrying, or fall back to exponential backoff with jitter. Not every 429 is explained by those headers. A separate per-authenticated-user limit, reported in no `X-RateLimit-*` header, covers OAuth-authenticated requests and signed requests in configurations where the customer-level limit is not in effect — on the operations that use the default throttles. A few operations override those and are governed by the customer-level limit alone. The two do not stack: a signed request governed by the customer-level limit above is not additionally subject to the per-user one. If a 429 arrives with no header at zero — or with no `X-RateLimit-*` headers at all — honour `Retry-After` and back off. Treat the remaining counts as a hint, not a guarantee that the next request will succeed. Because the customer-level limit applies everywhere, any signed request can return 429. **OAuth-authenticated requests are an exception.** They are not subject to the customer-level limit and do not receive `X-RateLimit-Limit`, `X-RateLimit-Remaining` or `X-RateLimit-Reset` — do not wait on those headers or design around a customer-level allowance on this path. The account-level limit still applies to them on the account-data endpoints above, reported in the `X-RateLimit-Account-*` headers. On operations using the default throttles the per-user limit above applies to them as well, so an OAuth request can be rejected while the account headers still show capacity; on the few operations that override those throttles, OAuth callers have no per-user ceiling at all. Drive retries from `Retry-After` and exponential backoff with jitter rather than from the headers. See https://docs.snaptrade.com/docs/ratelimiting.
|
|
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::ConnectionAccountStatus
|
|
15
|
+
describe SnapTrade::ConnectionAccountStatus do
|
|
16
|
+
let(:instance) { SnapTrade::ConnectionAccountStatus.new }
|
|
17
|
+
|
|
18
|
+
describe 'test an instance of ConnectionAccountStatus' do
|
|
19
|
+
it 'should create an instance of ConnectionAccountStatus' do
|
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::ConnectionAccountStatus)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -38,6 +38,12 @@ describe SnapTrade::DepositAccount do
|
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
+
describe 'test attribute "status"' do
|
|
42
|
+
it 'should work' do
|
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
41
47
|
describe 'test attribute "display_name"' do
|
|
42
48
|
it 'should work' do
|
|
43
49
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
@@ -38,6 +38,12 @@ describe SnapTrade::InvestmentAccount do
|
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
+
describe 'test attribute "status"' do
|
|
42
|
+
it 'should work' do
|
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
41
47
|
describe 'test attribute "display_name"' do
|
|
42
48
|
it 'should work' do
|
|
43
49
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
@@ -38,6 +38,12 @@ describe SnapTrade::LineOfCreditAccount do
|
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
+
describe 'test attribute "status"' do
|
|
42
|
+
it 'should work' do
|
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
41
47
|
describe 'test attribute "display_name"' do
|
|
42
48
|
it 'should work' do
|
|
43
49
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#SnapTrade
|
|
3
|
+
|
|
4
|
+
#Connect brokerage accounts to your app for live positions and trading. ## Rate limiting Two limits apply to requests signed with your `clientId`. The stricter one wins, and exceeding either returns `429 Too Many Requests`. - **Customer-level** — 250 requests/minute by default, scoped to your `clientId` and applied across all endpoints. Reported in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. - **Account-level** — 10 requests/minute per account, scoped to (`clientId`, `accountId`). All covered operations for one account draw on the same bucket — reading balances and reading positions share it — and enforcement does not depend on the HTTP method, so updating an account consumes the same bucket as reading it. Only enforced for Personal users, and only for integrations it has been rolled out to — it is not yet in force for every Personal integration. It also does not apply on every operation that documents a 429 below. Where it applies it is reported in `X-RateLimit-Account-Limit`, `X-RateLimit-Account-Remaining` and `X-RateLimit-Account-Reset`. Do not read the absence of those headers as proof the limit is off — some configurations omit the rate limit headers while still enforcing the limit, so header absence tells you nothing about your allowance. On a 429, `X-RateLimit-Remaining: 0` means you hit the customer-level limit and `X-RateLimit-Account-Remaining: 0` means the account-level one. Wait for the corresponding `*-Reset` value (seconds) before retrying, or fall back to exponential backoff with jitter. Not every 429 is explained by those headers. A separate per-authenticated-user limit, reported in no `X-RateLimit-*` header, covers OAuth-authenticated requests and signed requests in configurations where the customer-level limit is not in effect — on the operations that use the default throttles. A few operations override those and are governed by the customer-level limit alone. The two do not stack: a signed request governed by the customer-level limit above is not additionally subject to the per-user one. If a 429 arrives with no header at zero — or with no `X-RateLimit-*` headers at all — honour `Retry-After` and back off. Treat the remaining counts as a hint, not a guarantee that the next request will succeed. Because the customer-level limit applies everywhere, any signed request can return 429. **OAuth-authenticated requests are an exception.** They are not subject to the customer-level limit and do not receive `X-RateLimit-Limit`, `X-RateLimit-Remaining` or `X-RateLimit-Reset` — do not wait on those headers or design around a customer-level allowance on this path. The account-level limit still applies to them on the account-data endpoints above, reported in the `X-RateLimit-Account-*` headers. On operations using the default throttles the per-user limit above applies to them as well, so an OAuth request can be rejected while the account headers still show capacity; on the few operations that override those throttles, OAuth callers have no per-user ceiling at all. Drive retries from `Retry-After` and exponential backoff with jitter rather than from the headers. See https://docs.snaptrade.com/docs/ratelimiting.
|
|
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::Model404AccountUnavailableResponse
|
|
15
|
+
describe SnapTrade::Model404AccountUnavailableResponse do
|
|
16
|
+
let(:instance) { SnapTrade::Model404AccountUnavailableResponse.new }
|
|
17
|
+
|
|
18
|
+
describe 'test an instance of Model404AccountUnavailableResponse' do
|
|
19
|
+
it 'should create an instance of Model404AccountUnavailableResponse' do
|
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::Model404AccountUnavailableResponse)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
describe 'test attribute "error"' 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
|