snaptrade 2.0.84 → 2.0.86

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: 583adcc593c29b41d711763b74c93535e0d3cf8f58955cbb9c8ffe200cdfab92
4
- data.tar.gz: aeab145caf7e7ef0d8ee0daba7189dcbbb33a7f9a2db652536435e3e57228c7a
3
+ metadata.gz: 2713dd92b6b944dee604818ebe688255770196b905cf9e2dcb433fb0d9c6b0fa
4
+ data.tar.gz: af7e3d1990da462d603ca17d3e1f02bdc9ae6ffa5881c1082451bf92c56846ce
5
5
  SHA512:
6
- metadata.gz: e1ae9a060459430356ac374f2b6ef1a9f2df3a725e3e7cbd96ca6551509deae5e346d8ea04f64a8a1433399d354f19b57a1dd9f5fd3607fc86808869fc15afee
7
- data.tar.gz: b71c4ec3a4eabe5298f79554b551cabc4b182db2c09b418b2111df75a7cf43f188bef7c438daae08547391a913e4819e37c42464b9058a60fbf8e336e95632a8
6
+ metadata.gz: a69d7ead074e9845c83794805b770fe9e38d6124fbcee282714b9dbe0fd5d159f79e461e83db44e46e0345005b940247fe1b5951469c0fea287c6ebfcc68ce1f
7
+ data.tar.gz: da96199e1dd2c5fa20c52c67c813ce213053fa844344ce36f1b53b6589d6229ba0f2e5bf1212e754d251fb653e21b80e799bc1bbca0b8e03f02dc065de0daf99
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- snaptrade (2.0.84)
4
+ snaptrade (2.0.86)
5
5
  faraday (>= 1.0.1, < 3.0)
6
6
  faraday-multipart (~> 1.0, >= 1.0.4)
7
7
 
@@ -15,7 +15,7 @@ GEM
15
15
  debug (1.8.0)
16
16
  irb (>= 1.5.0)
17
17
  reline (>= 0.3.1)
18
- diff-lcs (1.6.0)
18
+ diff-lcs (1.6.1)
19
19
  faraday (2.8.1)
20
20
  base64
21
21
  faraday-net_http (>= 2.0, < 3.1)
@@ -29,9 +29,10 @@ GEM
29
29
  method_source (1.1.0)
30
30
  multipart-post (2.4.1)
31
31
  parallel (1.26.3)
32
- parser (3.3.7.2)
32
+ parser (3.3.7.3)
33
33
  ast (~> 2.4.1)
34
34
  racc
35
+ prism (1.4.0)
35
36
  pry (0.14.2)
36
37
  coderay (~> 1.1)
37
38
  method_source (~> 1.0)
@@ -67,8 +68,9 @@ GEM
67
68
  rubocop-ast (>= 1.2.0, < 2.0)
68
69
  ruby-progressbar (~> 1.7)
69
70
  unicode-display_width (>= 1.4.0, < 3.0)
70
- rubocop-ast (1.41.0)
71
+ rubocop-ast (1.43.0)
71
72
  parser (>= 3.3.7.2)
73
+ prism (~> 1.4)
72
74
  ruby-progressbar (1.13.0)
73
75
  ruby2_keywords (0.0.5)
74
76
  unicode-display_width (2.6.0)
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.84-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.84)
9
+ [![npm](https://img.shields.io/badge/gem-v2.0.86-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.86)
10
10
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
11
11
 
12
12
  </div>
@@ -80,7 +80,7 @@ Connect brokerage accounts to your app for live positions and trading
80
80
  Add to Gemfile:
81
81
 
82
82
  ```ruby
83
- gem 'snaptrade', '~> 2.0.84'
83
+ gem 'snaptrade', '~> 2.0.86'
84
84
  ```
85
85
 
86
86
  ## Getting Started<a id="getting-started"></a>
@@ -1073,7 +1073,7 @@ the brokerage system.
1073
1073
  ##### account_id: `String`<a id="account_id-string"></a>
1074
1074
  #### 🔄 Return<a id="🔄-return"></a>
1075
1075
 
1076
- [AccountOrderRecord](./lib/snaptrade/models/account_order_record.rb)
1076
+ [OrderUpdatedResponse](./lib/snaptrade/models/order_updated_response.rb)
1077
1077
 
1078
1078
  #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1079
1079
 
@@ -1096,7 +1096,7 @@ This endpoint does not compute the impact to the account balance from the order
1096
1096
  result = snaptrade.crypto_spot_trading.crypto_spot_place_order(
1097
1097
  symbol: {
1098
1098
  "base" => "BTC",
1099
- "quote" => "BTC",
1099
+ "quote" => "USD",
1100
1100
  },
1101
1101
  side: "BUY",
1102
1102
  type: "MARKET",
@@ -1147,15 +1147,15 @@ The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT,
1147
1147
  TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
1148
1148
 
1149
1149
  ##### post_only: `Boolean`<a id="post_only-boolean"></a>
1150
- Required for order type LIMIT. If true orders that would be filled immediately
1151
- are rejected to avoid incurring TAKER fees.
1150
+ Valid and required only for order type LIMIT. If true orders that would be
1151
+ filled immediately are rejected to avoid incurring TAKER fees.
1152
1152
 
1153
1153
  ##### expiration_date: `Time`<a id="expiration_date-time"></a>
1154
1154
  The expiration date of the order. Required if the time_in_force is GTD.
1155
1155
 
1156
1156
  #### 🔄 Return<a id="🔄-return"></a>
1157
1157
 
1158
- [AccountOrderRecord](./lib/snaptrade/models/account_order_record.rb)
1158
+ [OrderUpdatedResponse](./lib/snaptrade/models/order_updated_response.rb)
1159
1159
 
1160
1160
  #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1161
1161
 
@@ -1177,7 +1177,7 @@ Previews a cryptocurrency spot order using the specified account.
1177
1177
  result = snaptrade.crypto_spot_trading.crypto_spot_preview_order(
1178
1178
  symbol: {
1179
1179
  "base" => "BTC",
1180
- "quote" => "BTC",
1180
+ "quote" => "USD",
1181
1181
  },
1182
1182
  side: "BUY",
1183
1183
  type: "MARKET",
@@ -1228,8 +1228,8 @@ The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT,
1228
1228
  TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
1229
1229
 
1230
1230
  ##### post_only: `Boolean`<a id="post_only-boolean"></a>
1231
- Required for order type LIMIT. If true orders that would be filled immediately
1232
- are rejected to avoid incurring TAKER fees.
1231
+ Valid and required only for order type LIMIT. If true orders that would be
1232
+ filled immediately are rejected to avoid incurring TAKER fees.
1233
1233
 
1234
1234
  ##### expiration_date: `Time`<a id="expiration_date-time"></a>
1235
1235
  The expiration date of the order. Required if the time_in_force is GTD.
@@ -1260,7 +1260,7 @@ result = snaptrade.crypto_spot_trading.crypto_spot_quote(
1260
1260
  user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1261
1261
  account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1262
1262
  base: "BTC",
1263
- quote: "BTC",
1263
+ quote: "USD",
1264
1264
  )
1265
1265
  p result
1266
1266
  ```
@@ -1298,7 +1298,7 @@ result = snaptrade.crypto_spot_trading.crypto_spot_symbols(
1298
1298
  user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1299
1299
  account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1300
1300
  base: "BTC",
1301
- quote: "BTC",
1301
+ quote: "USD",
1302
1302
  )
1303
1303
  p result
1304
1304
  ```
@@ -59,7 +59,7 @@ module SnapTrade
59
59
  # @param account_id [String]
60
60
  # @param trading_crypto_spot_cancel_order_request [TradingCryptoSpotCancelOrderRequest]
61
61
  # @param [Hash] opts the optional parameters
62
- # @return [AccountOrderRecord]
62
+ # @return [OrderUpdatedResponse]
63
63
  private def crypto_spot_cancel_order_impl(user_id, user_secret, account_id, trading_crypto_spot_cancel_order_request, opts = {})
64
64
  data, _status_code, _headers = crypto_spot_cancel_order_with_http_info(user_id, user_secret, account_id, trading_crypto_spot_cancel_order_request, opts)
65
65
  data
@@ -72,7 +72,7 @@ module SnapTrade
72
72
  # @param account_id [String]
73
73
  # @param trading_crypto_spot_cancel_order_request [TradingCryptoSpotCancelOrderRequest]
74
74
  # @param [Hash] opts the optional parameters
75
- # @return [Array<(AccountOrderRecord, Integer, Hash)>] AccountOrderRecord data, response status code and response headers
75
+ # @return [Array<(OrderUpdatedResponse, Integer, Hash)>] OrderUpdatedResponse data, response status code and response headers
76
76
  private def crypto_spot_cancel_order_with_http_info_impl(user_id, user_secret, account_id, trading_crypto_spot_cancel_order_request, opts = {})
77
77
  if @api_client.config.debugging
78
78
  @api_client.config.logger.debug 'Calling API: CryptoSpotTradingApi.crypto_spot_cancel_order ...'
@@ -118,7 +118,7 @@ module SnapTrade
118
118
  post_body = opts[:debug_body] || @api_client.object_to_http_body(trading_crypto_spot_cancel_order_request)
119
119
 
120
120
  # return_type
121
- return_type = opts[:debug_return_type] || 'AccountOrderRecord'
121
+ return_type = opts[:debug_return_type] || 'OrderUpdatedResponse'
122
122
 
123
123
  # auth_names
124
124
  auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
@@ -156,7 +156,7 @@ module SnapTrade
156
156
  # @param account_id [String]
157
157
  # @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
158
158
  # @param stop_price [Float] The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT, TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
159
- # @param post_only [Boolean] Required for order type LIMIT. If true orders that would be filled immediately are rejected to avoid incurring TAKER fees.
159
+ # @param post_only [Boolean] Valid and required only for order type LIMIT. If true orders that would be filled immediately are rejected to avoid incurring TAKER fees.
160
160
  # @param expiration_date [Time] The expiration date of the order. Required if the time_in_force is GTD.
161
161
  # @param body [TradingCryptoSpotPlaceOrderRequest]
162
162
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
@@ -191,7 +191,7 @@ module SnapTrade
191
191
  # @param account_id [String]
192
192
  # @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
193
193
  # @param stop_price [Float] The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT, TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
194
- # @param post_only [Boolean] Required for order type LIMIT. If true orders that would be filled immediately are rejected to avoid incurring TAKER fees.
194
+ # @param post_only [Boolean] Valid and required only for order type LIMIT. If true orders that would be filled immediately are rejected to avoid incurring TAKER fees.
195
195
  # @param expiration_date [Time] The expiration date of the order. Required if the time_in_force is GTD.
196
196
  # @param body [TradingCryptoSpotPlaceOrderRequest]
197
197
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
@@ -217,7 +217,7 @@ module SnapTrade
217
217
  # @param account_id [String]
218
218
  # @param trading_crypto_spot_place_order_request [TradingCryptoSpotPlaceOrderRequest]
219
219
  # @param [Hash] opts the optional parameters
220
- # @return [AccountOrderRecord]
220
+ # @return [OrderUpdatedResponse]
221
221
  private def crypto_spot_place_order_impl(user_id, user_secret, account_id, trading_crypto_spot_place_order_request, opts = {})
222
222
  data, _status_code, _headers = crypto_spot_place_order_with_http_info(user_id, user_secret, account_id, trading_crypto_spot_place_order_request, opts)
223
223
  data
@@ -230,7 +230,7 @@ module SnapTrade
230
230
  # @param account_id [String]
231
231
  # @param trading_crypto_spot_place_order_request [TradingCryptoSpotPlaceOrderRequest]
232
232
  # @param [Hash] opts the optional parameters
233
- # @return [Array<(AccountOrderRecord, Integer, Hash)>] AccountOrderRecord data, response status code and response headers
233
+ # @return [Array<(OrderUpdatedResponse, Integer, Hash)>] OrderUpdatedResponse data, response status code and response headers
234
234
  private def crypto_spot_place_order_with_http_info_impl(user_id, user_secret, account_id, trading_crypto_spot_place_order_request, opts = {})
235
235
  if @api_client.config.debugging
236
236
  @api_client.config.logger.debug 'Calling API: CryptoSpotTradingApi.crypto_spot_place_order ...'
@@ -276,7 +276,7 @@ module SnapTrade
276
276
  post_body = opts[:debug_body] || @api_client.object_to_http_body(trading_crypto_spot_place_order_request)
277
277
 
278
278
  # return_type
279
- return_type = opts[:debug_return_type] || 'AccountOrderRecord'
279
+ return_type = opts[:debug_return_type] || 'OrderUpdatedResponse'
280
280
 
281
281
  # auth_names
282
282
  auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
@@ -299,7 +299,7 @@ module SnapTrade
299
299
  end
300
300
 
301
301
 
302
- # Place a spot order on a crypto exchange
302
+ # Preview a crypto spot order
303
303
  #
304
304
  # Previews a cryptocurrency spot order using the specified account.
305
305
  #
@@ -313,7 +313,7 @@ module SnapTrade
313
313
  # @param account_id [String]
314
314
  # @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
315
315
  # @param stop_price [Float] The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT, TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
316
- # @param post_only [Boolean] Required for order type LIMIT. If true orders that would be filled immediately are rejected to avoid incurring TAKER fees.
316
+ # @param post_only [Boolean] Valid and required only for order type LIMIT. If true orders that would be filled immediately are rejected to avoid incurring TAKER fees.
317
317
  # @param expiration_date [Time] The expiration date of the order. Required if the time_in_force is GTD.
318
318
  # @param body [TradingCryptoSpotPlaceOrderRequest]
319
319
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
@@ -333,7 +333,7 @@ module SnapTrade
333
333
  data
334
334
  end
335
335
 
336
- # Place a spot order on a crypto exchange
336
+ # Preview a crypto spot order
337
337
  #
338
338
  # Previews a cryptocurrency spot order using the specified account.
339
339
  #
@@ -347,7 +347,7 @@ module SnapTrade
347
347
  # @param account_id [String]
348
348
  # @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
349
349
  # @param stop_price [Float] The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT, TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
350
- # @param post_only [Boolean] Required for order type LIMIT. If true orders that would be filled immediately are rejected to avoid incurring TAKER fees.
350
+ # @param post_only [Boolean] Valid and required only for order type LIMIT. If true orders that would be filled immediately are rejected to avoid incurring TAKER fees.
351
351
  # @param expiration_date [Time] The expiration date of the order. Required if the time_in_force is GTD.
352
352
  # @param body [TradingCryptoSpotPlaceOrderRequest]
353
353
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
@@ -366,7 +366,7 @@ module SnapTrade
366
366
  crypto_spot_preview_order_with_http_info_impl(user_id, user_secret, account_id, trading_crypto_spot_place_order_request, extra)
367
367
  end
368
368
 
369
- # Place a spot order on a crypto exchange
369
+ # Preview a crypto spot order
370
370
  # Previews a cryptocurrency spot order using the specified account.
371
371
  # @param user_id [String]
372
372
  # @param user_secret [String]
@@ -379,7 +379,7 @@ module SnapTrade
379
379
  data
380
380
  end
381
381
 
382
- # Place a spot order on a crypto exchange
382
+ # Preview a crypto spot order
383
383
  # Previews a cryptocurrency spot order using the specified account.
384
384
  # @param user_id [String]
385
385
  # @param user_secret [String]
@@ -455,7 +455,7 @@ module SnapTrade
455
455
  end
456
456
 
457
457
 
458
- # Get a quote for a cyrptocurrency market
458
+ # Get a cryptocurrency spot market quote
459
459
  #
460
460
  # Gets a quote for the specified account.
461
461
  #
@@ -470,7 +470,7 @@ module SnapTrade
470
470
  data
471
471
  end
472
472
 
473
- # Get a quote for a cyrptocurrency market
473
+ # Get a cryptocurrency spot market quote
474
474
  #
475
475
  # Gets a quote for the specified account.
476
476
  #
@@ -484,7 +484,7 @@ module SnapTrade
484
484
  crypto_spot_quote_with_http_info_impl(user_id, user_secret, account_id, base, quote, extra)
485
485
  end
486
486
 
487
- # Get a quote for a cyrptocurrency market
487
+ # Get a cryptocurrency spot market quote
488
488
  # Gets a quote for the specified account.
489
489
  # @param user_id [String]
490
490
  # @param user_secret [String]
@@ -498,7 +498,7 @@ module SnapTrade
498
498
  data
499
499
  end
500
500
 
501
- # Get a quote for a cyrptocurrency market
501
+ # Get a cryptocurrency spot market quote
502
502
  # Gets a quote for the specified account.
503
503
  # @param user_id [String]
504
504
  # @param user_secret [String]
@@ -23,6 +23,10 @@ module SnapTrade
23
23
 
24
24
  attr_accessor :option_symbol
25
25
 
26
+ attr_accessor :quote_universal_symbol
27
+
28
+ attr_accessor :quote_currency
29
+
26
30
  # The action describes the intent or side of a trade. This is usually `BUY` or `SELL` but can include other potential values like the following depending on the specific brokerage. - BUY - SELL - BUY_COVER - SELL_SHORT - BUY_OPEN - BUY_CLOSE - SELL_OPEN - SELL_CLOSE
27
31
  attr_accessor :action
28
32
 
@@ -77,6 +81,8 @@ module SnapTrade
77
81
  :'status' => :'status',
78
82
  :'universal_symbol' => :'universal_symbol',
79
83
  :'option_symbol' => :'option_symbol',
84
+ :'quote_universal_symbol' => :'quote_universal_symbol',
85
+ :'quote_currency' => :'quote_currency',
80
86
  :'action' => :'action',
81
87
  :'total_quantity' => :'total_quantity',
82
88
  :'open_quantity' => :'open_quantity',
@@ -108,6 +114,8 @@ module SnapTrade
108
114
  :'status' => :'AccountOrderRecordStatus',
109
115
  :'universal_symbol' => :'AccountOrderRecordUniversalSymbol',
110
116
  :'option_symbol' => :'AccountOrderRecordOptionSymbol',
117
+ :'quote_universal_symbol' => :'AccountOrderRecordQuoteUniversalSymbol',
118
+ :'quote_currency' => :'AccountOrderRecordQuoteCurrency',
111
119
  :'action' => :'String',
112
120
  :'total_quantity' => :'Float',
113
121
  :'open_quantity' => :'Float',
@@ -176,6 +184,14 @@ module SnapTrade
176
184
  self.option_symbol = attributes[:'option_symbol']
177
185
  end
178
186
 
187
+ if attributes.key?(:'quote_universal_symbol')
188
+ self.quote_universal_symbol = attributes[:'quote_universal_symbol']
189
+ end
190
+
191
+ if attributes.key?(:'quote_currency')
192
+ self.quote_currency = attributes[:'quote_currency']
193
+ end
194
+
179
195
  if attributes.key?(:'action')
180
196
  self.action = attributes[:'action']
181
197
  end
@@ -263,6 +279,8 @@ module SnapTrade
263
279
  status == o.status &&
264
280
  universal_symbol == o.universal_symbol &&
265
281
  option_symbol == o.option_symbol &&
282
+ quote_universal_symbol == o.quote_universal_symbol &&
283
+ quote_currency == o.quote_currency &&
266
284
  action == o.action &&
267
285
  total_quantity == o.total_quantity &&
268
286
  open_quantity == o.open_quantity &&
@@ -290,7 +308,7 @@ module SnapTrade
290
308
  # Calculates hash code according to all attributes.
291
309
  # @return [Integer] Hash code
292
310
  def hash
293
- [brokerage_order_id, status, universal_symbol, option_symbol, action, total_quantity, open_quantity, canceled_quantity, filled_quantity, execution_price, limit_price, stop_price, order_type, time_in_force, time_placed, time_updated, time_executed, expiry_date, symbol, child_brokerage_order_ids].hash
311
+ [brokerage_order_id, status, universal_symbol, option_symbol, quote_universal_symbol, quote_currency, action, total_quantity, open_quantity, canceled_quantity, filled_quantity, execution_price, limit_price, stop_price, order_type, time_in_force, time_placed, time_updated, time_executed, expiry_date, symbol, child_brokerage_order_ids].hash
294
312
  end
295
313
 
296
314
  # Builds the object from hash
@@ -0,0 +1,245 @@
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
+ # Quote currency. This field is only present for cryptocurrency pair orders with a fiat currency as quote.
15
+ class AccountOrderRecordQuoteCurrency
16
+ # Unique identifier for the currency. This is the UUID used to reference the currency in SnapTrade.
17
+ attr_accessor :id
18
+
19
+ # The ISO-4217 currency code for the currency.
20
+ attr_accessor :code
21
+
22
+ # A human-friendly name of the currency.
23
+ attr_accessor :name
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'id' => :'id',
29
+ :'code' => :'code',
30
+ :'name' => :'name'
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
+ :'id' => :'String',
43
+ :'code' => :'String',
44
+ :'name' => :'String'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # List of class defined in allOf (OpenAPI v3)
55
+ def self.openapi_all_of
56
+ [
57
+ :'Currency'
58
+ ]
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::AccountOrderRecordQuoteCurrency` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::AccountOrderRecordQuoteCurrency`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'id')
77
+ self.id = attributes[:'id']
78
+ end
79
+
80
+ if attributes.key?(:'code')
81
+ self.code = attributes[:'code']
82
+ end
83
+
84
+ if attributes.key?(:'name')
85
+ self.name = attributes[:'name']
86
+ end
87
+ end
88
+
89
+ # Show invalid properties with the reasons. Usually used together with valid?
90
+ # @return Array for valid properties with the reasons
91
+ def list_invalid_properties
92
+ invalid_properties = Array.new
93
+ invalid_properties
94
+ end
95
+
96
+ # Check to see if the all the properties in the model are valid
97
+ # @return true if the model is valid
98
+ def valid?
99
+ true
100
+ end
101
+
102
+ # Checks equality by comparing each attribute.
103
+ # @param [Object] Object to be compared
104
+ def ==(o)
105
+ return true if self.equal?(o)
106
+ self.class == o.class &&
107
+ id == o.id &&
108
+ code == o.code &&
109
+ name == o.name
110
+ end
111
+
112
+ # @see the `==` method
113
+ # @param [Object] Object to be compared
114
+ def eql?(o)
115
+ self == o
116
+ end
117
+
118
+ # Calculates hash code according to all attributes.
119
+ # @return [Integer] Hash code
120
+ def hash
121
+ [id, code, name].hash
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 self.build_from_hash(attributes)
128
+ new.build_from_hash(attributes)
129
+ end
130
+
131
+ # Builds the object from hash
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ # @return [Object] Returns the model itself
134
+ def build_from_hash(attributes)
135
+ return nil unless attributes.is_a?(Hash)
136
+ attributes = attributes.transform_keys(&:to_sym)
137
+ self.class.openapi_types.each_pair do |key, type|
138
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
139
+ self.send("#{key}=", nil)
140
+ elsif type =~ /\AArray<(.*)>/i
141
+ # check to ensure the input is an array given that the attribute
142
+ # is documented as an array but the input is not
143
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
144
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
145
+ end
146
+ elsif !attributes[self.class.attribute_map[key]].nil?
147
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
148
+ end
149
+ end
150
+
151
+ self
152
+ end
153
+
154
+ # Deserializes the data based on type
155
+ # @param string type Data type
156
+ # @param string value Value to be deserialized
157
+ # @return [Object] Deserialized data
158
+ def _deserialize(type, value)
159
+ case type.to_sym
160
+ when :Time
161
+ Time.parse(value)
162
+ when :Date
163
+ Date.parse(value)
164
+ when :String
165
+ value.to_s
166
+ when :Integer
167
+ value.to_i
168
+ when :Float
169
+ value.to_f
170
+ when :Boolean
171
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
172
+ true
173
+ else
174
+ false
175
+ end
176
+ when :Object
177
+ # generic object (usually a Hash), return directly
178
+ value
179
+ when /\AArray<(?<inner_type>.+)>\z/
180
+ inner_type = Regexp.last_match[:inner_type]
181
+ value.map { |v| _deserialize(inner_type, v) }
182
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
183
+ k_type = Regexp.last_match[:k_type]
184
+ v_type = Regexp.last_match[:v_type]
185
+ {}.tap do |hash|
186
+ value.each do |k, v|
187
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
188
+ end
189
+ end
190
+ else # model
191
+ # models (e.g. Pet) or oneOf
192
+ klass = SnapTrade.const_get(type)
193
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
194
+ end
195
+ end
196
+
197
+ # Returns the string representation of the object
198
+ # @return [String] String presentation of the object
199
+ def to_s
200
+ to_hash.to_s
201
+ end
202
+
203
+ # to_body is an alias to to_hash (backward compatibility)
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_body
206
+ to_hash
207
+ end
208
+
209
+ # Returns the object in the form of hash
210
+ # @return [Hash] Returns the object in the form of hash
211
+ def to_hash
212
+ hash = {}
213
+ self.class.attribute_map.each_pair do |attr, param|
214
+ value = self.send(attr)
215
+ if value.nil?
216
+ is_nullable = self.class.openapi_nullable.include?(attr)
217
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
218
+ end
219
+
220
+ hash[param] = _to_hash(value)
221
+ end
222
+ hash
223
+ end
224
+
225
+ # Outputs non-array value in the form of hash
226
+ # For object, use to_hash. Otherwise, just return the value
227
+ # @param [Object] value Any valid value
228
+ # @return [Hash] Returns the value in the form of hash
229
+ def _to_hash(value)
230
+ if value.is_a?(Array)
231
+ value.compact.map { |v| _to_hash(v) }
232
+ elsif value.is_a?(Hash)
233
+ {}.tap do |hash|
234
+ value.each { |k, v| hash[k] = _to_hash(v) }
235
+ end
236
+ elsif value.respond_to? :to_hash
237
+ value.to_hash
238
+ else
239
+ value
240
+ end
241
+ end
242
+
243
+ end
244
+
245
+ end