snaptrade 2.0.195 → 2.0.196

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 89d6313108cd94956afeb65ef31c1a166978dc4fa1ad65013da4c0887bbe4b86
4
- data.tar.gz: 1cc2e032f95b89e624e5c281fe852a75a3a708504274d8382a216f8b4a7d346b
3
+ metadata.gz: b754dc14c0f33c34f7ababe4f1ce48b1b8f41f5bcd1a4ef1455c601e7d38ce81
4
+ data.tar.gz: e56000668a36d8b8cd671c83e6a673de384b459217d3288f7696062db72d49f4
5
5
  SHA512:
6
- metadata.gz: 94314bac7c431cc71aeb8b8548b301e7320a93bc6d796dfdc8790d794f53162f49cded316a53df0eec539226116a0a0e2aee012d2d99c00e0803c68441d26227
7
- data.tar.gz: aeb56f858145421f3076cadb431a209a57a3a980545af0c8bca4f4b1ab4725efb81323f6e5830214474df6c00b263a23bb6d0e957666aa4039a0a70671bd0ccb
6
+ metadata.gz: 98b08aec6d62f9b88ea7bfdb103f30bb727173928e39b9e695938deddbbefad77e5f395de559ffc2d35426bc1be4229e2d36230c9513d4c50cec7866103e533f
7
+ data.tar.gz: '08ad40a1146925f14907d98ec152b8270187db222d14741d32c35a6c6d8ced686890b30c1447b999f7a60e2a08974672609f76b5b914ac3ac67b1e90013f7183'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- snaptrade (2.0.195)
4
+ snaptrade (2.0.196)
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.195-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.195)
9
+ [![npm](https://img.shields.io/badge/gem-v2.0.196-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.196)
10
10
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
11
11
 
12
12
  </div>
@@ -48,10 +48,6 @@ Connect brokerage accounts to your app for live positions and trading
48
48
  * [`snaptrade.connections.remove_brokerage_authorization`](#snaptradeconnectionsremove_brokerage_authorization)
49
49
  * [`snaptrade.connections.return_rates`](#snaptradeconnectionsreturn_rates)
50
50
  * [`snaptrade.connections.session_events`](#snaptradeconnectionssession_events)
51
- * [`snaptrade.experimental_endpoints.get_user_account_order_detail_v2`](#snaptradeexperimental_endpointsget_user_account_order_detail_v2)
52
- * [`snaptrade.experimental_endpoints.get_user_account_orders_v2`](#snaptradeexperimental_endpointsget_user_account_orders_v2)
53
- * [`snaptrade.experimental_endpoints.get_user_account_recent_orders_v2`](#snaptradeexperimental_endpointsget_user_account_recent_orders_v2)
54
- * [`snaptrade.experimental_endpoints.sync_brokerage_authorization_transactions`](#snaptradeexperimental_endpointssync_brokerage_authorization_transactions)
55
51
  * [`snaptrade.options.list_option_holdings`](#snaptradeoptionslist_option_holdings)
56
52
  * [`snaptrade.reference_data.get_currency_exchange_rate_pair`](#snaptradereference_dataget_currency_exchange_rate_pair)
57
53
  * [`snaptrade.reference_data.get_partner_info`](#snaptradereference_dataget_partner_info)
@@ -91,7 +87,7 @@ Connect brokerage accounts to your app for live positions and trading
91
87
  Add to Gemfile:
92
88
 
93
89
  ```ruby
94
- gem 'snaptrade', '~> 2.0.195'
90
+ gem 'snaptrade', '~> 2.0.196'
95
91
  ```
96
92
 
97
93
  ## Getting Started<a id="getting-started"></a>
@@ -1303,173 +1299,6 @@ specific users
1303
1299
  ---
1304
1300
 
1305
1301
 
1306
- ### `snaptrade.experimental_endpoints.get_user_account_order_detail_v2`<a id="snaptradeexperimental_endpointsget_user_account_order_detail_v2"></a>
1307
-
1308
- Returns the detail of a single order using the brokerage order ID provided as a path parameter.
1309
-
1310
- The V2 order response format includes all legs of the order in the `legs` list field.
1311
- If the order is single legged, `legs` will be a list of one leg.
1312
-
1313
- This endpoint is always realtime and does not rely on cached data.
1314
-
1315
- This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
1316
-
1317
-
1318
- #### 🛠️ Usage<a id="🛠️-usage"></a>
1319
-
1320
- ```ruby
1321
- result = snaptrade.experimental_endpoints.get_user_account_order_detail_v2(
1322
- account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1323
- brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
1324
- user_id: "snaptrade-user-123",
1325
- user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1326
- )
1327
- p result
1328
- ```
1329
-
1330
- #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1331
-
1332
- ##### account_id: `String`<a id="account_id-string"></a>
1333
- ##### brokerage_order_id: `String`<a id="brokerage_order_id-string"></a>
1334
- ##### user_id: `String`<a id="user_id-string"></a>
1335
- ##### user_secret: `String`<a id="user_secret-string"></a>
1336
- #### 🔄 Return<a id="🔄-return"></a>
1337
-
1338
- [AccountOrderRecordV2](./lib/snaptrade/models/account_order_record_v2.rb)
1339
-
1340
- #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1341
-
1342
- `/accounts/{accountId}/orders/details/v2/{brokerageOrderId}` `GET`
1343
-
1344
- [🔙 **Back to Table of Contents**](#table-of-contents)
1345
-
1346
- ---
1347
-
1348
-
1349
- ### `snaptrade.experimental_endpoints.get_user_account_orders_v2`<a id="snaptradeexperimental_endpointsget_user_account_orders_v2"></a>
1350
-
1351
- Returns a list of recent orders in the specified account.
1352
-
1353
- The V2 order response format will include all legs of each order in the `legs` list field. If the order is single legged, `legs` will be a list of one leg.
1354
-
1355
- If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
1356
-
1357
-
1358
- #### 🛠️ Usage<a id="🛠️-usage"></a>
1359
-
1360
- ```ruby
1361
- result = snaptrade.experimental_endpoints.get_user_account_orders_v2(
1362
- user_id: "snaptrade-user-123",
1363
- user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1364
- account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1365
- state: "all",
1366
- days: 30,
1367
- )
1368
- p result
1369
- ```
1370
-
1371
- #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1372
-
1373
- ##### user_id: `String`<a id="user_id-string"></a>
1374
- ##### user_secret: `String`<a id="user_secret-string"></a>
1375
- ##### account_id: `String`<a id="account_id-string"></a>
1376
- ##### state: `String`<a id="state-string"></a>
1377
- defaults value is set to \"all\"
1378
-
1379
- ##### days: `Integer`<a id="days-integer"></a>
1380
- Number of days in the past to fetch the most recent orders. Defaults to the last
1381
- 30 days if no value is passed in. Values greater than 90 will be capped at 90.
1382
-
1383
- #### 🔄 Return<a id="🔄-return"></a>
1384
-
1385
- [AccountOrdersV2Response](./lib/snaptrade/models/account_orders_v2_response.rb)
1386
-
1387
- #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1388
-
1389
- `/accounts/{accountId}/orders/v2` `GET`
1390
-
1391
- [🔙 **Back to Table of Contents**](#table-of-contents)
1392
-
1393
- ---
1394
-
1395
-
1396
- ### `snaptrade.experimental_endpoints.get_user_account_recent_orders_v2`<a id="snaptradeexperimental_endpointsget_user_account_recent_orders_v2"></a>
1397
-
1398
- A lightweight endpoint that returns a list of orders executed in the last 24 hours in the specified account using the V2 order format.
1399
- This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders.
1400
- Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days.
1401
- By default only returns executed orders, but that can be changed by setting *only_executed* to false.
1402
- **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
1403
-
1404
-
1405
- #### 🛠️ Usage<a id="🛠️-usage"></a>
1406
-
1407
- ```ruby
1408
- result = snaptrade.experimental_endpoints.get_user_account_recent_orders_v2(
1409
- user_id: "snaptrade-user-123",
1410
- user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1411
- account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1412
- only_executed: true,
1413
- )
1414
- p result
1415
- ```
1416
-
1417
- #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1418
-
1419
- ##### user_id: `String`<a id="user_id-string"></a>
1420
- ##### user_secret: `String`<a id="user_secret-string"></a>
1421
- ##### account_id: `String`<a id="account_id-string"></a>
1422
- ##### only_executed: `Boolean`<a id="only_executed-boolean"></a>
1423
- Defaults to true. Indicates if request should fetch only executed orders. Set to
1424
- false to retrieve non executed orders as well
1425
-
1426
- #### 🔄 Return<a id="🔄-return"></a>
1427
-
1428
- [AccountOrdersV2Response](./lib/snaptrade/models/account_orders_v2_response.rb)
1429
-
1430
- #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1431
-
1432
- `/accounts/{accountId}/recentOrders/v2` `GET`
1433
-
1434
- [🔙 **Back to Table of Contents**](#table-of-contents)
1435
-
1436
- ---
1437
-
1438
-
1439
- ### `snaptrade.experimental_endpoints.sync_brokerage_authorization_transactions`<a id="snaptradeexperimental_endpointssync_brokerage_authorization_transactions"></a>
1440
-
1441
- Trigger a transactions sync for all accounts under this connection. Updates will be queued asynchronously. Transactions are not updated intra-day, but calling this endpoint can ensure that the previous day's transactions have been synced. For more information on sync behaviour, see: https://docs.snaptrade.com/docs/syncing
1442
-
1443
-
1444
- #### 🛠️ Usage<a id="🛠️-usage"></a>
1445
-
1446
- ```ruby
1447
- result = snaptrade.experimental_endpoints.sync_brokerage_authorization_transactions(
1448
- authorization_id: "87b24961-b51e-4db8-9226-f198f6518a89",
1449
- user_id: "snaptrade-user-123",
1450
- user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1451
- )
1452
- p result
1453
- ```
1454
-
1455
- #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1456
-
1457
- ##### authorization_id: `String`<a id="authorization_id-string"></a>
1458
- ##### user_id: `String`<a id="user_id-string"></a>
1459
- ##### user_secret: `String`<a id="user_secret-string"></a>
1460
- #### 🔄 Return<a id="🔄-return"></a>
1461
-
1462
- [BrokerageAuthorizationTransactionsSyncConfirmation](./lib/snaptrade/models/brokerage_authorization_transactions_sync_confirmation.rb)
1463
-
1464
- #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1465
-
1466
- `/authorizations/{authorizationId}/transactions/sync` `POST`
1467
-
1468
- [🔙 **Back to Table of Contents**](#table-of-contents)
1469
-
1470
- ---
1471
-
1472
-
1473
1302
  ### `snaptrade.options.list_option_holdings`<a id="snaptradeoptionslist_option_holdings"></a>
1474
1303
 
1475
1304
  Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions).
@@ -0,0 +1,221 @@
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 TradeDetectionCancelSubscriptionResponse
15
+ attr_accessor :success
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ :'success' => :'success'
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
+ :'success' => :'Boolean'
33
+ }
34
+ end
35
+
36
+ # List of attributes with nullable: true
37
+ def self.openapi_nullable
38
+ Set.new([
39
+ ])
40
+ end
41
+
42
+ # Initializes the object
43
+ # @param [Hash] attributes Model attributes in the form of hash
44
+ def initialize(attributes = {})
45
+ if (!attributes.is_a?(Hash))
46
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::TradeDetectionCancelSubscriptionResponse` initialize method"
47
+ end
48
+
49
+ # check to see if the attribute exists and convert string to symbol for hash key
50
+ attributes = attributes.each_with_object({}) { |(k, v), h|
51
+ if (!self.class.attribute_map.key?(k.to_sym))
52
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::TradeDetectionCancelSubscriptionResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
53
+ end
54
+ h[k.to_sym] = v
55
+ }
56
+
57
+ if attributes.key?(:'success')
58
+ self.success = attributes[:'success']
59
+ end
60
+ end
61
+
62
+ # Show invalid properties with the reasons. Usually used together with valid?
63
+ # @return Array for valid properties with the reasons
64
+ def list_invalid_properties
65
+ invalid_properties = Array.new
66
+ if @success.nil?
67
+ invalid_properties.push('invalid value for "success", success cannot be nil.')
68
+ end
69
+
70
+ invalid_properties
71
+ end
72
+
73
+ # Check to see if the all the properties in the model are valid
74
+ # @return true if the model is valid
75
+ def valid?
76
+ return false if @success.nil?
77
+ true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(o)
83
+ return true if self.equal?(o)
84
+ self.class == o.class &&
85
+ success == o.success
86
+ end
87
+
88
+ # @see the `==` method
89
+ # @param [Object] Object to be compared
90
+ def eql?(o)
91
+ self == o
92
+ end
93
+
94
+ # Calculates hash code according to all attributes.
95
+ # @return [Integer] Hash code
96
+ def hash
97
+ [success].hash
98
+ end
99
+
100
+ # Builds the object from hash
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ # @return [Object] Returns the model itself
103
+ def self.build_from_hash(attributes)
104
+ new.build_from_hash(attributes)
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def build_from_hash(attributes)
111
+ return nil unless attributes.is_a?(Hash)
112
+ attributes = attributes.transform_keys(&:to_sym)
113
+ self.class.openapi_types.each_pair do |key, type|
114
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
115
+ self.send("#{key}=", nil)
116
+ elsif type =~ /\AArray<(.*)>/i
117
+ # check to ensure the input is an array given that the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
120
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
121
+ end
122
+ elsif !attributes[self.class.attribute_map[key]].nil?
123
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
124
+ end
125
+ end
126
+
127
+ self
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def _deserialize(type, value)
135
+ case type.to_sym
136
+ when :Time
137
+ Time.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :Boolean
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ # models (e.g. Pet) or oneOf
168
+ klass = SnapTrade.const_get(type)
169
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
170
+ end
171
+ end
172
+
173
+ # Returns the string representation of the object
174
+ # @return [String] String presentation of the object
175
+ def to_s
176
+ to_hash.to_s
177
+ end
178
+
179
+ # to_body is an alias to to_hash (backward compatibility)
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_body
182
+ to_hash
183
+ end
184
+
185
+ # Returns the object in the form of hash
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_hash
188
+ hash = {}
189
+ self.class.attribute_map.each_pair do |attr, param|
190
+ value = self.send(attr)
191
+ if value.nil?
192
+ is_nullable = self.class.openapi_nullable.include?(attr)
193
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
194
+ end
195
+
196
+ hash[param] = _to_hash(value)
197
+ end
198
+ hash
199
+ end
200
+
201
+ # Outputs non-array value in the form of hash
202
+ # For object, use to_hash. Otherwise, just return the value
203
+ # @param [Object] value Any valid value
204
+ # @return [Hash] Returns the value in the form of hash
205
+ def _to_hash(value)
206
+ if value.is_a?(Array)
207
+ value.compact.map { |v| _to_hash(v) }
208
+ elsif value.is_a?(Hash)
209
+ {}.tap do |hash|
210
+ value.each { |k, v| hash[k] = _to_hash(v) }
211
+ end
212
+ elsif value.respond_to? :to_hash
213
+ value.to_hash
214
+ else
215
+ value
216
+ end
217
+ end
218
+
219
+ end
220
+
221
+ end
@@ -0,0 +1,253 @@
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
+ # An active Trade Detection subscription for a brokerage account.
15
+ class TradeDetectionSubscription
16
+ # Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
17
+ attr_accessor :account_id
18
+
19
+ # Monthly subscription cost as a decimal string.
20
+ attr_accessor :cost
21
+
22
+ # How often the subscribed account is checked for new trades.
23
+ attr_accessor :check_interval_seconds
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'account_id' => :'account_id',
29
+ :'cost' => :'cost',
30
+ :'check_interval_seconds' => :'check_interval_seconds'
31
+ }
32
+ end
33
+
34
+ # Returns all the JSON keys this model knows about
35
+ def self.acceptable_attributes
36
+ attribute_map.values
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'account_id' => :'String',
43
+ :'cost' => :'String',
44
+ :'check_interval_seconds' => :'Integer'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
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::TradeDetectionSubscription` 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::TradeDetectionSubscription`. 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?(:'account_id')
70
+ self.account_id = attributes[:'account_id']
71
+ end
72
+
73
+ if attributes.key?(:'cost')
74
+ self.cost = attributes[:'cost']
75
+ end
76
+
77
+ if attributes.key?(:'check_interval_seconds')
78
+ self.check_interval_seconds = attributes[:'check_interval_seconds']
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
+ if @account_id.nil?
87
+ invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
88
+ end
89
+
90
+ if @cost.nil?
91
+ invalid_properties.push('invalid value for "cost", cost cannot be nil.')
92
+ end
93
+
94
+ if @check_interval_seconds.nil?
95
+ invalid_properties.push('invalid value for "check_interval_seconds", check_interval_seconds cannot be nil.')
96
+ end
97
+
98
+ invalid_properties
99
+ end
100
+
101
+ # Check to see if the all the properties in the model are valid
102
+ # @return true if the model is valid
103
+ def valid?
104
+ return false if @account_id.nil?
105
+ return false if @cost.nil?
106
+ return false if @check_interval_seconds.nil?
107
+ true
108
+ end
109
+
110
+ # Checks equality by comparing each attribute.
111
+ # @param [Object] Object to be compared
112
+ def ==(o)
113
+ return true if self.equal?(o)
114
+ self.class == o.class &&
115
+ account_id == o.account_id &&
116
+ cost == o.cost &&
117
+ check_interval_seconds == o.check_interval_seconds
118
+ end
119
+
120
+ # @see the `==` method
121
+ # @param [Object] Object to be compared
122
+ def eql?(o)
123
+ self == o
124
+ end
125
+
126
+ # Calculates hash code according to all attributes.
127
+ # @return [Integer] Hash code
128
+ def hash
129
+ [account_id, cost, check_interval_seconds].hash
130
+ end
131
+
132
+ # Builds the object from hash
133
+ # @param [Hash] attributes Model attributes in the form of hash
134
+ # @return [Object] Returns the model itself
135
+ def self.build_from_hash(attributes)
136
+ new.build_from_hash(attributes)
137
+ end
138
+
139
+ # Builds the object from hash
140
+ # @param [Hash] attributes Model attributes in the form of hash
141
+ # @return [Object] Returns the model itself
142
+ def build_from_hash(attributes)
143
+ return nil unless attributes.is_a?(Hash)
144
+ attributes = attributes.transform_keys(&:to_sym)
145
+ self.class.openapi_types.each_pair do |key, type|
146
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
147
+ self.send("#{key}=", nil)
148
+ elsif type =~ /\AArray<(.*)>/i
149
+ # check to ensure the input is an array given that the attribute
150
+ # is documented as an array but the input is not
151
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
152
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
153
+ end
154
+ elsif !attributes[self.class.attribute_map[key]].nil?
155
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
156
+ end
157
+ end
158
+
159
+ self
160
+ end
161
+
162
+ # Deserializes the data based on type
163
+ # @param string type Data type
164
+ # @param string value Value to be deserialized
165
+ # @return [Object] Deserialized data
166
+ def _deserialize(type, value)
167
+ case type.to_sym
168
+ when :Time
169
+ Time.parse(value)
170
+ when :Date
171
+ Date.parse(value)
172
+ when :String
173
+ value.to_s
174
+ when :Integer
175
+ value.to_i
176
+ when :Float
177
+ value.to_f
178
+ when :Boolean
179
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
180
+ true
181
+ else
182
+ false
183
+ end
184
+ when :Object
185
+ # generic object (usually a Hash), return directly
186
+ value
187
+ when /\AArray<(?<inner_type>.+)>\z/
188
+ inner_type = Regexp.last_match[:inner_type]
189
+ value.map { |v| _deserialize(inner_type, v) }
190
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
191
+ k_type = Regexp.last_match[:k_type]
192
+ v_type = Regexp.last_match[:v_type]
193
+ {}.tap do |hash|
194
+ value.each do |k, v|
195
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
196
+ end
197
+ end
198
+ else # model
199
+ # models (e.g. Pet) or oneOf
200
+ klass = SnapTrade.const_get(type)
201
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
202
+ end
203
+ end
204
+
205
+ # Returns the string representation of the object
206
+ # @return [String] String presentation of the object
207
+ def to_s
208
+ to_hash.to_s
209
+ end
210
+
211
+ # to_body is an alias to to_hash (backward compatibility)
212
+ # @return [Hash] Returns the object in the form of hash
213
+ def to_body
214
+ to_hash
215
+ end
216
+
217
+ # Returns the object in the form of hash
218
+ # @return [Hash] Returns the object in the form of hash
219
+ def to_hash
220
+ hash = {}
221
+ self.class.attribute_map.each_pair do |attr, param|
222
+ value = self.send(attr)
223
+ if value.nil?
224
+ is_nullable = self.class.openapi_nullable.include?(attr)
225
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
226
+ end
227
+
228
+ hash[param] = _to_hash(value)
229
+ end
230
+ hash
231
+ end
232
+
233
+ # Outputs non-array value in the form of hash
234
+ # For object, use to_hash. Otherwise, just return the value
235
+ # @param [Object] value Any valid value
236
+ # @return [Hash] Returns the value in the form of hash
237
+ def _to_hash(value)
238
+ if value.is_a?(Array)
239
+ value.compact.map { |v| _to_hash(v) }
240
+ elsif value.is_a?(Hash)
241
+ {}.tap do |hash|
242
+ value.each { |k, v| hash[k] = _to_hash(v) }
243
+ end
244
+ elsif value.respond_to? :to_hash
245
+ value.to_hash
246
+ else
247
+ value
248
+ end
249
+ end
250
+
251
+ end
252
+
253
+ end