snaptrade 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (422) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +10 -0
  3. data/Gemfile.lock +84 -0
  4. data/README.md +254 -0
  5. data/Rakefile +10 -0
  6. data/docs/APIStatusApi.md +57 -0
  7. data/docs/Account.md +36 -0
  8. data/docs/AccountHoldings.md +24 -0
  9. data/docs/AccountHoldingsAccount.md +26 -0
  10. data/docs/AccountInformationApi.md +535 -0
  11. data/docs/AccountOrderRecord.md +52 -0
  12. data/docs/AccountOrderRecordStatus.md +15 -0
  13. data/docs/AccountSimple.md +24 -0
  14. data/docs/AccountSyncStatus.md +18 -0
  15. data/docs/Action.md +15 -0
  16. data/docs/AuthType.md +15 -0
  17. data/docs/AuthenticationApi.md +314 -0
  18. data/docs/AuthenticationLoginSnapTradeUser200Response.md +49 -0
  19. data/docs/Balance.md +20 -0
  20. data/docs/Brokerage.md +52 -0
  21. data/docs/BrokerageAuthorization.md +34 -0
  22. data/docs/BrokerageAuthorizationType.md +18 -0
  23. data/docs/BrokerageAuthorizationTypeReadOnly.md +24 -0
  24. data/docs/BrokerageAuthorizationTypeReadOnlyBrokerage.md +22 -0
  25. data/docs/BrokerageAuthorizationTypeReadOnlyType.md +15 -0
  26. data/docs/BrokerageAuthorizationTypeType.md +15 -0
  27. data/docs/BrokerageSymbol.md +26 -0
  28. data/docs/BrokerageType.md +20 -0
  29. data/docs/CalculatedTrade.md +20 -0
  30. data/docs/CashRestriction.md +26 -0
  31. data/docs/ConnectionType.md +15 -0
  32. data/docs/ConnectionsApi.md +265 -0
  33. data/docs/ConnectionsSessionEvents200ResponseInner.md +30 -0
  34. data/docs/Currency.md +22 -0
  35. data/docs/DeleteUserResponse.md +20 -0
  36. data/docs/DividendAtDate.md +22 -0
  37. data/docs/EncryptedResponse.md +20 -0
  38. data/docs/EncryptedResponseEncryptedMessageData.md +22 -0
  39. data/docs/ErrorLogsApi.md +68 -0
  40. data/docs/Exchange.md +32 -0
  41. data/docs/ExchangeRatePairs.md +22 -0
  42. data/docs/ExcludedAsset.md +18 -0
  43. data/docs/JWT.md +18 -0
  44. data/docs/LoginRedirectURI.md +20 -0
  45. data/docs/ManualTrade.md +32 -0
  46. data/docs/ManualTradeAndImpact.md +22 -0
  47. data/docs/ManualTradeBalance.md +22 -0
  48. data/docs/ManualTradeForm.md +32 -0
  49. data/docs/ManualTradeSymbol.md +28 -0
  50. data/docs/Model400FailedRequestResponse.md +20 -0
  51. data/docs/Model401FailedRequestResponse.md +20 -0
  52. data/docs/Model403FailedRequestResponse.md +20 -0
  53. data/docs/Model404FailedRequestResponse.md +20 -0
  54. data/docs/ModelAssetClass.md +20 -0
  55. data/docs/ModelAssetClassDetails.md +20 -0
  56. data/docs/ModelAssetClassTarget.md +18 -0
  57. data/docs/ModelPortfolio.md +22 -0
  58. data/docs/ModelPortfolioAssetClass.md +20 -0
  59. data/docs/ModelPortfolioDetails.md +22 -0
  60. data/docs/ModelPortfolioSecurity.md +20 -0
  61. data/docs/ModelType.md +15 -0
  62. data/docs/MonthlyDividends.md +20 -0
  63. data/docs/NetContributions.md +22 -0
  64. data/docs/NetDividend.md +22 -0
  65. data/docs/OptionChainInner.md +26 -0
  66. data/docs/OptionChainInnerChainPerRootInner.md +22 -0
  67. data/docs/OptionChainInnerChainPerRootInnerChainPerStrikePriceInner.md +22 -0
  68. data/docs/OptionLeg.md +22 -0
  69. data/docs/OptionLegAction.md +15 -0
  70. data/docs/OptionStrategy.md +26 -0
  71. data/docs/OptionStrategyLegsInner.md +24 -0
  72. data/docs/OptionsApi.md +390 -0
  73. data/docs/OptionsGetOptionStrategyRequest.md +22 -0
  74. data/docs/OptionsHoldings.md +28 -0
  75. data/docs/OptionsPlaceOptionStrategyRequest.md +22 -0
  76. data/docs/OptionsPosition.md +30 -0
  77. data/docs/OptionsSymbol.md +38 -0
  78. data/docs/OrderStrategyExecuteBodyOrderType.md +15 -0
  79. data/docs/OrderStrategyExecuteBodyTimeInForce.md +15 -0
  80. data/docs/OrderType.md +15 -0
  81. data/docs/PartnerData.md +40 -0
  82. data/docs/PastValue.md +22 -0
  83. data/docs/PerformanceCustom.md +54 -0
  84. data/docs/PortfolioGroup.md +20 -0
  85. data/docs/PortfolioGroupInfo.md +38 -0
  86. data/docs/PortfolioGroupPosition.md +22 -0
  87. data/docs/PortfolioGroupSettings.md +26 -0
  88. data/docs/PortfolioManagementApi.md +2014 -0
  89. data/docs/Position.md +28 -0
  90. data/docs/PositionSymbol.md +28 -0
  91. data/docs/RedirectTokenandPin.md +20 -0
  92. data/docs/ReferenceDataApi.md +595 -0
  93. data/docs/SecurityType.md +24 -0
  94. data/docs/SessionEvent.md +30 -0
  95. data/docs/SessionEventType.md +15 -0
  96. data/docs/SnapTradeAPIDisclaimerAcceptStatus.md +20 -0
  97. data/docs/SnapTradeHoldingsAccount.md +32 -0
  98. data/docs/SnapTradeHoldingsAccountAccountId.md +34 -0
  99. data/docs/SnapTradeHoldingsTotalValue.md +20 -0
  100. data/docs/SnapTradeLoginUserRequestBody.md +26 -0
  101. data/docs/SnapTradeRegisterUserRequestBody.md +20 -0
  102. data/docs/State.md +15 -0
  103. data/docs/Status.md +22 -0
  104. data/docs/StrategyImpact.md +38 -0
  105. data/docs/StrategyImpactLegsInner.md +30 -0
  106. data/docs/StrategyOrderPlace.md +20 -0
  107. data/docs/StrategyOrderPlaceOrdersInner.md +102 -0
  108. data/docs/StrategyOrderPlaceOrdersInnerLegsInner.md +30 -0
  109. data/docs/StrategyOrderRecord.md +38 -0
  110. data/docs/StrategyOrderRecordOrderType.md +15 -0
  111. data/docs/StrategyOrderRecordStatus.md +15 -0
  112. data/docs/StrategyOrderRecordTimeInForce.md +15 -0
  113. data/docs/StrategyQuotes.md +28 -0
  114. data/docs/StrategyQuotesGreek.md +26 -0
  115. data/docs/StrategyType.md +15 -0
  116. data/docs/SubPeriodReturnRate.md +22 -0
  117. data/docs/Symbol.md +30 -0
  118. data/docs/SymbolQuery.md +18 -0
  119. data/docs/SymbolsQuotes.md +28 -0
  120. data/docs/TargetAsset.md +28 -0
  121. data/docs/TimeInForce.md +15 -0
  122. data/docs/Trade.md +32 -0
  123. data/docs/TradeAction.md +15 -0
  124. data/docs/TradeExecutionStatus.md +34 -0
  125. data/docs/TradeExecutionStatusAction.md +15 -0
  126. data/docs/TradeImpact.md +26 -0
  127. data/docs/TradingApi.md +799 -0
  128. data/docs/TradingCancelUserAccountOrderRequest.md +18 -0
  129. data/docs/TradingPlaceOCOOrderRequest.md +20 -0
  130. data/docs/TransactionsAndReportingApi.md +183 -0
  131. data/docs/TransactionsStatus.md +20 -0
  132. data/docs/Type.md +15 -0
  133. data/docs/USExchange.md +34 -0
  134. data/docs/UnderlyingSymbol.md +30 -0
  135. data/docs/UniversalActivity.md +46 -0
  136. data/docs/UniversalSymbol.md +32 -0
  137. data/docs/UniversalSymbolTicker.md +32 -0
  138. data/docs/UserErrorLog.md +28 -0
  139. data/docs/UserIDandSecret.md +20 -0
  140. data/docs/UserSettings.md +36 -0
  141. data/lib/snaptrade/api/account_information_api.rb +801 -0
  142. data/lib/snaptrade/api/api_status_api.rb +98 -0
  143. data/lib/snaptrade/api/authentication_api.rb +481 -0
  144. data/lib/snaptrade/api/connections_api.rb +398 -0
  145. data/lib/snaptrade/api/error_logs_api.rb +112 -0
  146. data/lib/snaptrade/api/options_api.rb +591 -0
  147. data/lib/snaptrade/api/portfolio_management_api.rb +2791 -0
  148. data/lib/snaptrade/api/reference_data_api.rb +894 -0
  149. data/lib/snaptrade/api/trading_api.rb +1150 -0
  150. data/lib/snaptrade/api/transactions_and_reporting_api.rb +283 -0
  151. data/lib/snaptrade/api_client.rb +427 -0
  152. data/lib/snaptrade/api_client_custom.rb +32 -0
  153. data/lib/snaptrade/api_error.rb +55 -0
  154. data/lib/snaptrade/configuration.rb +374 -0
  155. data/lib/snaptrade/models/account.rb +303 -0
  156. data/lib/snaptrade/models/account_holdings.rb +249 -0
  157. data/lib/snaptrade/models/account_holdings_account.rb +260 -0
  158. data/lib/snaptrade/models/account_order_record.rb +382 -0
  159. data/lib/snaptrade/models/account_order_record_status.rb +56 -0
  160. data/lib/snaptrade/models/account_simple.rb +245 -0
  161. data/lib/snaptrade/models/account_sync_status.rb +218 -0
  162. data/lib/snaptrade/models/action.rb +38 -0
  163. data/lib/snaptrade/models/auth_type.rb +40 -0
  164. data/lib/snaptrade/models/authentication_login_snap_trade_user200_response.rb +103 -0
  165. data/lib/snaptrade/models/balance.rb +228 -0
  166. data/lib/snaptrade/models/brokerage.rb +377 -0
  167. data/lib/snaptrade/models/brokerage_authorization.rb +297 -0
  168. data/lib/snaptrade/models/brokerage_authorization_type.rb +217 -0
  169. data/lib/snaptrade/models/brokerage_authorization_type_read_only.rb +244 -0
  170. data/lib/snaptrade/models/brokerage_authorization_type_read_only_brokerage.rb +237 -0
  171. data/lib/snaptrade/models/brokerage_authorization_type_read_only_type.rb +38 -0
  172. data/lib/snaptrade/models/brokerage_authorization_type_type.rb +38 -0
  173. data/lib/snaptrade/models/brokerage_symbol.rb +255 -0
  174. data/lib/snaptrade/models/brokerage_type.rb +227 -0
  175. data/lib/snaptrade/models/calculated_trade.rb +229 -0
  176. data/lib/snaptrade/models/cash_restriction.rb +254 -0
  177. data/lib/snaptrade/models/connection_type.rb +38 -0
  178. data/lib/snaptrade/models/connections_session_events200_response_inner.rb +293 -0
  179. data/lib/snaptrade/models/currency.rb +236 -0
  180. data/lib/snaptrade/models/delete_user_response.rb +229 -0
  181. data/lib/snaptrade/models/dividend_at_date.rb +240 -0
  182. data/lib/snaptrade/models/encrypted_response.rb +227 -0
  183. data/lib/snaptrade/models/encrypted_response_encrypted_message_data.rb +235 -0
  184. data/lib/snaptrade/models/exchange.rb +282 -0
  185. data/lib/snaptrade/models/exchange_rate_pairs.rb +236 -0
  186. data/lib/snaptrade/models/excluded_asset.rb +218 -0
  187. data/lib/snaptrade/models/jwt.rb +218 -0
  188. data/lib/snaptrade/models/login_redirect_uri.rb +228 -0
  189. data/lib/snaptrade/models/manual_trade.rb +283 -0
  190. data/lib/snaptrade/models/manual_trade_and_impact.rb +238 -0
  191. data/lib/snaptrade/models/manual_trade_balance.rb +238 -0
  192. data/lib/snaptrade/models/manual_trade_form.rb +285 -0
  193. data/lib/snaptrade/models/manual_trade_symbol.rb +264 -0
  194. data/lib/snaptrade/models/model400_failed_request_response.rb +229 -0
  195. data/lib/snaptrade/models/model401_failed_request_response.rb +229 -0
  196. data/lib/snaptrade/models/model403_failed_request_response.rb +229 -0
  197. data/lib/snaptrade/models/model404_failed_request_response.rb +229 -0
  198. data/lib/snaptrade/models/model_asset_class.rb +226 -0
  199. data/lib/snaptrade/models/model_asset_class_details.rb +228 -0
  200. data/lib/snaptrade/models/model_asset_class_target.rb +217 -0
  201. data/lib/snaptrade/models/model_portfolio.rb +237 -0
  202. data/lib/snaptrade/models/model_portfolio_asset_class.rb +250 -0
  203. data/lib/snaptrade/models/model_portfolio_details.rb +239 -0
  204. data/lib/snaptrade/models/model_portfolio_security.rb +250 -0
  205. data/lib/snaptrade/models/model_type.rb +39 -0
  206. data/lib/snaptrade/models/monthly_dividends.rb +229 -0
  207. data/lib/snaptrade/models/net_contributions.rb +237 -0
  208. data/lib/snaptrade/models/net_dividend.rb +237 -0
  209. data/lib/snaptrade/models/option_chain_inner.rb +255 -0
  210. data/lib/snaptrade/models/option_chain_inner_chain_per_root_inner.rb +237 -0
  211. data/lib/snaptrade/models/option_chain_inner_chain_per_root_inner_chain_per_strike_price_inner.rb +238 -0
  212. data/lib/snaptrade/models/option_leg.rb +237 -0
  213. data/lib/snaptrade/models/option_leg_action.rb +40 -0
  214. data/lib/snaptrade/models/option_strategy.rb +255 -0
  215. data/lib/snaptrade/models/option_strategy_legs_inner.rb +244 -0
  216. data/lib/snaptrade/models/options_get_option_strategy_request.rb +252 -0
  217. data/lib/snaptrade/models/options_holdings.rb +267 -0
  218. data/lib/snaptrade/models/options_place_option_strategy_request.rb +251 -0
  219. data/lib/snaptrade/models/options_position.rb +275 -0
  220. data/lib/snaptrade/models/options_symbol.rb +310 -0
  221. data/lib/snaptrade/models/order_strategy_execute_body_order_type.rb +40 -0
  222. data/lib/snaptrade/models/order_strategy_execute_body_time_in_force.rb +38 -0
  223. data/lib/snaptrade/models/order_type.rb +40 -0
  224. data/lib/snaptrade/models/partner_data.rb +331 -0
  225. data/lib/snaptrade/models/past_value.rb +236 -0
  226. data/lib/snaptrade/models/performance_custom.rb +416 -0
  227. data/lib/snaptrade/models/portfolio_group.rb +226 -0
  228. data/lib/snaptrade/models/portfolio_group_info.rb +326 -0
  229. data/lib/snaptrade/models/portfolio_group_position.rb +238 -0
  230. data/lib/snaptrade/models/portfolio_group_settings.rb +277 -0
  231. data/lib/snaptrade/models/position.rb +271 -0
  232. data/lib/snaptrade/models/position_symbol.rb +264 -0
  233. data/lib/snaptrade/models/redirect_tokenand_pin.rb +227 -0
  234. data/lib/snaptrade/models/security_type.rb +245 -0
  235. data/lib/snaptrade/models/session_event.rb +274 -0
  236. data/lib/snaptrade/models/session_event_type.rb +43 -0
  237. data/lib/snaptrade/models/snap_trade_api_disclaimer_accept_status.rb +227 -0
  238. data/lib/snaptrade/models/snap_trade_holdings_account.rb +284 -0
  239. data/lib/snaptrade/models/snap_trade_holdings_account_account_id.rb +296 -0
  240. data/lib/snaptrade/models/snap_trade_holdings_total_value.rb +227 -0
  241. data/lib/snaptrade/models/snap_trade_login_user_request_body.rb +254 -0
  242. data/lib/snaptrade/models/snap_trade_register_user_request_body.rb +229 -0
  243. data/lib/snaptrade/models/state.rb +41 -0
  244. data/lib/snaptrade/models/status.rb +236 -0
  245. data/lib/snaptrade/models/strategy_impact.rb +310 -0
  246. data/lib/snaptrade/models/strategy_impact_legs_inner.rb +271 -0
  247. data/lib/snaptrade/models/strategy_order_place.rb +229 -0
  248. data/lib/snaptrade/models/strategy_order_place_orders_inner.rb +597 -0
  249. data/lib/snaptrade/models/strategy_order_place_orders_inner_legs_inner.rb +271 -0
  250. data/lib/snaptrade/models/strategy_order_record.rb +312 -0
  251. data/lib/snaptrade/models/strategy_order_record_order_type.rb +40 -0
  252. data/lib/snaptrade/models/strategy_order_record_status.rb +55 -0
  253. data/lib/snaptrade/models/strategy_order_record_time_in_force.rb +38 -0
  254. data/lib/snaptrade/models/strategy_quotes.rb +265 -0
  255. data/lib/snaptrade/models/strategy_quotes_greek.rb +253 -0
  256. data/lib/snaptrade/models/strategy_type.rb +37 -0
  257. data/lib/snaptrade/models/sub_period_return_rate.rb +239 -0
  258. data/lib/snaptrade/models/symbol.rb +272 -0
  259. data/lib/snaptrade/models/symbol_query.rb +218 -0
  260. data/lib/snaptrade/models/symbols_quotes.rb +263 -0
  261. data/lib/snaptrade/models/target_asset.rb +290 -0
  262. data/lib/snaptrade/models/time_in_force.rb +39 -0
  263. data/lib/snaptrade/models/trade.rb +281 -0
  264. data/lib/snaptrade/models/trade_action.rb +38 -0
  265. data/lib/snaptrade/models/trade_execution_status.rb +296 -0
  266. data/lib/snaptrade/models/trade_execution_status_action.rb +38 -0
  267. data/lib/snaptrade/models/trade_impact.rb +257 -0
  268. data/lib/snaptrade/models/trading_cancel_user_account_order_request.rb +217 -0
  269. data/lib/snaptrade/models/trading_place_oco_order_request.rb +230 -0
  270. data/lib/snaptrade/models/transactions_status.rb +229 -0
  271. data/lib/snaptrade/models/type.rb +38 -0
  272. data/lib/snaptrade/models/underlying_symbol.rb +275 -0
  273. data/lib/snaptrade/models/universal_activity.rb +349 -0
  274. data/lib/snaptrade/models/universal_symbol.rb +284 -0
  275. data/lib/snaptrade/models/universal_symbol_ticker.rb +283 -0
  276. data/lib/snaptrade/models/us_exchange.rb +291 -0
  277. data/lib/snaptrade/models/user_error_log.rb +263 -0
  278. data/lib/snaptrade/models/user_i_dand_secret.rb +229 -0
  279. data/lib/snaptrade/models/user_settings.rb +299 -0
  280. data/lib/snaptrade/version.rb +13 -0
  281. data/lib/snaptrade.rb +214 -0
  282. data/snaptrade.gemspec +41 -0
  283. data/spec/api/account_information_api_spec.rb +135 -0
  284. data/spec/api/api_status_api_spec.rb +42 -0
  285. data/spec/api/authentication_api_spec.rb +88 -0
  286. data/spec/api/connections_api_spec.rb +82 -0
  287. data/spec/api/error_logs_api_spec.rb +43 -0
  288. data/spec/api/options_api_spec.rb +101 -0
  289. data/spec/api/portfolio_management_api_spec.rb +395 -0
  290. data/spec/api/reference_data_api_spec.rb +150 -0
  291. data/spec/api/trading_api_spec.rb +163 -0
  292. data/spec/api/transactions_and_reporting_api_spec.rb +67 -0
  293. data/spec/api_client_spec.rb +193 -0
  294. data/spec/configuration_spec.rb +40 -0
  295. data/spec/getting_started_spec.rb +144 -0
  296. data/spec/models/account_holdings_account_spec.rb +54 -0
  297. data/spec/models/account_holdings_spec.rb +48 -0
  298. data/spec/models/account_order_record_spec.rb +132 -0
  299. data/spec/models/account_order_record_status_spec.rb +24 -0
  300. data/spec/models/account_simple_spec.rb +48 -0
  301. data/spec/models/account_spec.rb +84 -0
  302. data/spec/models/account_sync_status_spec.rb +30 -0
  303. data/spec/models/action_spec.rb +24 -0
  304. data/spec/models/auth_type_spec.rb +24 -0
  305. data/spec/models/authentication_login_snap_trade_user200_response_spec.rb +27 -0
  306. data/spec/models/balance_spec.rb +36 -0
  307. data/spec/models/brokerage_authorization_spec.rb +78 -0
  308. data/spec/models/brokerage_authorization_type_read_only_brokerage_spec.rb +42 -0
  309. data/spec/models/brokerage_authorization_type_read_only_spec.rb +48 -0
  310. data/spec/models/brokerage_authorization_type_read_only_type_spec.rb +24 -0
  311. data/spec/models/brokerage_authorization_type_spec.rb +30 -0
  312. data/spec/models/brokerage_authorization_type_type_spec.rb +24 -0
  313. data/spec/models/brokerage_spec.rb +132 -0
  314. data/spec/models/brokerage_symbol_spec.rb +54 -0
  315. data/spec/models/brokerage_type_spec.rb +36 -0
  316. data/spec/models/calculated_trade_spec.rb +36 -0
  317. data/spec/models/cash_restriction_spec.rb +54 -0
  318. data/spec/models/connection_type_spec.rb +24 -0
  319. data/spec/models/connections_session_events200_response_inner_spec.rb +66 -0
  320. data/spec/models/currency_spec.rb +42 -0
  321. data/spec/models/delete_user_response_spec.rb +36 -0
  322. data/spec/models/dividend_at_date_spec.rb +42 -0
  323. data/spec/models/encrypted_response_encrypted_message_data_spec.rb +42 -0
  324. data/spec/models/encrypted_response_spec.rb +36 -0
  325. data/spec/models/exchange_rate_pairs_spec.rb +42 -0
  326. data/spec/models/exchange_spec.rb +72 -0
  327. data/spec/models/excluded_asset_spec.rb +30 -0
  328. data/spec/models/jwt_spec.rb +30 -0
  329. data/spec/models/login_redirect_uri_spec.rb +36 -0
  330. data/spec/models/manual_trade_and_impact_spec.rb +42 -0
  331. data/spec/models/manual_trade_balance_spec.rb +42 -0
  332. data/spec/models/manual_trade_form_spec.rb +72 -0
  333. data/spec/models/manual_trade_spec.rb +72 -0
  334. data/spec/models/manual_trade_symbol_spec.rb +60 -0
  335. data/spec/models/model400_failed_request_response_spec.rb +36 -0
  336. data/spec/models/model401_failed_request_response_spec.rb +36 -0
  337. data/spec/models/model403_failed_request_response_spec.rb +36 -0
  338. data/spec/models/model404_failed_request_response_spec.rb +36 -0
  339. data/spec/models/model_asset_class_details_spec.rb +36 -0
  340. data/spec/models/model_asset_class_spec.rb +36 -0
  341. data/spec/models/model_asset_class_target_spec.rb +30 -0
  342. data/spec/models/model_portfolio_asset_class_spec.rb +36 -0
  343. data/spec/models/model_portfolio_details_spec.rb +42 -0
  344. data/spec/models/model_portfolio_security_spec.rb +36 -0
  345. data/spec/models/model_portfolio_spec.rb +42 -0
  346. data/spec/models/model_type_spec.rb +24 -0
  347. data/spec/models/monthly_dividends_spec.rb +36 -0
  348. data/spec/models/net_contributions_spec.rb +42 -0
  349. data/spec/models/net_dividend_spec.rb +42 -0
  350. data/spec/models/option_chain_inner_chain_per_root_inner_chain_per_strike_price_inner_spec.rb +42 -0
  351. data/spec/models/option_chain_inner_chain_per_root_inner_spec.rb +42 -0
  352. data/spec/models/option_chain_inner_spec.rb +54 -0
  353. data/spec/models/option_leg_action_spec.rb +24 -0
  354. data/spec/models/option_leg_spec.rb +42 -0
  355. data/spec/models/option_strategy_legs_inner_spec.rb +48 -0
  356. data/spec/models/option_strategy_spec.rb +54 -0
  357. data/spec/models/options_get_option_strategy_request_spec.rb +42 -0
  358. data/spec/models/options_holdings_spec.rb +60 -0
  359. data/spec/models/options_place_option_strategy_request_spec.rb +42 -0
  360. data/spec/models/options_position_spec.rb +66 -0
  361. data/spec/models/options_symbol_spec.rb +90 -0
  362. data/spec/models/order_strategy_execute_body_order_type_spec.rb +24 -0
  363. data/spec/models/order_strategy_execute_body_time_in_force_spec.rb +24 -0
  364. data/spec/models/order_type_spec.rb +24 -0
  365. data/spec/models/partner_data_spec.rb +96 -0
  366. data/spec/models/past_value_spec.rb +42 -0
  367. data/spec/models/performance_custom_spec.rb +138 -0
  368. data/spec/models/portfolio_group_info_spec.rb +90 -0
  369. data/spec/models/portfolio_group_position_spec.rb +42 -0
  370. data/spec/models/portfolio_group_settings_spec.rb +54 -0
  371. data/spec/models/portfolio_group_spec.rb +36 -0
  372. data/spec/models/position_spec.rb +60 -0
  373. data/spec/models/position_symbol_spec.rb +60 -0
  374. data/spec/models/redirect_tokenand_pin_spec.rb +36 -0
  375. data/spec/models/security_type_spec.rb +48 -0
  376. data/spec/models/session_event_spec.rb +66 -0
  377. data/spec/models/session_event_type_spec.rb +24 -0
  378. data/spec/models/snap_trade_api_disclaimer_accept_status_spec.rb +36 -0
  379. data/spec/models/snap_trade_holdings_account_account_id_spec.rb +78 -0
  380. data/spec/models/snap_trade_holdings_account_spec.rb +72 -0
  381. data/spec/models/snap_trade_holdings_total_value_spec.rb +36 -0
  382. data/spec/models/snap_trade_login_user_request_body_spec.rb +54 -0
  383. data/spec/models/snap_trade_register_user_request_body_spec.rb +36 -0
  384. data/spec/models/state_spec.rb +24 -0
  385. data/spec/models/status_spec.rb +42 -0
  386. data/spec/models/strategy_impact_legs_inner_spec.rb +66 -0
  387. data/spec/models/strategy_impact_spec.rb +90 -0
  388. data/spec/models/strategy_order_place_orders_inner_legs_inner_spec.rb +66 -0
  389. data/spec/models/strategy_order_place_orders_inner_spec.rb +282 -0
  390. data/spec/models/strategy_order_place_spec.rb +36 -0
  391. data/spec/models/strategy_order_record_order_type_spec.rb +24 -0
  392. data/spec/models/strategy_order_record_spec.rb +90 -0
  393. data/spec/models/strategy_order_record_status_spec.rb +24 -0
  394. data/spec/models/strategy_order_record_time_in_force_spec.rb +24 -0
  395. data/spec/models/strategy_quotes_greek_spec.rb +54 -0
  396. data/spec/models/strategy_quotes_spec.rb +60 -0
  397. data/spec/models/strategy_type_spec.rb +24 -0
  398. data/spec/models/sub_period_return_rate_spec.rb +42 -0
  399. data/spec/models/symbol_query_spec.rb +30 -0
  400. data/spec/models/symbol_spec.rb +66 -0
  401. data/spec/models/symbols_quotes_spec.rb +60 -0
  402. data/spec/models/target_asset_spec.rb +60 -0
  403. data/spec/models/time_in_force_spec.rb +24 -0
  404. data/spec/models/trade_action_spec.rb +24 -0
  405. data/spec/models/trade_execution_status_action_spec.rb +24 -0
  406. data/spec/models/trade_execution_status_spec.rb +78 -0
  407. data/spec/models/trade_impact_spec.rb +54 -0
  408. data/spec/models/trade_spec.rb +72 -0
  409. data/spec/models/trading_cancel_user_account_order_request_spec.rb +30 -0
  410. data/spec/models/trading_place_oco_order_request_spec.rb +36 -0
  411. data/spec/models/transactions_status_spec.rb +36 -0
  412. data/spec/models/type_spec.rb +24 -0
  413. data/spec/models/underlying_symbol_spec.rb +66 -0
  414. data/spec/models/universal_activity_spec.rb +114 -0
  415. data/spec/models/universal_symbol_spec.rb +72 -0
  416. data/spec/models/universal_symbol_ticker_spec.rb +72 -0
  417. data/spec/models/us_exchange_spec.rb +78 -0
  418. data/spec/models/user_error_log_spec.rb +60 -0
  419. data/spec/models/user_i_dand_secret_spec.rb +36 -0
  420. data/spec/models/user_settings_spec.rb +84 -0
  421. data/spec/spec_helper.rb +109 -0
  422. metadata +664 -0
@@ -0,0 +1,382 @@
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
+
9
+ =end
10
+
11
+ require 'date'
12
+ require 'time'
13
+
14
+ module SnapTrade
15
+ # Record of order in brokerageaccount
16
+ class AccountOrderRecord
17
+ # Order id returned by brokerage
18
+ attr_accessor :brokerage_order_id
19
+
20
+ attr_accessor :status
21
+
22
+ attr_accessor :symbol
23
+
24
+ attr_accessor :universal_symbol
25
+
26
+ attr_accessor :option_symbol
27
+
28
+ attr_accessor :action
29
+
30
+ # Trade Units
31
+ attr_accessor :total_quantity
32
+
33
+ # Trade Units
34
+ attr_accessor :open_quantity
35
+
36
+ # Trade Units
37
+ attr_accessor :canceled_quantity
38
+
39
+ # Trade Units
40
+ attr_accessor :filled_quantity
41
+
42
+ # Trade Price if limit or stop limit order
43
+ attr_accessor :execution_price
44
+
45
+ # Trade Price if limit or stop limit order
46
+ attr_accessor :limit_price
47
+
48
+ # Trade Price if limit or stop limit order
49
+ attr_accessor :stop_price
50
+
51
+ attr_accessor :order_type
52
+
53
+ attr_accessor :time_in_force
54
+
55
+ # Time
56
+ attr_accessor :time_placed
57
+
58
+ # Time
59
+ attr_accessor :time_updated
60
+
61
+ # Time
62
+ attr_accessor :expiry_date
63
+
64
+ # Attribute mapping from ruby-style variable name to JSON key.
65
+ def self.attribute_map
66
+ {
67
+ :'brokerage_order_id' => :'brokerage_order_id',
68
+ :'status' => :'status',
69
+ :'symbol' => :'symbol',
70
+ :'universal_symbol' => :'universal_symbol',
71
+ :'option_symbol' => :'option_symbol',
72
+ :'action' => :'action',
73
+ :'total_quantity' => :'total_quantity',
74
+ :'open_quantity' => :'open_quantity',
75
+ :'canceled_quantity' => :'canceled_quantity',
76
+ :'filled_quantity' => :'filled_quantity',
77
+ :'execution_price' => :'execution_price',
78
+ :'limit_price' => :'limit_price',
79
+ :'stop_price' => :'stop_price',
80
+ :'order_type' => :'order_type',
81
+ :'time_in_force' => :'time_in_force',
82
+ :'time_placed' => :'time_placed',
83
+ :'time_updated' => :'time_updated',
84
+ :'expiry_date' => :'expiry_date'
85
+ }
86
+ end
87
+
88
+ # Returns all the JSON keys this model knows about
89
+ def self.acceptable_attributes
90
+ attribute_map.values
91
+ end
92
+
93
+ # Attribute type mapping.
94
+ def self.openapi_types
95
+ {
96
+ :'brokerage_order_id' => :'String',
97
+ :'status' => :'AccountOrderRecordStatus',
98
+ :'symbol' => :'String',
99
+ :'universal_symbol' => :'UniversalSymbol',
100
+ :'option_symbol' => :'OptionsSymbol',
101
+ :'action' => :'Action',
102
+ :'total_quantity' => :'Float',
103
+ :'open_quantity' => :'Float',
104
+ :'canceled_quantity' => :'Float',
105
+ :'filled_quantity' => :'Float',
106
+ :'execution_price' => :'Float',
107
+ :'limit_price' => :'Float',
108
+ :'stop_price' => :'Float',
109
+ :'order_type' => :'OrderType',
110
+ :'time_in_force' => :'TimeInForce',
111
+ :'time_placed' => :'String',
112
+ :'time_updated' => :'String',
113
+ :'expiry_date' => :'String'
114
+ }
115
+ end
116
+
117
+ # List of attributes with nullable: true
118
+ def self.openapi_nullable
119
+ Set.new([
120
+ ])
121
+ end
122
+
123
+ # Initializes the object
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ def initialize(attributes = {})
126
+ if (!attributes.is_a?(Hash))
127
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::AccountOrderRecord` initialize method"
128
+ end
129
+
130
+ # check to see if the attribute exists and convert string to symbol for hash key
131
+ attributes = attributes.each_with_object({}) { |(k, v), h|
132
+ if (!self.class.attribute_map.key?(k.to_sym))
133
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::AccountOrderRecord`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
134
+ end
135
+ h[k.to_sym] = v
136
+ }
137
+
138
+ if attributes.key?(:'brokerage_order_id')
139
+ self.brokerage_order_id = attributes[:'brokerage_order_id']
140
+ end
141
+
142
+ if attributes.key?(:'status')
143
+ self.status = attributes[:'status']
144
+ end
145
+
146
+ if attributes.key?(:'symbol')
147
+ self.symbol = attributes[:'symbol']
148
+ end
149
+
150
+ if attributes.key?(:'universal_symbol')
151
+ self.universal_symbol = attributes[:'universal_symbol']
152
+ end
153
+
154
+ if attributes.key?(:'option_symbol')
155
+ self.option_symbol = attributes[:'option_symbol']
156
+ end
157
+
158
+ if attributes.key?(:'action')
159
+ self.action = attributes[:'action']
160
+ end
161
+
162
+ if attributes.key?(:'total_quantity')
163
+ self.total_quantity = attributes[:'total_quantity']
164
+ end
165
+
166
+ if attributes.key?(:'open_quantity')
167
+ self.open_quantity = attributes[:'open_quantity']
168
+ end
169
+
170
+ if attributes.key?(:'canceled_quantity')
171
+ self.canceled_quantity = attributes[:'canceled_quantity']
172
+ end
173
+
174
+ if attributes.key?(:'filled_quantity')
175
+ self.filled_quantity = attributes[:'filled_quantity']
176
+ end
177
+
178
+ if attributes.key?(:'execution_price')
179
+ self.execution_price = attributes[:'execution_price']
180
+ end
181
+
182
+ if attributes.key?(:'limit_price')
183
+ self.limit_price = attributes[:'limit_price']
184
+ end
185
+
186
+ if attributes.key?(:'stop_price')
187
+ self.stop_price = attributes[:'stop_price']
188
+ end
189
+
190
+ if attributes.key?(:'order_type')
191
+ self.order_type = attributes[:'order_type']
192
+ end
193
+
194
+ if attributes.key?(:'time_in_force')
195
+ self.time_in_force = attributes[:'time_in_force']
196
+ end
197
+
198
+ if attributes.key?(:'time_placed')
199
+ self.time_placed = attributes[:'time_placed']
200
+ end
201
+
202
+ if attributes.key?(:'time_updated')
203
+ self.time_updated = attributes[:'time_updated']
204
+ end
205
+
206
+ if attributes.key?(:'expiry_date')
207
+ self.expiry_date = attributes[:'expiry_date']
208
+ end
209
+ end
210
+
211
+ # Show invalid properties with the reasons. Usually used together with valid?
212
+ # @return Array for valid properties with the reasons
213
+ def list_invalid_properties
214
+ invalid_properties = Array.new
215
+ invalid_properties
216
+ end
217
+
218
+ # Check to see if the all the properties in the model are valid
219
+ # @return true if the model is valid
220
+ def valid?
221
+ true
222
+ end
223
+
224
+ # Checks equality by comparing each attribute.
225
+ # @param [Object] Object to be compared
226
+ def ==(o)
227
+ return true if self.equal?(o)
228
+ self.class == o.class &&
229
+ brokerage_order_id == o.brokerage_order_id &&
230
+ status == o.status &&
231
+ symbol == o.symbol &&
232
+ universal_symbol == o.universal_symbol &&
233
+ option_symbol == o.option_symbol &&
234
+ action == o.action &&
235
+ total_quantity == o.total_quantity &&
236
+ open_quantity == o.open_quantity &&
237
+ canceled_quantity == o.canceled_quantity &&
238
+ filled_quantity == o.filled_quantity &&
239
+ execution_price == o.execution_price &&
240
+ limit_price == o.limit_price &&
241
+ stop_price == o.stop_price &&
242
+ order_type == o.order_type &&
243
+ time_in_force == o.time_in_force &&
244
+ time_placed == o.time_placed &&
245
+ time_updated == o.time_updated &&
246
+ expiry_date == o.expiry_date
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
+ [brokerage_order_id, status, symbol, 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, expiry_date].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
@@ -0,0 +1,56 @@
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
+
9
+ =end
10
+
11
+ require 'date'
12
+ require 'time'
13
+
14
+ module SnapTrade
15
+ class AccountOrderRecordStatus
16
+ NONE = "NONE".freeze
17
+ PENDING = "PENDING".freeze
18
+ ACCEPTED = "ACCEPTED".freeze
19
+ FAILED = "FAILED".freeze
20
+ REJECTED = "REJECTED".freeze
21
+ CANCELED = "CANCELED".freeze
22
+ PARTIAL_CANCELED = "PARTIAL_CANCELED".freeze
23
+ CANCEL_PENDING = "CANCEL_PENDING".freeze
24
+ EXECUTED = "EXECUTED".freeze
25
+ PARTIAL = "PARTIAL".freeze
26
+ REPLACE_PENDING = "REPLACE_PENDING".freeze
27
+ REPLACED = "REPLACED".freeze
28
+ STOPPED = "STOPPED".freeze
29
+ SUSPENDED = "SUSPENDED".freeze
30
+ EXPIRED = "EXPIRED".freeze
31
+ QUEUED = "QUEUED".freeze
32
+ TRIGGERED = "TRIGGERED".freeze
33
+ ACTIVATED = "ACTIVATED".freeze
34
+ PENDING_RISK_REVIEW = "PENDING_RISK_REVIEW".freeze
35
+ CONTINGENT_ORDER = "CONTINGENT_ORDER".freeze
36
+
37
+ def self.all_vars
38
+ @all_vars ||= [NONE, PENDING, ACCEPTED, FAILED, REJECTED, CANCELED, PARTIAL_CANCELED, CANCEL_PENDING, EXECUTED, PARTIAL, REPLACE_PENDING, REPLACED, STOPPED, SUSPENDED, EXPIRED, QUEUED, TRIGGERED, ACTIVATED, PENDING_RISK_REVIEW, CONTINGENT_ORDER].freeze
39
+ end
40
+
41
+ # Builds the enum from string
42
+ # @param [String] The enum value in the form of the string
43
+ # @return [String] The enum value
44
+ def self.build_from_hash(value)
45
+ new.build_from_hash(value)
46
+ end
47
+
48
+ # Builds the enum from string
49
+ # @param [String] The enum value in the form of the string
50
+ # @return [String] The enum value
51
+ def build_from_hash(value)
52
+ return value if AccountOrderRecordStatus.all_vars.include?(value)
53
+ raise "Invalid ENUM value #{value} for class #AccountOrderRecordStatus"
54
+ end
55
+ end
56
+ end
@@ -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
+
9
+ =end
10
+
11
+ require 'date'
12
+ require 'time'
13
+
14
+ module SnapTrade
15
+ # SnapTradeUser Investment Account
16
+ class AccountSimple
17
+ attr_accessor :id
18
+
19
+ attr_accessor :name
20
+
21
+ attr_accessor :number
22
+
23
+ attr_accessor :sync_status
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'id' => :'id',
29
+ :'name' => :'name',
30
+ :'number' => :'number',
31
+ :'sync_status' => :'sync_status'
32
+ }
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'id' => :'String',
44
+ :'name' => :'String',
45
+ :'number' => :'String',
46
+ :'sync_status' => :'AccountSyncStatus'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::AccountSimple` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!self.class.attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::AccountSimple`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'id')
72
+ self.id = attributes[:'id']
73
+ end
74
+
75
+ if attributes.key?(:'name')
76
+ self.name = attributes[:'name']
77
+ end
78
+
79
+ if attributes.key?(:'number')
80
+ self.number = attributes[:'number']
81
+ end
82
+
83
+ if attributes.key?(:'sync_status')
84
+ self.sync_status = attributes[:'sync_status']
85
+ end
86
+ end
87
+
88
+ # Show invalid properties with the reasons. Usually used together with valid?
89
+ # @return Array for valid properties with the reasons
90
+ def list_invalid_properties
91
+ invalid_properties = Array.new
92
+ invalid_properties
93
+ end
94
+
95
+ # Check to see if the all the properties in the model are valid
96
+ # @return true if the model is valid
97
+ def valid?
98
+ true
99
+ end
100
+
101
+ # Checks equality by comparing each attribute.
102
+ # @param [Object] Object to be compared
103
+ def ==(o)
104
+ return true if self.equal?(o)
105
+ self.class == o.class &&
106
+ id == o.id &&
107
+ name == o.name &&
108
+ number == o.number &&
109
+ sync_status == o.sync_status
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, name, number, sync_status].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