snaptrade 3.0.37 → 3.0.39

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.
@@ -0,0 +1,238 @@
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
+ # Example for a response that failed because exchange rates for the requested currency are unavailable
15
+ class Model503CurrencyConversionUnavailableResponse
16
+ attr_accessor :detail
17
+
18
+ attr_accessor :status_code
19
+
20
+ attr_accessor :code
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'detail' => :'detail',
26
+ :'status_code' => :'status_code',
27
+ :'code' => :'code'
28
+ }
29
+ end
30
+
31
+ # Returns all the JSON keys this model knows about
32
+ def self.acceptable_attributes
33
+ attribute_map.values
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.openapi_types
38
+ {
39
+ :'detail' => :'Object',
40
+ :'status_code' => :'Object',
41
+ :'code' => :'Object'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ :'detail',
49
+ :'status_code',
50
+ :'code'
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::Model503CurrencyConversionUnavailableResponse` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}) { |(k, v), h|
63
+ if (!self.class.attribute_map.key?(k.to_sym))
64
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::Model503CurrencyConversionUnavailableResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
+ end
66
+ h[k.to_sym] = v
67
+ }
68
+
69
+ if attributes.key?(:'detail')
70
+ self.detail = attributes[:'detail']
71
+ end
72
+
73
+ if attributes.key?(:'status_code')
74
+ self.status_code = attributes[:'status_code']
75
+ end
76
+
77
+ if attributes.key?(:'code')
78
+ self.code = attributes[:'code']
79
+ end
80
+ end
81
+
82
+ # Show invalid properties with the reasons. Usually used together with valid?
83
+ # @return Array for valid properties with the reasons
84
+ def list_invalid_properties
85
+ invalid_properties = Array.new
86
+ invalid_properties
87
+ end
88
+
89
+ # Check to see if the all the properties in the model are valid
90
+ # @return true if the model is valid
91
+ def valid?
92
+ true
93
+ end
94
+
95
+ # Checks equality by comparing each attribute.
96
+ # @param [Object] Object to be compared
97
+ def ==(o)
98
+ return true if self.equal?(o)
99
+ self.class == o.class &&
100
+ detail == o.detail &&
101
+ status_code == o.status_code &&
102
+ code == o.code
103
+ end
104
+
105
+ # @see the `==` method
106
+ # @param [Object] Object to be compared
107
+ def eql?(o)
108
+ self == o
109
+ end
110
+
111
+ # Calculates hash code according to all attributes.
112
+ # @return [Integer] Hash code
113
+ def hash
114
+ [detail, status_code, code].hash
115
+ end
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def self.build_from_hash(attributes)
121
+ new.build_from_hash(attributes)
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ attributes = attributes.transform_keys(&:to_sym)
130
+ self.class.openapi_types.each_pair do |key, type|
131
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
132
+ self.send("#{key}=", nil)
133
+ elsif type =~ /\AArray<(.*)>/i
134
+ # check to ensure the input is an array given that the attribute
135
+ # is documented as an array but the input is not
136
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
137
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
138
+ end
139
+ elsif !attributes[self.class.attribute_map[key]].nil?
140
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
141
+ end
142
+ end
143
+
144
+ self
145
+ end
146
+
147
+ # Deserializes the data based on type
148
+ # @param string type Data type
149
+ # @param string value Value to be deserialized
150
+ # @return [Object] Deserialized data
151
+ def _deserialize(type, value)
152
+ case type.to_sym
153
+ when :Time
154
+ Time.parse(value)
155
+ when :Date
156
+ Date.parse(value)
157
+ when :String
158
+ value.to_s
159
+ when :Integer
160
+ value.to_i
161
+ when :Float
162
+ value.to_f
163
+ when :Boolean
164
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
165
+ true
166
+ else
167
+ false
168
+ end
169
+ when :Object
170
+ # generic object (usually a Hash), return directly
171
+ value
172
+ when /\AArray<(?<inner_type>.+)>\z/
173
+ inner_type = Regexp.last_match[:inner_type]
174
+ value.map { |v| _deserialize(inner_type, v) }
175
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
176
+ k_type = Regexp.last_match[:k_type]
177
+ v_type = Regexp.last_match[:v_type]
178
+ {}.tap do |hash|
179
+ value.each do |k, v|
180
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
181
+ end
182
+ end
183
+ else # model
184
+ # models (e.g. Pet) or oneOf
185
+ klass = SnapTrade.const_get(type)
186
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
187
+ end
188
+ end
189
+
190
+ # Returns the string representation of the object
191
+ # @return [String] String presentation of the object
192
+ def to_s
193
+ to_hash.to_s
194
+ end
195
+
196
+ # to_body is an alias to to_hash (backward compatibility)
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_body
199
+ to_hash
200
+ end
201
+
202
+ # Returns the object in the form of hash
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_hash
205
+ hash = {}
206
+ self.class.attribute_map.each_pair do |attr, param|
207
+ value = self.send(attr)
208
+ if value.nil?
209
+ is_nullable = self.class.openapi_nullable.include?(attr)
210
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
211
+ end
212
+
213
+ hash[param] = _to_hash(value)
214
+ end
215
+ hash
216
+ end
217
+
218
+ # Outputs non-array value in the form of hash
219
+ # For object, use to_hash. Otherwise, just return the value
220
+ # @param [Object] value Any valid value
221
+ # @return [Hash] Returns the value in the form of hash
222
+ def _to_hash(value)
223
+ if value.is_a?(Array)
224
+ value.compact.map { |v| _to_hash(v) }
225
+ elsif value.is_a?(Hash)
226
+ {}.tap do |hash|
227
+ value.each { |k, v| hash[k] = _to_hash(v) }
228
+ end
229
+ elsif value.respond_to? :to_hash
230
+ value.to_hash
231
+ else
232
+ value
233
+ end
234
+ end
235
+
236
+ end
237
+
238
+ end
@@ -0,0 +1,382 @@
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
+ # User, connection, and connected asset totals for your SnapTrade Client ID.
15
+ class PartnerStats
16
+ # Number of users registered with your Client ID.
17
+ attr_accessor :total_users
18
+
19
+ # Number of users registered with your Client ID that have at least one connection, active or disabled.
20
+ attr_accessor :total_connected_users
21
+
22
+ # Number of active connections across users registered with your Client ID.
23
+ attr_accessor :total_active_connections
24
+
25
+ # Number of disabled connections across users registered with your Client ID.
26
+ attr_accessor :total_disabled_connections
27
+
28
+ # Number of users who have authorized your OAuth application. `null` if your Client ID has no OAuth application.
29
+ attr_accessor :oauth_total_users
30
+
31
+ # Number of users who have authorized your OAuth application and have at least one connection, active or disabled. `null` if your Client ID has no OAuth application.
32
+ attr_accessor :oauth_total_connected_users
33
+
34
+ # Number of active connections across users who have authorized your OAuth application. `null` if your Client ID has no OAuth application.
35
+ attr_accessor :oauth_total_active_connections
36
+
37
+ # Number of disabled connections across users who have authorized your OAuth application. `null` if your Client ID has no OAuth application.
38
+ attr_accessor :oauth_total_disabled_connections
39
+
40
+ # Total latest account value across active connections of users registered with your Client ID, in `assets_under_management_currency`. `null` until the first daily snapshot has been calculated.
41
+ attr_accessor :assets_under_management
42
+
43
+ # Total account value across disabled connections of users registered with your Client ID, as of each connection's last sync, in `assets_under_management_currency`. `null` until the first daily snapshot has been calculated.
44
+ attr_accessor :disabled_assets_under_management
45
+
46
+ # Total latest account value across active connections of users who have authorized your OAuth application, in `assets_under_management_currency`. `null` if your Client ID has no OAuth application, or until the first daily snapshot after it was added.
47
+ attr_accessor :oauth_assets_under_management
48
+
49
+ # Total account value across disabled connections of users who have authorized your OAuth application, as of each connection's last sync, in `assets_under_management_currency`. `null` if your Client ID has no OAuth application, or until the first daily snapshot after it was added.
50
+ attr_accessor :oauth_disabled_assets_under_management
51
+
52
+ # ISO 4217 currency code the asset values are expressed in.
53
+ attr_accessor :assets_under_management_currency
54
+
55
+ # Timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format indicating when the connected asset values were last calculated. `null` until the first daily snapshot has been calculated.
56
+ attr_accessor :assets_under_management_calculated_at
57
+
58
+ # Attribute mapping from ruby-style variable name to JSON key.
59
+ def self.attribute_map
60
+ {
61
+ :'total_users' => :'total_users',
62
+ :'total_connected_users' => :'total_connected_users',
63
+ :'total_active_connections' => :'total_active_connections',
64
+ :'total_disabled_connections' => :'total_disabled_connections',
65
+ :'oauth_total_users' => :'oauth_total_users',
66
+ :'oauth_total_connected_users' => :'oauth_total_connected_users',
67
+ :'oauth_total_active_connections' => :'oauth_total_active_connections',
68
+ :'oauth_total_disabled_connections' => :'oauth_total_disabled_connections',
69
+ :'assets_under_management' => :'assets_under_management',
70
+ :'disabled_assets_under_management' => :'disabled_assets_under_management',
71
+ :'oauth_assets_under_management' => :'oauth_assets_under_management',
72
+ :'oauth_disabled_assets_under_management' => :'oauth_disabled_assets_under_management',
73
+ :'assets_under_management_currency' => :'assets_under_management_currency',
74
+ :'assets_under_management_calculated_at' => :'assets_under_management_calculated_at'
75
+ }
76
+ end
77
+
78
+ # Returns all the JSON keys this model knows about
79
+ def self.acceptable_attributes
80
+ attribute_map.values
81
+ end
82
+
83
+ # Attribute type mapping.
84
+ def self.openapi_types
85
+ {
86
+ :'total_users' => :'Integer',
87
+ :'total_connected_users' => :'Integer',
88
+ :'total_active_connections' => :'Integer',
89
+ :'total_disabled_connections' => :'Integer',
90
+ :'oauth_total_users' => :'Integer',
91
+ :'oauth_total_connected_users' => :'Integer',
92
+ :'oauth_total_active_connections' => :'Integer',
93
+ :'oauth_total_disabled_connections' => :'Integer',
94
+ :'assets_under_management' => :'Float',
95
+ :'disabled_assets_under_management' => :'Float',
96
+ :'oauth_assets_under_management' => :'Float',
97
+ :'oauth_disabled_assets_under_management' => :'Float',
98
+ :'assets_under_management_currency' => :'String',
99
+ :'assets_under_management_calculated_at' => :'Time'
100
+ }
101
+ end
102
+
103
+ # List of attributes with nullable: true
104
+ def self.openapi_nullable
105
+ Set.new([
106
+ :'oauth_total_users',
107
+ :'oauth_total_connected_users',
108
+ :'oauth_total_active_connections',
109
+ :'oauth_total_disabled_connections',
110
+ :'assets_under_management',
111
+ :'disabled_assets_under_management',
112
+ :'oauth_assets_under_management',
113
+ :'oauth_disabled_assets_under_management',
114
+ :'assets_under_management_calculated_at'
115
+ ])
116
+ end
117
+
118
+ # Initializes the object
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ def initialize(attributes = {})
121
+ if (!attributes.is_a?(Hash))
122
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::PartnerStats` initialize method"
123
+ end
124
+
125
+ # check to see if the attribute exists and convert string to symbol for hash key
126
+ attributes = attributes.each_with_object({}) { |(k, v), h|
127
+ if (!self.class.attribute_map.key?(k.to_sym))
128
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::PartnerStats`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
129
+ end
130
+ h[k.to_sym] = v
131
+ }
132
+
133
+ if attributes.key?(:'total_users')
134
+ self.total_users = attributes[:'total_users']
135
+ end
136
+
137
+ if attributes.key?(:'total_connected_users')
138
+ self.total_connected_users = attributes[:'total_connected_users']
139
+ end
140
+
141
+ if attributes.key?(:'total_active_connections')
142
+ self.total_active_connections = attributes[:'total_active_connections']
143
+ end
144
+
145
+ if attributes.key?(:'total_disabled_connections')
146
+ self.total_disabled_connections = attributes[:'total_disabled_connections']
147
+ end
148
+
149
+ if attributes.key?(:'oauth_total_users')
150
+ self.oauth_total_users = attributes[:'oauth_total_users']
151
+ end
152
+
153
+ if attributes.key?(:'oauth_total_connected_users')
154
+ self.oauth_total_connected_users = attributes[:'oauth_total_connected_users']
155
+ end
156
+
157
+ if attributes.key?(:'oauth_total_active_connections')
158
+ self.oauth_total_active_connections = attributes[:'oauth_total_active_connections']
159
+ end
160
+
161
+ if attributes.key?(:'oauth_total_disabled_connections')
162
+ self.oauth_total_disabled_connections = attributes[:'oauth_total_disabled_connections']
163
+ end
164
+
165
+ if attributes.key?(:'assets_under_management')
166
+ self.assets_under_management = attributes[:'assets_under_management']
167
+ end
168
+
169
+ if attributes.key?(:'disabled_assets_under_management')
170
+ self.disabled_assets_under_management = attributes[:'disabled_assets_under_management']
171
+ end
172
+
173
+ if attributes.key?(:'oauth_assets_under_management')
174
+ self.oauth_assets_under_management = attributes[:'oauth_assets_under_management']
175
+ end
176
+
177
+ if attributes.key?(:'oauth_disabled_assets_under_management')
178
+ self.oauth_disabled_assets_under_management = attributes[:'oauth_disabled_assets_under_management']
179
+ end
180
+
181
+ if attributes.key?(:'assets_under_management_currency')
182
+ self.assets_under_management_currency = attributes[:'assets_under_management_currency']
183
+ end
184
+
185
+ if attributes.key?(:'assets_under_management_calculated_at')
186
+ self.assets_under_management_calculated_at = attributes[:'assets_under_management_calculated_at']
187
+ end
188
+ end
189
+
190
+ # Show invalid properties with the reasons. Usually used together with valid?
191
+ # @return Array for valid properties with the reasons
192
+ def list_invalid_properties
193
+ invalid_properties = Array.new
194
+ if @total_users.nil?
195
+ invalid_properties.push('invalid value for "total_users", total_users cannot be nil.')
196
+ end
197
+
198
+ if @total_connected_users.nil?
199
+ invalid_properties.push('invalid value for "total_connected_users", total_connected_users cannot be nil.')
200
+ end
201
+
202
+ if @total_active_connections.nil?
203
+ invalid_properties.push('invalid value for "total_active_connections", total_active_connections cannot be nil.')
204
+ end
205
+
206
+ if @total_disabled_connections.nil?
207
+ invalid_properties.push('invalid value for "total_disabled_connections", total_disabled_connections cannot be nil.')
208
+ end
209
+
210
+ if @assets_under_management_currency.nil?
211
+ invalid_properties.push('invalid value for "assets_under_management_currency", assets_under_management_currency cannot be nil.')
212
+ end
213
+
214
+ invalid_properties
215
+ end
216
+
217
+ # Check to see if the all the properties in the model are valid
218
+ # @return true if the model is valid
219
+ def valid?
220
+ return false if @total_users.nil?
221
+ return false if @total_connected_users.nil?
222
+ return false if @total_active_connections.nil?
223
+ return false if @total_disabled_connections.nil?
224
+ return false if @assets_under_management_currency.nil?
225
+ true
226
+ end
227
+
228
+ # Checks equality by comparing each attribute.
229
+ # @param [Object] Object to be compared
230
+ def ==(o)
231
+ return true if self.equal?(o)
232
+ self.class == o.class &&
233
+ total_users == o.total_users &&
234
+ total_connected_users == o.total_connected_users &&
235
+ total_active_connections == o.total_active_connections &&
236
+ total_disabled_connections == o.total_disabled_connections &&
237
+ oauth_total_users == o.oauth_total_users &&
238
+ oauth_total_connected_users == o.oauth_total_connected_users &&
239
+ oauth_total_active_connections == o.oauth_total_active_connections &&
240
+ oauth_total_disabled_connections == o.oauth_total_disabled_connections &&
241
+ assets_under_management == o.assets_under_management &&
242
+ disabled_assets_under_management == o.disabled_assets_under_management &&
243
+ oauth_assets_under_management == o.oauth_assets_under_management &&
244
+ oauth_disabled_assets_under_management == o.oauth_disabled_assets_under_management &&
245
+ assets_under_management_currency == o.assets_under_management_currency &&
246
+ assets_under_management_calculated_at == o.assets_under_management_calculated_at
247
+ end
248
+
249
+ # @see the `==` method
250
+ # @param [Object] Object to be compared
251
+ def eql?(o)
252
+ self == o
253
+ end
254
+
255
+ # Calculates hash code according to all attributes.
256
+ # @return [Integer] Hash code
257
+ def hash
258
+ [total_users, total_connected_users, total_active_connections, total_disabled_connections, oauth_total_users, oauth_total_connected_users, oauth_total_active_connections, oauth_total_disabled_connections, assets_under_management, disabled_assets_under_management, oauth_assets_under_management, oauth_disabled_assets_under_management, assets_under_management_currency, assets_under_management_calculated_at].hash
259
+ end
260
+
261
+ # Builds the object from hash
262
+ # @param [Hash] attributes Model attributes in the form of hash
263
+ # @return [Object] Returns the model itself
264
+ def self.build_from_hash(attributes)
265
+ new.build_from_hash(attributes)
266
+ end
267
+
268
+ # Builds the object from hash
269
+ # @param [Hash] attributes Model attributes in the form of hash
270
+ # @return [Object] Returns the model itself
271
+ def build_from_hash(attributes)
272
+ return nil unless attributes.is_a?(Hash)
273
+ attributes = attributes.transform_keys(&:to_sym)
274
+ self.class.openapi_types.each_pair do |key, type|
275
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
276
+ self.send("#{key}=", nil)
277
+ elsif type =~ /\AArray<(.*)>/i
278
+ # check to ensure the input is an array given that the attribute
279
+ # is documented as an array but the input is not
280
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
281
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
282
+ end
283
+ elsif !attributes[self.class.attribute_map[key]].nil?
284
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
285
+ end
286
+ end
287
+
288
+ self
289
+ end
290
+
291
+ # Deserializes the data based on type
292
+ # @param string type Data type
293
+ # @param string value Value to be deserialized
294
+ # @return [Object] Deserialized data
295
+ def _deserialize(type, value)
296
+ case type.to_sym
297
+ when :Time
298
+ Time.parse(value)
299
+ when :Date
300
+ Date.parse(value)
301
+ when :String
302
+ value.to_s
303
+ when :Integer
304
+ value.to_i
305
+ when :Float
306
+ value.to_f
307
+ when :Boolean
308
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
309
+ true
310
+ else
311
+ false
312
+ end
313
+ when :Object
314
+ # generic object (usually a Hash), return directly
315
+ value
316
+ when /\AArray<(?<inner_type>.+)>\z/
317
+ inner_type = Regexp.last_match[:inner_type]
318
+ value.map { |v| _deserialize(inner_type, v) }
319
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
320
+ k_type = Regexp.last_match[:k_type]
321
+ v_type = Regexp.last_match[:v_type]
322
+ {}.tap do |hash|
323
+ value.each do |k, v|
324
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
325
+ end
326
+ end
327
+ else # model
328
+ # models (e.g. Pet) or oneOf
329
+ klass = SnapTrade.const_get(type)
330
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
331
+ end
332
+ end
333
+
334
+ # Returns the string representation of the object
335
+ # @return [String] String presentation of the object
336
+ def to_s
337
+ to_hash.to_s
338
+ end
339
+
340
+ # to_body is an alias to to_hash (backward compatibility)
341
+ # @return [Hash] Returns the object in the form of hash
342
+ def to_body
343
+ to_hash
344
+ end
345
+
346
+ # Returns the object in the form of hash
347
+ # @return [Hash] Returns the object in the form of hash
348
+ def to_hash
349
+ hash = {}
350
+ self.class.attribute_map.each_pair do |attr, param|
351
+ value = self.send(attr)
352
+ if value.nil?
353
+ is_nullable = self.class.openapi_nullable.include?(attr)
354
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
355
+ end
356
+
357
+ hash[param] = _to_hash(value)
358
+ end
359
+ hash
360
+ end
361
+
362
+ # Outputs non-array value in the form of hash
363
+ # For object, use to_hash. Otherwise, just return the value
364
+ # @param [Object] value Any valid value
365
+ # @return [Hash] Returns the value in the form of hash
366
+ def _to_hash(value)
367
+ if value.is_a?(Array)
368
+ value.compact.map { |v| _to_hash(v) }
369
+ elsif value.is_a?(Hash)
370
+ {}.tap do |hash|
371
+ value.each { |k, v| hash[k] = _to_hash(v) }
372
+ end
373
+ elsif value.respond_to? :to_hash
374
+ value.to_hash
375
+ else
376
+ value
377
+ end
378
+ end
379
+
380
+ end
381
+
382
+ end
@@ -8,5 +8,5 @@ Contact: api@snaptrade.com
8
8
  =end
9
9
 
10
10
  module SnapTrade
11
- VERSION = '3.0.37'
11
+ VERSION = '3.0.39'
12
12
  end
data/lib/snaptrade.rb CHANGED
@@ -167,6 +167,7 @@ require 'snaptrade/models/model429_too_many_requests_response'
167
167
  require 'snaptrade/models/model500_unexpected_exception_response'
168
168
  require 'snaptrade/models/model501_not_implemented_response'
169
169
  require 'snaptrade/models/model503_brokerage_request_response'
170
+ require 'snaptrade/models/model503_currency_conversion_unavailable_response'
170
171
  require 'snaptrade/models/monthly_dividends'
171
172
  require 'snaptrade/models/mutual_fund_instrument'
172
173
  require 'snaptrade/models/mutual_fund_instrument_kind'
@@ -202,6 +203,7 @@ require 'snaptrade/models/other_instrument_kind'
202
203
  require 'snaptrade/models/paginated_universal_activity'
203
204
  require 'snaptrade/models/pagination_details'
204
205
  require 'snaptrade/models/partner_data'
206
+ require 'snaptrade/models/partner_stats'
205
207
  require 'snaptrade/models/past_value'
206
208
  require 'snaptrade/models/performance_custom'
207
209
  require 'snaptrade/models/position'
@@ -286,6 +288,7 @@ require 'snaptrade/api/api_status_api'
286
288
  require 'snaptrade/api/authentication_api'
287
289
  require 'snaptrade/api/connections_api'
288
290
  require 'snaptrade/api/experimental_endpoints_api'
291
+ require 'snaptrade/api/management_api'
289
292
  require 'snaptrade/api/reference_data_api'
290
293
  require 'snaptrade/api/trading_api'
291
294
 
@@ -358,6 +361,7 @@ module SnapTrade
358
361
  attr_reader :authentication
359
362
  attr_reader :connections
360
363
  attr_reader :experimental_endpoints
364
+ attr_reader :management
361
365
  attr_reader :reference_data
362
366
  attr_reader :trading
363
367
 
@@ -368,6 +372,7 @@ module SnapTrade
368
372
  @authentication = SnapTrade::AuthenticationApi.new(@api_client)
369
373
  @connections = SnapTrade::ConnectionsApi.new(@api_client)
370
374
  @experimental_endpoints = SnapTrade::ExperimentalEndpointsApi.new(@api_client)
375
+ @management = SnapTrade::ManagementApi.new(@api_client)
371
376
  @reference_data = SnapTrade::ReferenceDataApi.new(@api_client)
372
377
  @trading = SnapTrade::TradingApi.new(@api_client)
373
378
  end