kabustation_client 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +188 -0
- data/Rakefile +10 -0
- data/docs/ApiSoftLimitResponse.md +32 -0
- data/docs/AuthApi.md +72 -0
- data/docs/BoardSuccess.md +142 -0
- data/docs/BoardSuccessBuy1.md +24 -0
- data/docs/BoardSuccessBuy10.md +20 -0
- data/docs/BoardSuccessBuy2.md +20 -0
- data/docs/BoardSuccessBuy3.md +20 -0
- data/docs/BoardSuccessBuy4.md +20 -0
- data/docs/BoardSuccessBuy5.md +20 -0
- data/docs/BoardSuccessBuy6.md +20 -0
- data/docs/BoardSuccessBuy7.md +20 -0
- data/docs/BoardSuccessBuy8.md +20 -0
- data/docs/BoardSuccessBuy9.md +20 -0
- data/docs/BoardSuccessSell1.md +24 -0
- data/docs/BoardSuccessSell10.md +20 -0
- data/docs/BoardSuccessSell2.md +20 -0
- data/docs/BoardSuccessSell3.md +20 -0
- data/docs/BoardSuccessSell4.md +20 -0
- data/docs/BoardSuccessSell5.md +20 -0
- data/docs/BoardSuccessSell6.md +20 -0
- data/docs/BoardSuccessSell7.md +20 -0
- data/docs/BoardSuccessSell8.md +20 -0
- data/docs/BoardSuccessSell9.md +20 -0
- data/docs/ErrorResponse.md +20 -0
- data/docs/ExchangeResponse.md +28 -0
- data/docs/InfoApi.md +924 -0
- data/docs/MarginPremiumResponse.md +22 -0
- data/docs/MarginPremiumResponseDayTrade.md +26 -0
- data/docs/MarginPremiumResponseGeneralMargin.md +26 -0
- data/docs/OrderApi.md +275 -0
- data/docs/OrderSuccess.md +20 -0
- data/docs/OrdersSuccess.md +58 -0
- data/docs/OrdersSuccessDetailsInner.md +44 -0
- data/docs/Positions.md +20 -0
- data/docs/PositionsDeriv.md +20 -0
- data/docs/PositionsSuccess.md +58 -0
- data/docs/PrimaryExchangeResponse.md +20 -0
- data/docs/RankingByCategoryResponse.md +22 -0
- data/docs/RankingByCategoryResponseRankingInner.md +34 -0
- data/docs/RankingByMarginResponse.md +22 -0
- data/docs/RankingByMarginResponseRankingInner.md +36 -0
- data/docs/RankingByTickCountResponse.md +22 -0
- data/docs/RankingByTickCountResponseRankingInner.md +46 -0
- data/docs/RankingByTradeValueResponse.md +22 -0
- data/docs/RankingByTradeValueResponseRankingInner.md +42 -0
- data/docs/RankingByTradeVolumeResponse.md +22 -0
- data/docs/RankingByTradeVolumeResponseRankingInner.md +42 -0
- data/docs/RankingDefaultResponse.md +22 -0
- data/docs/RankingDefaultResponseRankingInner.md +42 -0
- data/docs/RankingGet200Response.md +57 -0
- data/docs/RegistSuccess.md +18 -0
- data/docs/RegisterApi.md +206 -0
- data/docs/RegulationsResponse.md +20 -0
- data/docs/RegulationsResponseRegulationsInfoInner.md +30 -0
- data/docs/RequestCancelOrder.md +20 -0
- data/docs/RequestRegister.md +18 -0
- data/docs/RequestRegisterSymbolsInner.md +20 -0
- data/docs/RequestSendOrder.md +52 -0
- data/docs/RequestSendOrderDerivFuture.md +42 -0
- data/docs/RequestSendOrderDerivFutureReverseLimitOrder.md +24 -0
- data/docs/RequestSendOrderDerivOption.md +42 -0
- data/docs/RequestSendOrderReverseLimitOrder.md +26 -0
- data/docs/RequestToken.md +18 -0
- data/docs/RequestUnregister.md +18 -0
- data/docs/SymbolNameSuccess.md +20 -0
- data/docs/SymbolSuccess.md +64 -0
- data/docs/TokenSuccess.md +20 -0
- data/docs/UnregisterAllSuccess.md +18 -0
- data/docs/WalletApi.md +535 -0
- data/docs/WalletCashSuccess.md +22 -0
- data/docs/WalletFutureSuccess.md +22 -0
- data/docs/WalletMarginSuccess.md +24 -0
- data/docs/WalletOptionSuccess.md +22 -0
- data/git_push.sh +57 -0
- data/kabustation_client.gemspec +39 -0
- data/lib/kabustation_client/api/auth_api.rb +90 -0
- data/lib/kabustation_client/api/info_api.rb +1044 -0
- data/lib/kabustation_client/api/order_api.rb +322 -0
- data/lib/kabustation_client/api/register_api.rb +236 -0
- data/lib/kabustation_client/api/wallet_api.rb +558 -0
- data/lib/kabustation_client/api_client.rb +393 -0
- data/lib/kabustation_client/api_error.rb +58 -0
- data/lib/kabustation_client/configuration.rb +295 -0
- data/lib/kabustation_client/models/api_soft_limit_response.rb +285 -0
- data/lib/kabustation_client/models/board_success.rb +816 -0
- data/lib/kabustation_client/models/board_success_buy1.rb +246 -0
- data/lib/kabustation_client/models/board_success_buy10.rb +226 -0
- data/lib/kabustation_client/models/board_success_buy2.rb +226 -0
- data/lib/kabustation_client/models/board_success_buy3.rb +226 -0
- data/lib/kabustation_client/models/board_success_buy4.rb +226 -0
- data/lib/kabustation_client/models/board_success_buy5.rb +226 -0
- data/lib/kabustation_client/models/board_success_buy6.rb +226 -0
- data/lib/kabustation_client/models/board_success_buy7.rb +226 -0
- data/lib/kabustation_client/models/board_success_buy8.rb +226 -0
- data/lib/kabustation_client/models/board_success_buy9.rb +226 -0
- data/lib/kabustation_client/models/board_success_sell1.rb +246 -0
- data/lib/kabustation_client/models/board_success_sell10.rb +226 -0
- data/lib/kabustation_client/models/board_success_sell2.rb +226 -0
- data/lib/kabustation_client/models/board_success_sell3.rb +226 -0
- data/lib/kabustation_client/models/board_success_sell4.rb +226 -0
- data/lib/kabustation_client/models/board_success_sell5.rb +226 -0
- data/lib/kabustation_client/models/board_success_sell6.rb +226 -0
- data/lib/kabustation_client/models/board_success_sell7.rb +226 -0
- data/lib/kabustation_client/models/board_success_sell8.rb +226 -0
- data/lib/kabustation_client/models/board_success_sell9.rb +226 -0
- data/lib/kabustation_client/models/error_response.rb +225 -0
- data/lib/kabustation_client/models/exchange_response.rb +265 -0
- data/lib/kabustation_client/models/margin_premium_response.rb +233 -0
- data/lib/kabustation_client/models/margin_premium_response_day_trade.rb +256 -0
- data/lib/kabustation_client/models/margin_premium_response_general_margin.rb +256 -0
- data/lib/kabustation_client/models/order_success.rb +225 -0
- data/lib/kabustation_client/models/orders_success.rb +417 -0
- data/lib/kabustation_client/models/orders_success_details_inner.rb +345 -0
- data/lib/kabustation_client/models/positions.rb +225 -0
- data/lib/kabustation_client/models/positions_deriv.rb +225 -0
- data/lib/kabustation_client/models/positions_success.rb +415 -0
- data/lib/kabustation_client/models/primary_exchange_response.rb +225 -0
- data/lib/kabustation_client/models/ranking_by_category_response.rb +237 -0
- data/lib/kabustation_client/models/ranking_by_category_response_ranking_inner.rb +295 -0
- data/lib/kabustation_client/models/ranking_by_margin_response.rb +237 -0
- data/lib/kabustation_client/models/ranking_by_margin_response_ranking_inner.rb +305 -0
- data/lib/kabustation_client/models/ranking_by_tick_count_response.rb +237 -0
- data/lib/kabustation_client/models/ranking_by_tick_count_response_ranking_inner.rb +355 -0
- data/lib/kabustation_client/models/ranking_by_trade_value_response.rb +237 -0
- data/lib/kabustation_client/models/ranking_by_trade_value_response_ranking_inner.rb +335 -0
- data/lib/kabustation_client/models/ranking_by_trade_volume_response.rb +237 -0
- data/lib/kabustation_client/models/ranking_by_trade_volume_response_ranking_inner.rb +335 -0
- data/lib/kabustation_client/models/ranking_default_response.rb +237 -0
- data/lib/kabustation_client/models/ranking_default_response_ranking_inner.rb +335 -0
- data/lib/kabustation_client/models/ranking_get200_response.rb +109 -0
- data/lib/kabustation_client/models/regist_success.rb +217 -0
- data/lib/kabustation_client/models/regulations_response.rb +227 -0
- data/lib/kabustation_client/models/regulations_response_regulations_info_inner.rb +275 -0
- data/lib/kabustation_client/models/request_cancel_order.rb +239 -0
- data/lib/kabustation_client/models/request_register.rb +216 -0
- data/lib/kabustation_client/models/request_register_symbols_inner.rb +225 -0
- data/lib/kabustation_client/models/request_send_order.rb +470 -0
- data/lib/kabustation_client/models/request_send_order_deriv_future.rb +406 -0
- data/lib/kabustation_client/models/request_send_order_deriv_future_reverse_limit_order.rb +274 -0
- data/lib/kabustation_client/models/request_send_order_deriv_option.rb +406 -0
- data/lib/kabustation_client/models/request_send_order_reverse_limit_order.rb +291 -0
- data/lib/kabustation_client/models/request_token.rb +222 -0
- data/lib/kabustation_client/models/request_unregister.rb +217 -0
- data/lib/kabustation_client/models/symbol_name_success.rb +225 -0
- data/lib/kabustation_client/models/symbol_success.rb +445 -0
- data/lib/kabustation_client/models/token_success.rb +225 -0
- data/lib/kabustation_client/models/unregister_all_success.rb +215 -0
- data/lib/kabustation_client/models/wallet_cash_success.rb +235 -0
- data/lib/kabustation_client/models/wallet_future_success.rb +235 -0
- data/lib/kabustation_client/models/wallet_margin_success.rb +245 -0
- data/lib/kabustation_client/models/wallet_option_success.rb +235 -0
- data/lib/kabustation_client/version.rb +15 -0
- data/lib/kabustation_client.rb +112 -0
- data/spec/api/auth_api_spec.rb +47 -0
- data/spec/api/info_api_spec.rb +222 -0
- data/spec/api/order_api_spec.rb +87 -0
- data/spec/api/register_api_spec.rb +73 -0
- data/spec/api/wallet_api_spec.rb +135 -0
- data/spec/models/api_soft_limit_response_spec.rb +78 -0
- data/spec/models/board_success_buy10_spec.rb +42 -0
- data/spec/models/board_success_buy1_spec.rb +54 -0
- data/spec/models/board_success_buy2_spec.rb +42 -0
- data/spec/models/board_success_buy3_spec.rb +42 -0
- data/spec/models/board_success_buy4_spec.rb +42 -0
- data/spec/models/board_success_buy5_spec.rb +42 -0
- data/spec/models/board_success_buy6_spec.rb +42 -0
- data/spec/models/board_success_buy7_spec.rb +42 -0
- data/spec/models/board_success_buy8_spec.rb +42 -0
- data/spec/models/board_success_buy9_spec.rb +42 -0
- data/spec/models/board_success_sell10_spec.rb +42 -0
- data/spec/models/board_success_sell1_spec.rb +54 -0
- data/spec/models/board_success_sell2_spec.rb +42 -0
- data/spec/models/board_success_sell3_spec.rb +42 -0
- data/spec/models/board_success_sell4_spec.rb +42 -0
- data/spec/models/board_success_sell5_spec.rb +42 -0
- data/spec/models/board_success_sell6_spec.rb +42 -0
- data/spec/models/board_success_sell7_spec.rb +42 -0
- data/spec/models/board_success_sell8_spec.rb +42 -0
- data/spec/models/board_success_sell9_spec.rb +42 -0
- data/spec/models/board_success_spec.rb +408 -0
- data/spec/models/error_response_spec.rb +42 -0
- data/spec/models/exchange_response_spec.rb +66 -0
- data/spec/models/margin_premium_response_day_trade_spec.rb +60 -0
- data/spec/models/margin_premium_response_general_margin_spec.rb +60 -0
- data/spec/models/margin_premium_response_spec.rb +48 -0
- data/spec/models/order_success_spec.rb +42 -0
- data/spec/models/orders_success_details_inner_spec.rb +114 -0
- data/spec/models/orders_success_spec.rb +156 -0
- data/spec/models/positions_deriv_spec.rb +42 -0
- data/spec/models/positions_spec.rb +42 -0
- data/spec/models/positions_success_spec.rb +156 -0
- data/spec/models/primary_exchange_response_spec.rb +42 -0
- data/spec/models/ranking_by_category_response_ranking_inner_spec.rb +84 -0
- data/spec/models/ranking_by_category_response_spec.rb +48 -0
- data/spec/models/ranking_by_margin_response_ranking_inner_spec.rb +90 -0
- data/spec/models/ranking_by_margin_response_spec.rb +48 -0
- data/spec/models/ranking_by_tick_count_response_ranking_inner_spec.rb +120 -0
- data/spec/models/ranking_by_tick_count_response_spec.rb +48 -0
- data/spec/models/ranking_by_trade_value_response_ranking_inner_spec.rb +108 -0
- data/spec/models/ranking_by_trade_value_response_spec.rb +48 -0
- data/spec/models/ranking_by_trade_volume_response_ranking_inner_spec.rb +108 -0
- data/spec/models/ranking_by_trade_volume_response_spec.rb +48 -0
- data/spec/models/ranking_default_response_ranking_inner_spec.rb +108 -0
- data/spec/models/ranking_default_response_spec.rb +48 -0
- data/spec/models/ranking_get200_response_spec.rb +32 -0
- data/spec/models/regist_success_spec.rb +36 -0
- data/spec/models/regulations_response_regulations_info_inner_spec.rb +72 -0
- data/spec/models/regulations_response_spec.rb +42 -0
- data/spec/models/request_cancel_order_spec.rb +42 -0
- data/spec/models/request_register_spec.rb +36 -0
- data/spec/models/request_register_symbols_inner_spec.rb +42 -0
- data/spec/models/request_send_order_deriv_future_reverse_limit_order_spec.rb +54 -0
- data/spec/models/request_send_order_deriv_future_spec.rb +108 -0
- data/spec/models/request_send_order_deriv_option_spec.rb +108 -0
- data/spec/models/request_send_order_reverse_limit_order_spec.rb +60 -0
- data/spec/models/request_send_order_spec.rb +138 -0
- data/spec/models/request_token_spec.rb +36 -0
- data/spec/models/request_unregister_spec.rb +36 -0
- data/spec/models/symbol_name_success_spec.rb +42 -0
- data/spec/models/symbol_success_spec.rb +174 -0
- data/spec/models/token_success_spec.rb +42 -0
- data/spec/models/unregister_all_success_spec.rb +36 -0
- data/spec/models/wallet_cash_success_spec.rb +48 -0
- data/spec/models/wallet_future_success_spec.rb +48 -0
- data/spec/models/wallet_margin_success_spec.rb +54 -0
- data/spec/models/wallet_option_success_spec.rb +48 -0
- data/spec/spec_helper.rb +111 -0
- metadata +387 -0
@@ -0,0 +1,274 @@
|
|
1
|
+
=begin
|
2
|
+
#kabuステーションAPI
|
3
|
+
|
4
|
+
## 定義情報 REST APIのコード一覧、エンドポイントは下記リンク参照 - [REST APIコード一覧](../ptal/error.html)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.5
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.4.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module KabustationClient
|
17
|
+
# 逆指値条件<br> ※FrontOrderTypeで逆指値を指定した場合のみ必須。
|
18
|
+
class RequestSendOrderDerivFutureReverseLimitOrder
|
19
|
+
# トリガ価格<br> ※未設定の場合はエラーになります。<br> ※数字以外が設定された場合はエラーになります。
|
20
|
+
attr_accessor :trigger_price
|
21
|
+
|
22
|
+
# 以上/以下<br> ※未設定の場合はエラーになります。<br> ※1、2以外が指定された場合はエラーになります。 <table> <thead> <tr> <th>定義値</th> <th>説明</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>以下</td> </tr> <tr> <td>2</td> <td>以上</td> </tr> </tbody> </table>
|
23
|
+
attr_accessor :under_over
|
24
|
+
|
25
|
+
# ヒット後執行条件<br> ※未設定の場合はエラーになります。<br> ※日通の注文で2以外が指定された場合はエラーになります。<br> ※日中、夜間の注文で1、2以外が指定された場合はエラーになります。<br> ※逆指値(成行)で有効期間条件(TimeInForce)にFAK以外を指定された場合はエラーになります。<br> ※逆指値(指値)で有効期間条件(TimeInForce)にFAS以外を指定された場合はエラーになります。 <table> <thead> <tr> <th>定義値</th> <th>説明</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>成行</td> </tr> <tr> <td>2</td> <td>指値</td> </tr> </tbody> </table>
|
26
|
+
attr_accessor :after_hit_order_type
|
27
|
+
|
28
|
+
# ヒット後注文価格<br> ※未設定の場合はエラーになります。<br> ※数字以外が設定された場合はエラーになります。<br><br> ヒット後執行条件に従い、下記のようにヒット後注文価格を設定してください。 <table> <thead> <tr> <th>ヒット後執行条件</th> <th>設定価格</th> </tr> </thead> <tbody> <tr> <td>成行</td> <td>0</td> </tr> <tr> <td>指値</td> <td>指値の単価</td> </tr> </tbody> </table>
|
29
|
+
attr_accessor :after_hit_price
|
30
|
+
|
31
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
32
|
+
def self.attribute_map
|
33
|
+
{
|
34
|
+
:'trigger_price' => :'TriggerPrice',
|
35
|
+
:'under_over' => :'UnderOver',
|
36
|
+
:'after_hit_order_type' => :'AfterHitOrderType',
|
37
|
+
:'after_hit_price' => :'AfterHitPrice'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# Returns all the JSON keys this model knows about
|
42
|
+
def self.acceptable_attributes
|
43
|
+
attribute_map.values
|
44
|
+
end
|
45
|
+
|
46
|
+
# Attribute type mapping.
|
47
|
+
def self.openapi_types
|
48
|
+
{
|
49
|
+
:'trigger_price' => :'Float',
|
50
|
+
:'under_over' => :'Integer',
|
51
|
+
:'after_hit_order_type' => :'Integer',
|
52
|
+
:'after_hit_price' => :'Float'
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# List of attributes with nullable: true
|
57
|
+
def self.openapi_nullable
|
58
|
+
Set.new([
|
59
|
+
])
|
60
|
+
end
|
61
|
+
|
62
|
+
# Initializes the object
|
63
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
64
|
+
def initialize(attributes = {})
|
65
|
+
if (!attributes.is_a?(Hash))
|
66
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `KabustationClient::RequestSendOrderDerivFutureReverseLimitOrder` initialize method"
|
67
|
+
end
|
68
|
+
|
69
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
70
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
71
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
72
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `KabustationClient::RequestSendOrderDerivFutureReverseLimitOrder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
73
|
+
end
|
74
|
+
h[k.to_sym] = v
|
75
|
+
}
|
76
|
+
|
77
|
+
if attributes.key?(:'trigger_price')
|
78
|
+
self.trigger_price = attributes[:'trigger_price']
|
79
|
+
else
|
80
|
+
self.trigger_price = nil
|
81
|
+
end
|
82
|
+
|
83
|
+
if attributes.key?(:'under_over')
|
84
|
+
self.under_over = attributes[:'under_over']
|
85
|
+
else
|
86
|
+
self.under_over = nil
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.key?(:'after_hit_order_type')
|
90
|
+
self.after_hit_order_type = attributes[:'after_hit_order_type']
|
91
|
+
else
|
92
|
+
self.after_hit_order_type = nil
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.key?(:'after_hit_price')
|
96
|
+
self.after_hit_price = attributes[:'after_hit_price']
|
97
|
+
else
|
98
|
+
self.after_hit_price = nil
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
103
|
+
# @return Array for valid properties with the reasons
|
104
|
+
def list_invalid_properties
|
105
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
106
|
+
invalid_properties = Array.new
|
107
|
+
if @trigger_price.nil?
|
108
|
+
invalid_properties.push('invalid value for "trigger_price", trigger_price cannot be nil.')
|
109
|
+
end
|
110
|
+
|
111
|
+
if @under_over.nil?
|
112
|
+
invalid_properties.push('invalid value for "under_over", under_over cannot be nil.')
|
113
|
+
end
|
114
|
+
|
115
|
+
if @after_hit_order_type.nil?
|
116
|
+
invalid_properties.push('invalid value for "after_hit_order_type", after_hit_order_type cannot be nil.')
|
117
|
+
end
|
118
|
+
|
119
|
+
if @after_hit_price.nil?
|
120
|
+
invalid_properties.push('invalid value for "after_hit_price", after_hit_price cannot be nil.')
|
121
|
+
end
|
122
|
+
|
123
|
+
invalid_properties
|
124
|
+
end
|
125
|
+
|
126
|
+
# Check to see if the all the properties in the model are valid
|
127
|
+
# @return true if the model is valid
|
128
|
+
def valid?
|
129
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
130
|
+
return false if @trigger_price.nil?
|
131
|
+
return false if @under_over.nil?
|
132
|
+
return false if @after_hit_order_type.nil?
|
133
|
+
return false if @after_hit_price.nil?
|
134
|
+
true
|
135
|
+
end
|
136
|
+
|
137
|
+
# Checks equality by comparing each attribute.
|
138
|
+
# @param [Object] Object to be compared
|
139
|
+
def ==(o)
|
140
|
+
return true if self.equal?(o)
|
141
|
+
self.class == o.class &&
|
142
|
+
trigger_price == o.trigger_price &&
|
143
|
+
under_over == o.under_over &&
|
144
|
+
after_hit_order_type == o.after_hit_order_type &&
|
145
|
+
after_hit_price == o.after_hit_price
|
146
|
+
end
|
147
|
+
|
148
|
+
# @see the `==` method
|
149
|
+
# @param [Object] Object to be compared
|
150
|
+
def eql?(o)
|
151
|
+
self == o
|
152
|
+
end
|
153
|
+
|
154
|
+
# Calculates hash code according to all attributes.
|
155
|
+
# @return [Integer] Hash code
|
156
|
+
def hash
|
157
|
+
[trigger_price, under_over, after_hit_order_type, after_hit_price].hash
|
158
|
+
end
|
159
|
+
|
160
|
+
# Builds the object from hash
|
161
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
162
|
+
# @return [Object] Returns the model itself
|
163
|
+
def self.build_from_hash(attributes)
|
164
|
+
return nil unless attributes.is_a?(Hash)
|
165
|
+
attributes = attributes.transform_keys(&:to_sym)
|
166
|
+
transformed_hash = {}
|
167
|
+
openapi_types.each_pair do |key, type|
|
168
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
169
|
+
transformed_hash["#{key}"] = nil
|
170
|
+
elsif type =~ /\AArray<(.*)>/i
|
171
|
+
# check to ensure the input is an array given that the attribute
|
172
|
+
# is documented as an array but the input is not
|
173
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
174
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
175
|
+
end
|
176
|
+
elsif !attributes[attribute_map[key]].nil?
|
177
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
178
|
+
end
|
179
|
+
end
|
180
|
+
new(transformed_hash)
|
181
|
+
end
|
182
|
+
|
183
|
+
# Deserializes the data based on type
|
184
|
+
# @param string type Data type
|
185
|
+
# @param string value Value to be deserialized
|
186
|
+
# @return [Object] Deserialized data
|
187
|
+
def self._deserialize(type, value)
|
188
|
+
case type.to_sym
|
189
|
+
when :Time
|
190
|
+
Time.parse(value)
|
191
|
+
when :Date
|
192
|
+
Date.parse(value)
|
193
|
+
when :String
|
194
|
+
value.to_s
|
195
|
+
when :Integer
|
196
|
+
value.to_i
|
197
|
+
when :Float
|
198
|
+
value.to_f
|
199
|
+
when :Boolean
|
200
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
201
|
+
true
|
202
|
+
else
|
203
|
+
false
|
204
|
+
end
|
205
|
+
when :Object
|
206
|
+
# generic object (usually a Hash), return directly
|
207
|
+
value
|
208
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
209
|
+
inner_type = Regexp.last_match[:inner_type]
|
210
|
+
value.map { |v| _deserialize(inner_type, v) }
|
211
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
212
|
+
k_type = Regexp.last_match[:k_type]
|
213
|
+
v_type = Regexp.last_match[:v_type]
|
214
|
+
{}.tap do |hash|
|
215
|
+
value.each do |k, v|
|
216
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
217
|
+
end
|
218
|
+
end
|
219
|
+
else # model
|
220
|
+
# models (e.g. Pet) or oneOf
|
221
|
+
klass = KabustationClient.const_get(type)
|
222
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
# Returns the string representation of the object
|
227
|
+
# @return [String] String presentation of the object
|
228
|
+
def to_s
|
229
|
+
to_hash.to_s
|
230
|
+
end
|
231
|
+
|
232
|
+
# to_body is an alias to to_hash (backward compatibility)
|
233
|
+
# @return [Hash] Returns the object in the form of hash
|
234
|
+
def to_body
|
235
|
+
to_hash
|
236
|
+
end
|
237
|
+
|
238
|
+
# Returns the object in the form of hash
|
239
|
+
# @return [Hash] Returns the object in the form of hash
|
240
|
+
def to_hash
|
241
|
+
hash = {}
|
242
|
+
self.class.attribute_map.each_pair do |attr, param|
|
243
|
+
value = self.send(attr)
|
244
|
+
if value.nil?
|
245
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
246
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
247
|
+
end
|
248
|
+
|
249
|
+
hash[param] = _to_hash(value)
|
250
|
+
end
|
251
|
+
hash
|
252
|
+
end
|
253
|
+
|
254
|
+
# Outputs non-array value in the form of hash
|
255
|
+
# For object, use to_hash. Otherwise, just return the value
|
256
|
+
# @param [Object] value Any valid value
|
257
|
+
# @return [Hash] Returns the value in the form of hash
|
258
|
+
def _to_hash(value)
|
259
|
+
if value.is_a?(Array)
|
260
|
+
value.compact.map { |v| _to_hash(v) }
|
261
|
+
elsif value.is_a?(Hash)
|
262
|
+
{}.tap do |hash|
|
263
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
264
|
+
end
|
265
|
+
elsif value.respond_to? :to_hash
|
266
|
+
value.to_hash
|
267
|
+
else
|
268
|
+
value
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
end
|
273
|
+
|
274
|
+
end
|
@@ -0,0 +1,406 @@
|
|
1
|
+
=begin
|
2
|
+
#kabuステーションAPI
|
3
|
+
|
4
|
+
## 定義情報 REST APIのコード一覧、エンドポイントは下記リンク参照 - [REST APIコード一覧](../ptal/error.html)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.5
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.4.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module KabustationClient
|
17
|
+
class RequestSendOrderDerivOption
|
18
|
+
# 注文パスワード
|
19
|
+
attr_accessor :password
|
20
|
+
|
21
|
+
# 銘柄コード<br>※取引最終日に「オプション銘柄コード取得」でDerivMonthに0(直近限月)を指定した場合、日中・夜間の時間帯に関わらず、取引最終日を迎える限月の銘柄コードを返します。取引最終日を迎える銘柄の取引は日中取引をもって終了となりますので、ご注意ください。
|
22
|
+
attr_accessor :symbol
|
23
|
+
|
24
|
+
# 市場コード <table> <thead> <tr> <th>定義値</th> <th>説明</th> </tr> </thead> <tbody> <tr> <td>2</td> <td>日通し</td> </tr> <tr> <td>23</td> <td>日中</td> </tr> <tr> <td>24</td> <td>夜間</td> </tr> </tbody> </table>
|
25
|
+
attr_accessor :exchange
|
26
|
+
|
27
|
+
# 取引区分 <table> <thead> <tr> <th>定義値</th> <th>説明</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>新規</td> </tr> <tr> <td>2</td> <td>返済</td> </tr> </tbody> </table>
|
28
|
+
attr_accessor :trade_type
|
29
|
+
|
30
|
+
# 有効期間条件 <table> <thead> <tr> <th>定義値</th> <th>説明</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>FAS</td> </tr> <tr> <td>2</td> <td>FAK</td> </tr> <tr> <td>3</td> <td>FOK</td> </tr> </tbody> </table> ※執行条件(FrontOrderType)、有効期限条件(TimeInForce)、市場コード(Exchange)で選択できる組み合わせは下表のようになります。 <table> <thead> <tr> <th rowspan=\"2\">執行条件</th> <th rowspan=\"2\">有効期間条件</th> <th colspan=\"3\">市場コード</th> </tr> <tr> <th>日中</th> <th>夜間</th> <th>日通し</th> </tr> </thead> <tbody> <tr> <td>指値</td> <td>FAS</td> <td>●</td> <td>●</td> <td>●</td> </tr> <tr> <td>指値</td> <td>FAK</td> <td>●</td> <td>●</td> <td>-</td> </tr> <tr> <td>指値</td> <td>FOK</td> <td>●</td> <td>●</td> <td>-</td> </tr> <tr> <td>成行</td> <td>FAK</td> <td>●</td> <td>●</td> <td>-</td> </tr> <tr> <td>成行</td> <td>FOK</td> <td>●</td> <td>●</td> <td>-</td> </tr> <tr> <td>逆指値(指値)</td> <td>FAK</td> <td>●</td> <td>●</td> <td>●</td> </tr> <tr> <td>逆指値(成行)</td> <td>FAK</td> <td>●</td> <td>●</td> <td>-</td> </tr> <tr> <td>引成</td> <td>FAK</td> <td>●</td> <td>●</td> <td>-</td> </tr> <tr> <td>引指</td> <td>FAS</td> <td>●</td> <td>●</td> <td>-</td> </tr> </tbody> </table>
|
31
|
+
attr_accessor :time_in_force
|
32
|
+
|
33
|
+
# 売買区分 <table> <thead> <tr> <th>定義値</th> <th>説明</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>売</td> </tr> <tr> <td>2</td> <td>買</td> </tr> </tbody> </table>
|
34
|
+
attr_accessor :side
|
35
|
+
|
36
|
+
# 注文数量
|
37
|
+
attr_accessor :qty
|
38
|
+
|
39
|
+
# 決済順序<br>※ClosePositionOrderとClosePositionsはどちらか一方のみ指定可能。<br>※ClosePositionOrderとClosePositionsを両方指定した場合、エラー。 <table> <thead> <tr> <th>定義値</th> <th>説明</th> </tr> </thead> <tbody> <tr> <td>0</td> <td>日付(古い順)、損益(高い順)</td> </tr> <tr> <td>1</td> <td>日付(古い順)、損益(低い順)</td> </tr> <tr> <td>2</td> <td>日付(新しい順)、損益(高い順)</td> </tr> <tr> <td>3</td> <td>日付(新しい順)、損益(低い順)</td> </tr> <tr> <td>4</td> <td>損益(高い順)、日付(古い順)</td> </tr> <tr> <td>5</td> <td>損益(高い順)、日付(新しい順)</td> </tr> <tr> <td>6</td> <td>損益(低い順)、日付(古い順)</td> </tr> <tr> <td>7</td> <td>損益(低い順)、日付(新しい順)</td> </tr> </tbody> </table>
|
40
|
+
attr_accessor :close_position_order
|
41
|
+
|
42
|
+
# 返済建玉指定<br>※ClosePositionOrderとClosePositionsはどちらか一方のみ指定可能。<br>※ClosePositionOrderとClosePositionsを両方指定した場合、エラー。
|
43
|
+
attr_accessor :close_positions
|
44
|
+
|
45
|
+
# 執行条件 <table> <thead> <tr> <th>定義値</th> <th>説明</th> <th>”Price”の指定</th> </tr> </thead> <tbody> <tr> <td>18</td> <td>引成(派生)<br>※TimeInForceは、「FAK」のみ有効</td> <td>0</td> </tr> <tr> <td>20</td> <td>指値</td> <td>発注したい金額</td> </tr> <tr> <td>28</td> <td>引指(派生)<br>※TimeInForceは、「FAS」のみ有効</td> <td>発注したい金額</td> </tr> <tr> <td>30</td> <td>逆指値</td> <td>指定なし<br>※AfterHitPriceで指定ください</td> </tr> <tr> <td>120</td> <td>成行(マーケットオーダー)</td> <td>0</td> </tr> </tbody> </table>
|
46
|
+
attr_accessor :front_order_type
|
47
|
+
|
48
|
+
# 注文価格<br>※FrontOrderTypeで成行を指定した場合、0を指定する。<br>※詳細について、”FrontOrderType”をご確認ください。
|
49
|
+
attr_accessor :price
|
50
|
+
|
51
|
+
# 注文有効期限<br> yyyyMMdd形式。<br> 「0」を指定すると、kabuステーション上の発注画面の「本日」に対応する日付として扱います。<br> 「本日」は直近の注文可能日となり、以下のように設定されます。<br> その市場の引けまでの間 : 当日<br> その市場の引け後 : 翌取引所営業日<br> その市場の休前日 : 休日明けの取引所営業日<br> ※ 日替わりはkabuステーションが日付変更通知を受信したタイミングです。<br> ※ 日通しの場合、夜間取引の引け後に日付が更新されます。
|
52
|
+
attr_accessor :expire_day
|
53
|
+
|
54
|
+
attr_accessor :reverse_limit_order
|
55
|
+
|
56
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
57
|
+
def self.attribute_map
|
58
|
+
{
|
59
|
+
:'password' => :'Password',
|
60
|
+
:'symbol' => :'Symbol',
|
61
|
+
:'exchange' => :'Exchange',
|
62
|
+
:'trade_type' => :'TradeType',
|
63
|
+
:'time_in_force' => :'TimeInForce',
|
64
|
+
:'side' => :'Side',
|
65
|
+
:'qty' => :'Qty',
|
66
|
+
:'close_position_order' => :'ClosePositionOrder',
|
67
|
+
:'close_positions' => :'ClosePositions',
|
68
|
+
:'front_order_type' => :'FrontOrderType',
|
69
|
+
:'price' => :'Price',
|
70
|
+
:'expire_day' => :'ExpireDay',
|
71
|
+
:'reverse_limit_order' => :'ReverseLimitOrder'
|
72
|
+
}
|
73
|
+
end
|
74
|
+
|
75
|
+
# Returns all the JSON keys this model knows about
|
76
|
+
def self.acceptable_attributes
|
77
|
+
attribute_map.values
|
78
|
+
end
|
79
|
+
|
80
|
+
# Attribute type mapping.
|
81
|
+
def self.openapi_types
|
82
|
+
{
|
83
|
+
:'password' => :'String',
|
84
|
+
:'symbol' => :'String',
|
85
|
+
:'exchange' => :'Integer',
|
86
|
+
:'trade_type' => :'Integer',
|
87
|
+
:'time_in_force' => :'Integer',
|
88
|
+
:'side' => :'String',
|
89
|
+
:'qty' => :'Integer',
|
90
|
+
:'close_position_order' => :'Integer',
|
91
|
+
:'close_positions' => :'Array<PositionsDeriv>',
|
92
|
+
:'front_order_type' => :'Integer',
|
93
|
+
:'price' => :'Float',
|
94
|
+
:'expire_day' => :'Integer',
|
95
|
+
:'reverse_limit_order' => :'RequestSendOrderDerivFutureReverseLimitOrder'
|
96
|
+
}
|
97
|
+
end
|
98
|
+
|
99
|
+
# List of attributes with nullable: true
|
100
|
+
def self.openapi_nullable
|
101
|
+
Set.new([
|
102
|
+
])
|
103
|
+
end
|
104
|
+
|
105
|
+
# Initializes the object
|
106
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
107
|
+
def initialize(attributes = {})
|
108
|
+
if (!attributes.is_a?(Hash))
|
109
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `KabustationClient::RequestSendOrderDerivOption` initialize method"
|
110
|
+
end
|
111
|
+
|
112
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
113
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
114
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
115
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `KabustationClient::RequestSendOrderDerivOption`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
116
|
+
end
|
117
|
+
h[k.to_sym] = v
|
118
|
+
}
|
119
|
+
|
120
|
+
if attributes.key?(:'password')
|
121
|
+
self.password = attributes[:'password']
|
122
|
+
else
|
123
|
+
self.password = nil
|
124
|
+
end
|
125
|
+
|
126
|
+
if attributes.key?(:'symbol')
|
127
|
+
self.symbol = attributes[:'symbol']
|
128
|
+
else
|
129
|
+
self.symbol = nil
|
130
|
+
end
|
131
|
+
|
132
|
+
if attributes.key?(:'exchange')
|
133
|
+
self.exchange = attributes[:'exchange']
|
134
|
+
else
|
135
|
+
self.exchange = nil
|
136
|
+
end
|
137
|
+
|
138
|
+
if attributes.key?(:'trade_type')
|
139
|
+
self.trade_type = attributes[:'trade_type']
|
140
|
+
else
|
141
|
+
self.trade_type = nil
|
142
|
+
end
|
143
|
+
|
144
|
+
if attributes.key?(:'time_in_force')
|
145
|
+
self.time_in_force = attributes[:'time_in_force']
|
146
|
+
else
|
147
|
+
self.time_in_force = nil
|
148
|
+
end
|
149
|
+
|
150
|
+
if attributes.key?(:'side')
|
151
|
+
self.side = attributes[:'side']
|
152
|
+
else
|
153
|
+
self.side = nil
|
154
|
+
end
|
155
|
+
|
156
|
+
if attributes.key?(:'qty')
|
157
|
+
self.qty = attributes[:'qty']
|
158
|
+
else
|
159
|
+
self.qty = nil
|
160
|
+
end
|
161
|
+
|
162
|
+
if attributes.key?(:'close_position_order')
|
163
|
+
self.close_position_order = attributes[:'close_position_order']
|
164
|
+
end
|
165
|
+
|
166
|
+
if attributes.key?(:'close_positions')
|
167
|
+
if (value = attributes[:'close_positions']).is_a?(Array)
|
168
|
+
self.close_positions = value
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
if attributes.key?(:'front_order_type')
|
173
|
+
self.front_order_type = attributes[:'front_order_type']
|
174
|
+
else
|
175
|
+
self.front_order_type = nil
|
176
|
+
end
|
177
|
+
|
178
|
+
if attributes.key?(:'price')
|
179
|
+
self.price = attributes[:'price']
|
180
|
+
else
|
181
|
+
self.price = nil
|
182
|
+
end
|
183
|
+
|
184
|
+
if attributes.key?(:'expire_day')
|
185
|
+
self.expire_day = attributes[:'expire_day']
|
186
|
+
else
|
187
|
+
self.expire_day = nil
|
188
|
+
end
|
189
|
+
|
190
|
+
if attributes.key?(:'reverse_limit_order')
|
191
|
+
self.reverse_limit_order = attributes[:'reverse_limit_order']
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
196
|
+
# @return Array for valid properties with the reasons
|
197
|
+
def list_invalid_properties
|
198
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
199
|
+
invalid_properties = Array.new
|
200
|
+
if @password.nil?
|
201
|
+
invalid_properties.push('invalid value for "password", password cannot be nil.')
|
202
|
+
end
|
203
|
+
|
204
|
+
if @symbol.nil?
|
205
|
+
invalid_properties.push('invalid value for "symbol", symbol cannot be nil.')
|
206
|
+
end
|
207
|
+
|
208
|
+
if @exchange.nil?
|
209
|
+
invalid_properties.push('invalid value for "exchange", exchange cannot be nil.')
|
210
|
+
end
|
211
|
+
|
212
|
+
if @trade_type.nil?
|
213
|
+
invalid_properties.push('invalid value for "trade_type", trade_type cannot be nil.')
|
214
|
+
end
|
215
|
+
|
216
|
+
if @time_in_force.nil?
|
217
|
+
invalid_properties.push('invalid value for "time_in_force", time_in_force cannot be nil.')
|
218
|
+
end
|
219
|
+
|
220
|
+
if @side.nil?
|
221
|
+
invalid_properties.push('invalid value for "side", side cannot be nil.')
|
222
|
+
end
|
223
|
+
|
224
|
+
if @qty.nil?
|
225
|
+
invalid_properties.push('invalid value for "qty", qty cannot be nil.')
|
226
|
+
end
|
227
|
+
|
228
|
+
if @front_order_type.nil?
|
229
|
+
invalid_properties.push('invalid value for "front_order_type", front_order_type cannot be nil.')
|
230
|
+
end
|
231
|
+
|
232
|
+
if @price.nil?
|
233
|
+
invalid_properties.push('invalid value for "price", price cannot be nil.')
|
234
|
+
end
|
235
|
+
|
236
|
+
if @expire_day.nil?
|
237
|
+
invalid_properties.push('invalid value for "expire_day", expire_day cannot be nil.')
|
238
|
+
end
|
239
|
+
|
240
|
+
invalid_properties
|
241
|
+
end
|
242
|
+
|
243
|
+
# Check to see if the all the properties in the model are valid
|
244
|
+
# @return true if the model is valid
|
245
|
+
def valid?
|
246
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
247
|
+
return false if @password.nil?
|
248
|
+
return false if @symbol.nil?
|
249
|
+
return false if @exchange.nil?
|
250
|
+
return false if @trade_type.nil?
|
251
|
+
return false if @time_in_force.nil?
|
252
|
+
return false if @side.nil?
|
253
|
+
return false if @qty.nil?
|
254
|
+
return false if @front_order_type.nil?
|
255
|
+
return false if @price.nil?
|
256
|
+
return false if @expire_day.nil?
|
257
|
+
true
|
258
|
+
end
|
259
|
+
|
260
|
+
# Checks equality by comparing each attribute.
|
261
|
+
# @param [Object] Object to be compared
|
262
|
+
def ==(o)
|
263
|
+
return true if self.equal?(o)
|
264
|
+
self.class == o.class &&
|
265
|
+
password == o.password &&
|
266
|
+
symbol == o.symbol &&
|
267
|
+
exchange == o.exchange &&
|
268
|
+
trade_type == o.trade_type &&
|
269
|
+
time_in_force == o.time_in_force &&
|
270
|
+
side == o.side &&
|
271
|
+
qty == o.qty &&
|
272
|
+
close_position_order == o.close_position_order &&
|
273
|
+
close_positions == o.close_positions &&
|
274
|
+
front_order_type == o.front_order_type &&
|
275
|
+
price == o.price &&
|
276
|
+
expire_day == o.expire_day &&
|
277
|
+
reverse_limit_order == o.reverse_limit_order
|
278
|
+
end
|
279
|
+
|
280
|
+
# @see the `==` method
|
281
|
+
# @param [Object] Object to be compared
|
282
|
+
def eql?(o)
|
283
|
+
self == o
|
284
|
+
end
|
285
|
+
|
286
|
+
# Calculates hash code according to all attributes.
|
287
|
+
# @return [Integer] Hash code
|
288
|
+
def hash
|
289
|
+
[password, symbol, exchange, trade_type, time_in_force, side, qty, close_position_order, close_positions, front_order_type, price, expire_day, reverse_limit_order].hash
|
290
|
+
end
|
291
|
+
|
292
|
+
# Builds the object from hash
|
293
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
294
|
+
# @return [Object] Returns the model itself
|
295
|
+
def self.build_from_hash(attributes)
|
296
|
+
return nil unless attributes.is_a?(Hash)
|
297
|
+
attributes = attributes.transform_keys(&:to_sym)
|
298
|
+
transformed_hash = {}
|
299
|
+
openapi_types.each_pair do |key, type|
|
300
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
301
|
+
transformed_hash["#{key}"] = nil
|
302
|
+
elsif type =~ /\AArray<(.*)>/i
|
303
|
+
# check to ensure the input is an array given that the attribute
|
304
|
+
# is documented as an array but the input is not
|
305
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
306
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
307
|
+
end
|
308
|
+
elsif !attributes[attribute_map[key]].nil?
|
309
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
310
|
+
end
|
311
|
+
end
|
312
|
+
new(transformed_hash)
|
313
|
+
end
|
314
|
+
|
315
|
+
# Deserializes the data based on type
|
316
|
+
# @param string type Data type
|
317
|
+
# @param string value Value to be deserialized
|
318
|
+
# @return [Object] Deserialized data
|
319
|
+
def self._deserialize(type, value)
|
320
|
+
case type.to_sym
|
321
|
+
when :Time
|
322
|
+
Time.parse(value)
|
323
|
+
when :Date
|
324
|
+
Date.parse(value)
|
325
|
+
when :String
|
326
|
+
value.to_s
|
327
|
+
when :Integer
|
328
|
+
value.to_i
|
329
|
+
when :Float
|
330
|
+
value.to_f
|
331
|
+
when :Boolean
|
332
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
333
|
+
true
|
334
|
+
else
|
335
|
+
false
|
336
|
+
end
|
337
|
+
when :Object
|
338
|
+
# generic object (usually a Hash), return directly
|
339
|
+
value
|
340
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
341
|
+
inner_type = Regexp.last_match[:inner_type]
|
342
|
+
value.map { |v| _deserialize(inner_type, v) }
|
343
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
344
|
+
k_type = Regexp.last_match[:k_type]
|
345
|
+
v_type = Regexp.last_match[:v_type]
|
346
|
+
{}.tap do |hash|
|
347
|
+
value.each do |k, v|
|
348
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
349
|
+
end
|
350
|
+
end
|
351
|
+
else # model
|
352
|
+
# models (e.g. Pet) or oneOf
|
353
|
+
klass = KabustationClient.const_get(type)
|
354
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
# Returns the string representation of the object
|
359
|
+
# @return [String] String presentation of the object
|
360
|
+
def to_s
|
361
|
+
to_hash.to_s
|
362
|
+
end
|
363
|
+
|
364
|
+
# to_body is an alias to to_hash (backward compatibility)
|
365
|
+
# @return [Hash] Returns the object in the form of hash
|
366
|
+
def to_body
|
367
|
+
to_hash
|
368
|
+
end
|
369
|
+
|
370
|
+
# Returns the object in the form of hash
|
371
|
+
# @return [Hash] Returns the object in the form of hash
|
372
|
+
def to_hash
|
373
|
+
hash = {}
|
374
|
+
self.class.attribute_map.each_pair do |attr, param|
|
375
|
+
value = self.send(attr)
|
376
|
+
if value.nil?
|
377
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
378
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
379
|
+
end
|
380
|
+
|
381
|
+
hash[param] = _to_hash(value)
|
382
|
+
end
|
383
|
+
hash
|
384
|
+
end
|
385
|
+
|
386
|
+
# Outputs non-array value in the form of hash
|
387
|
+
# For object, use to_hash. Otherwise, just return the value
|
388
|
+
# @param [Object] value Any valid value
|
389
|
+
# @return [Hash] Returns the value in the form of hash
|
390
|
+
def _to_hash(value)
|
391
|
+
if value.is_a?(Array)
|
392
|
+
value.compact.map { |v| _to_hash(v) }
|
393
|
+
elsif value.is_a?(Hash)
|
394
|
+
{}.tap do |hash|
|
395
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
396
|
+
end
|
397
|
+
elsif value.respond_to? :to_hash
|
398
|
+
value.to_hash
|
399
|
+
else
|
400
|
+
value
|
401
|
+
end
|
402
|
+
end
|
403
|
+
|
404
|
+
end
|
405
|
+
|
406
|
+
end
|