kabustation_client 1.0.0
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 +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,335 @@
|
|
|
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 RankingDefaultResponseRankingInner
|
|
18
|
+
# 順位<br>※ランキング内で同じ順位が返却される場合があります(10位が2件など)
|
|
19
|
+
attr_accessor :_false
|
|
20
|
+
|
|
21
|
+
# トレンド <table> <thead> <tr> <th>定義値</th> <th>内容</th> </tr> </thead> <tbody> <tr> <td>0</td> <td>対象データ無し</td> </tr> <tr> <td>1</td> <td>過去10営業日より20位以上上昇</td> </tr> <tr> <td>2</td> <td>過去10営業日より1~19位上昇</td> </tr> <tr> <td>3</td> <td>過去10営業日と変わらず</td> </tr> <tr> <td>4</td> <td>過去10営業日より1~19位下落</td> </tr> <tr> <td>5</td> <td>過去10営業日より20位以上下落</td> </tr> </tbody> </table>
|
|
22
|
+
attr_accessor :trend
|
|
23
|
+
|
|
24
|
+
# 平均順位<br>※100位以下は「999」となります
|
|
25
|
+
attr_accessor :average_ranking
|
|
26
|
+
|
|
27
|
+
# 銘柄コード
|
|
28
|
+
attr_accessor :symbol
|
|
29
|
+
|
|
30
|
+
# 銘柄名称
|
|
31
|
+
attr_accessor :symbol_name
|
|
32
|
+
|
|
33
|
+
# 現在値
|
|
34
|
+
attr_accessor :current_price
|
|
35
|
+
|
|
36
|
+
# 前日比
|
|
37
|
+
attr_accessor :change_ratio
|
|
38
|
+
|
|
39
|
+
# 騰落率(%)
|
|
40
|
+
attr_accessor :change_percentage
|
|
41
|
+
|
|
42
|
+
# 時刻<br>HH:mm<br>※日付は返しません
|
|
43
|
+
attr_accessor :current_price_time
|
|
44
|
+
|
|
45
|
+
# 売買高<br>売買高を千株単位で表示する<br>※百株の位を四捨五入
|
|
46
|
+
attr_accessor :trading_volume
|
|
47
|
+
|
|
48
|
+
# 売買代金<br>売買代金を百万円単位で表示する<br>※十万円の位を四捨五入
|
|
49
|
+
attr_accessor :turnover
|
|
50
|
+
|
|
51
|
+
# 市場名
|
|
52
|
+
attr_accessor :exchange_name
|
|
53
|
+
|
|
54
|
+
# 業種名
|
|
55
|
+
attr_accessor :category_name
|
|
56
|
+
|
|
57
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
58
|
+
def self.attribute_map
|
|
59
|
+
{
|
|
60
|
+
:'_false' => :'false',
|
|
61
|
+
:'trend' => :'Trend',
|
|
62
|
+
:'average_ranking' => :'AverageRanking',
|
|
63
|
+
:'symbol' => :'Symbol',
|
|
64
|
+
:'symbol_name' => :'SymbolName',
|
|
65
|
+
:'current_price' => :'CurrentPrice',
|
|
66
|
+
:'change_ratio' => :'ChangeRatio',
|
|
67
|
+
:'change_percentage' => :'ChangePercentage',
|
|
68
|
+
:'current_price_time' => :'CurrentPriceTime',
|
|
69
|
+
:'trading_volume' => :'TradingVolume',
|
|
70
|
+
:'turnover' => :'Turnover',
|
|
71
|
+
:'exchange_name' => :'ExchangeName',
|
|
72
|
+
:'category_name' => :'CategoryName'
|
|
73
|
+
}
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Returns all the JSON keys this model knows about
|
|
77
|
+
def self.acceptable_attributes
|
|
78
|
+
attribute_map.values
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Attribute type mapping.
|
|
82
|
+
def self.openapi_types
|
|
83
|
+
{
|
|
84
|
+
:'_false' => :'Integer',
|
|
85
|
+
:'trend' => :'String',
|
|
86
|
+
:'average_ranking' => :'Float',
|
|
87
|
+
:'symbol' => :'String',
|
|
88
|
+
:'symbol_name' => :'String',
|
|
89
|
+
:'current_price' => :'Float',
|
|
90
|
+
:'change_ratio' => :'Float',
|
|
91
|
+
:'change_percentage' => :'Float',
|
|
92
|
+
:'current_price_time' => :'String',
|
|
93
|
+
:'trading_volume' => :'Float',
|
|
94
|
+
:'turnover' => :'Float',
|
|
95
|
+
:'exchange_name' => :'String',
|
|
96
|
+
:'category_name' => :'String'
|
|
97
|
+
}
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# List of attributes with nullable: true
|
|
101
|
+
def self.openapi_nullable
|
|
102
|
+
Set.new([
|
|
103
|
+
])
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Initializes the object
|
|
107
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
108
|
+
def initialize(attributes = {})
|
|
109
|
+
if (!attributes.is_a?(Hash))
|
|
110
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `KabustationClient::RankingDefaultResponseRankingInner` initialize method"
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
114
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
115
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
116
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `KabustationClient::RankingDefaultResponseRankingInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
117
|
+
end
|
|
118
|
+
h[k.to_sym] = v
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if attributes.key?(:'_false')
|
|
122
|
+
self._false = attributes[:'_false']
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
if attributes.key?(:'trend')
|
|
126
|
+
self.trend = attributes[:'trend']
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
if attributes.key?(:'average_ranking')
|
|
130
|
+
self.average_ranking = attributes[:'average_ranking']
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
if attributes.key?(:'symbol')
|
|
134
|
+
self.symbol = attributes[:'symbol']
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
if attributes.key?(:'symbol_name')
|
|
138
|
+
self.symbol_name = attributes[:'symbol_name']
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
if attributes.key?(:'current_price')
|
|
142
|
+
self.current_price = attributes[:'current_price']
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
if attributes.key?(:'change_ratio')
|
|
146
|
+
self.change_ratio = attributes[:'change_ratio']
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
if attributes.key?(:'change_percentage')
|
|
150
|
+
self.change_percentage = attributes[:'change_percentage']
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
if attributes.key?(:'current_price_time')
|
|
154
|
+
self.current_price_time = attributes[:'current_price_time']
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
if attributes.key?(:'trading_volume')
|
|
158
|
+
self.trading_volume = attributes[:'trading_volume']
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
if attributes.key?(:'turnover')
|
|
162
|
+
self.turnover = attributes[:'turnover']
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
if attributes.key?(:'exchange_name')
|
|
166
|
+
self.exchange_name = attributes[:'exchange_name']
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
if attributes.key?(:'category_name')
|
|
170
|
+
self.category_name = attributes[:'category_name']
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
175
|
+
# @return Array for valid properties with the reasons
|
|
176
|
+
def list_invalid_properties
|
|
177
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
178
|
+
invalid_properties = Array.new
|
|
179
|
+
invalid_properties
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# Check to see if the all the properties in the model are valid
|
|
183
|
+
# @return true if the model is valid
|
|
184
|
+
def valid?
|
|
185
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
186
|
+
true
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Checks equality by comparing each attribute.
|
|
190
|
+
# @param [Object] Object to be compared
|
|
191
|
+
def ==(o)
|
|
192
|
+
return true if self.equal?(o)
|
|
193
|
+
self.class == o.class &&
|
|
194
|
+
_false == o._false &&
|
|
195
|
+
trend == o.trend &&
|
|
196
|
+
average_ranking == o.average_ranking &&
|
|
197
|
+
symbol == o.symbol &&
|
|
198
|
+
symbol_name == o.symbol_name &&
|
|
199
|
+
current_price == o.current_price &&
|
|
200
|
+
change_ratio == o.change_ratio &&
|
|
201
|
+
change_percentage == o.change_percentage &&
|
|
202
|
+
current_price_time == o.current_price_time &&
|
|
203
|
+
trading_volume == o.trading_volume &&
|
|
204
|
+
turnover == o.turnover &&
|
|
205
|
+
exchange_name == o.exchange_name &&
|
|
206
|
+
category_name == o.category_name
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# @see the `==` method
|
|
210
|
+
# @param [Object] Object to be compared
|
|
211
|
+
def eql?(o)
|
|
212
|
+
self == o
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
# Calculates hash code according to all attributes.
|
|
216
|
+
# @return [Integer] Hash code
|
|
217
|
+
def hash
|
|
218
|
+
[_false, trend, average_ranking, symbol, symbol_name, current_price, change_ratio, change_percentage, current_price_time, trading_volume, turnover, exchange_name, category_name].hash
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
# Builds the object from hash
|
|
222
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
223
|
+
# @return [Object] Returns the model itself
|
|
224
|
+
def self.build_from_hash(attributes)
|
|
225
|
+
return nil unless attributes.is_a?(Hash)
|
|
226
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
227
|
+
transformed_hash = {}
|
|
228
|
+
openapi_types.each_pair do |key, type|
|
|
229
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
230
|
+
transformed_hash["#{key}"] = nil
|
|
231
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
232
|
+
# check to ensure the input is an array given that the attribute
|
|
233
|
+
# is documented as an array but the input is not
|
|
234
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
235
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
236
|
+
end
|
|
237
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
238
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
new(transformed_hash)
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
# Deserializes the data based on type
|
|
245
|
+
# @param string type Data type
|
|
246
|
+
# @param string value Value to be deserialized
|
|
247
|
+
# @return [Object] Deserialized data
|
|
248
|
+
def self._deserialize(type, value)
|
|
249
|
+
case type.to_sym
|
|
250
|
+
when :Time
|
|
251
|
+
Time.parse(value)
|
|
252
|
+
when :Date
|
|
253
|
+
Date.parse(value)
|
|
254
|
+
when :String
|
|
255
|
+
value.to_s
|
|
256
|
+
when :Integer
|
|
257
|
+
value.to_i
|
|
258
|
+
when :Float
|
|
259
|
+
value.to_f
|
|
260
|
+
when :Boolean
|
|
261
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
262
|
+
true
|
|
263
|
+
else
|
|
264
|
+
false
|
|
265
|
+
end
|
|
266
|
+
when :Object
|
|
267
|
+
# generic object (usually a Hash), return directly
|
|
268
|
+
value
|
|
269
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
270
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
271
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
272
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
273
|
+
k_type = Regexp.last_match[:k_type]
|
|
274
|
+
v_type = Regexp.last_match[:v_type]
|
|
275
|
+
{}.tap do |hash|
|
|
276
|
+
value.each do |k, v|
|
|
277
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
else # model
|
|
281
|
+
# models (e.g. Pet) or oneOf
|
|
282
|
+
klass = KabustationClient.const_get(type)
|
|
283
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
284
|
+
end
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
# Returns the string representation of the object
|
|
288
|
+
# @return [String] String presentation of the object
|
|
289
|
+
def to_s
|
|
290
|
+
to_hash.to_s
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
294
|
+
# @return [Hash] Returns the object in the form of hash
|
|
295
|
+
def to_body
|
|
296
|
+
to_hash
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
# Returns the object in the form of hash
|
|
300
|
+
# @return [Hash] Returns the object in the form of hash
|
|
301
|
+
def to_hash
|
|
302
|
+
hash = {}
|
|
303
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
304
|
+
value = self.send(attr)
|
|
305
|
+
if value.nil?
|
|
306
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
307
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
hash[param] = _to_hash(value)
|
|
311
|
+
end
|
|
312
|
+
hash
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
# Outputs non-array value in the form of hash
|
|
316
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
317
|
+
# @param [Object] value Any valid value
|
|
318
|
+
# @return [Hash] Returns the value in the form of hash
|
|
319
|
+
def _to_hash(value)
|
|
320
|
+
if value.is_a?(Array)
|
|
321
|
+
value.compact.map { |v| _to_hash(v) }
|
|
322
|
+
elsif value.is_a?(Hash)
|
|
323
|
+
{}.tap do |hash|
|
|
324
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
325
|
+
end
|
|
326
|
+
elsif value.respond_to? :to_hash
|
|
327
|
+
value.to_hash
|
|
328
|
+
else
|
|
329
|
+
value
|
|
330
|
+
end
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
end
|
|
@@ -0,0 +1,109 @@
|
|
|
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
|
+
module RankingGet200Response
|
|
18
|
+
class << self
|
|
19
|
+
# List of class defined in oneOf (OpenAPI v3)
|
|
20
|
+
def openapi_one_of
|
|
21
|
+
[
|
|
22
|
+
:'RankingByCategoryResponse',
|
|
23
|
+
:'RankingByMarginResponse',
|
|
24
|
+
:'RankingByTickCountResponse',
|
|
25
|
+
:'RankingByTradeValueResponse',
|
|
26
|
+
:'RankingByTradeVolumeResponse',
|
|
27
|
+
:'RankingDefaultResponse'
|
|
28
|
+
]
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Builds the object
|
|
32
|
+
# @param [Mixed] Data to be matched against the list of oneOf items
|
|
33
|
+
# @return [Object] Returns the model or the data itself
|
|
34
|
+
def build(data)
|
|
35
|
+
# Go through the list of oneOf items and attempt to identify the appropriate one.
|
|
36
|
+
# Note:
|
|
37
|
+
# - We do not attempt to check whether exactly one item matches.
|
|
38
|
+
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
|
39
|
+
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
|
40
|
+
# - TODO: scalar values are de facto behaving as if they were nullable.
|
|
41
|
+
# - TODO: logging when debugging is set.
|
|
42
|
+
openapi_one_of.each do |klass|
|
|
43
|
+
begin
|
|
44
|
+
next if klass == :AnyType # "nullable: true"
|
|
45
|
+
typed_data = find_and_cast_into_type(klass, data)
|
|
46
|
+
return typed_data if typed_data
|
|
47
|
+
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
openapi_one_of.include?(:AnyType) ? data : nil
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
private
|
|
55
|
+
|
|
56
|
+
SchemaMismatchError = Class.new(StandardError)
|
|
57
|
+
|
|
58
|
+
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
|
59
|
+
def find_and_cast_into_type(klass, data)
|
|
60
|
+
return if data.nil?
|
|
61
|
+
|
|
62
|
+
case klass.to_s
|
|
63
|
+
when 'Boolean'
|
|
64
|
+
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
|
65
|
+
when 'Float'
|
|
66
|
+
return data if data.instance_of?(Float)
|
|
67
|
+
when 'Integer'
|
|
68
|
+
return data if data.instance_of?(Integer)
|
|
69
|
+
when 'Time'
|
|
70
|
+
return Time.parse(data)
|
|
71
|
+
when 'Date'
|
|
72
|
+
return Date.parse(data)
|
|
73
|
+
when 'String'
|
|
74
|
+
return data if data.instance_of?(String)
|
|
75
|
+
when 'Object' # "type: object"
|
|
76
|
+
return data if data.instance_of?(Hash)
|
|
77
|
+
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
|
78
|
+
if data.instance_of?(Array)
|
|
79
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
80
|
+
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
|
81
|
+
end
|
|
82
|
+
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
|
83
|
+
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
|
84
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
85
|
+
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
|
86
|
+
end
|
|
87
|
+
else # model
|
|
88
|
+
const = KabustationClient.const_get(klass)
|
|
89
|
+
if const
|
|
90
|
+
if const.respond_to?(:openapi_one_of) # nested oneOf model
|
|
91
|
+
model = const.build(data)
|
|
92
|
+
return model if model
|
|
93
|
+
else
|
|
94
|
+
# raise if data contains keys that are not known to the model
|
|
95
|
+
raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
|
|
96
|
+
model = const.build_from_hash(data)
|
|
97
|
+
return model if model
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
raise # if no match by now, raise
|
|
103
|
+
rescue
|
|
104
|
+
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
end
|
|
@@ -0,0 +1,217 @@
|
|
|
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 RegistSuccess
|
|
18
|
+
# 現在登録されている銘柄のリスト
|
|
19
|
+
attr_accessor :regist_list
|
|
20
|
+
|
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
22
|
+
def self.attribute_map
|
|
23
|
+
{
|
|
24
|
+
:'regist_list' => :'RegistList'
|
|
25
|
+
}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Returns all the JSON keys this model knows about
|
|
29
|
+
def self.acceptable_attributes
|
|
30
|
+
attribute_map.values
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Attribute type mapping.
|
|
34
|
+
def self.openapi_types
|
|
35
|
+
{
|
|
36
|
+
:'regist_list' => :'Array<RequestRegisterSymbolsInner>'
|
|
37
|
+
}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# List of attributes with nullable: true
|
|
41
|
+
def self.openapi_nullable
|
|
42
|
+
Set.new([
|
|
43
|
+
])
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Initializes the object
|
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
48
|
+
def initialize(attributes = {})
|
|
49
|
+
if (!attributes.is_a?(Hash))
|
|
50
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `KabustationClient::RegistSuccess` initialize method"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
54
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
55
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
56
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `KabustationClient::RegistSuccess`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
57
|
+
end
|
|
58
|
+
h[k.to_sym] = v
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if attributes.key?(:'regist_list')
|
|
62
|
+
if (value = attributes[:'regist_list']).is_a?(Array)
|
|
63
|
+
self.regist_list = value
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
69
|
+
# @return Array for valid properties with the reasons
|
|
70
|
+
def list_invalid_properties
|
|
71
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
72
|
+
invalid_properties = Array.new
|
|
73
|
+
invalid_properties
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Check to see if the all the properties in the model are valid
|
|
77
|
+
# @return true if the model is valid
|
|
78
|
+
def valid?
|
|
79
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
80
|
+
true
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Checks equality by comparing each attribute.
|
|
84
|
+
# @param [Object] Object to be compared
|
|
85
|
+
def ==(o)
|
|
86
|
+
return true if self.equal?(o)
|
|
87
|
+
self.class == o.class &&
|
|
88
|
+
regist_list == o.regist_list
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# @see the `==` method
|
|
92
|
+
# @param [Object] Object to be compared
|
|
93
|
+
def eql?(o)
|
|
94
|
+
self == o
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Calculates hash code according to all attributes.
|
|
98
|
+
# @return [Integer] Hash code
|
|
99
|
+
def hash
|
|
100
|
+
[regist_list].hash
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Builds the object from hash
|
|
104
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
105
|
+
# @return [Object] Returns the model itself
|
|
106
|
+
def self.build_from_hash(attributes)
|
|
107
|
+
return nil unless attributes.is_a?(Hash)
|
|
108
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
109
|
+
transformed_hash = {}
|
|
110
|
+
openapi_types.each_pair do |key, type|
|
|
111
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
112
|
+
transformed_hash["#{key}"] = nil
|
|
113
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
114
|
+
# check to ensure the input is an array given that the attribute
|
|
115
|
+
# is documented as an array but the input is not
|
|
116
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
117
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
118
|
+
end
|
|
119
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
120
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
new(transformed_hash)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Deserializes the data based on type
|
|
127
|
+
# @param string type Data type
|
|
128
|
+
# @param string value Value to be deserialized
|
|
129
|
+
# @return [Object] Deserialized data
|
|
130
|
+
def self._deserialize(type, value)
|
|
131
|
+
case type.to_sym
|
|
132
|
+
when :Time
|
|
133
|
+
Time.parse(value)
|
|
134
|
+
when :Date
|
|
135
|
+
Date.parse(value)
|
|
136
|
+
when :String
|
|
137
|
+
value.to_s
|
|
138
|
+
when :Integer
|
|
139
|
+
value.to_i
|
|
140
|
+
when :Float
|
|
141
|
+
value.to_f
|
|
142
|
+
when :Boolean
|
|
143
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
144
|
+
true
|
|
145
|
+
else
|
|
146
|
+
false
|
|
147
|
+
end
|
|
148
|
+
when :Object
|
|
149
|
+
# generic object (usually a Hash), return directly
|
|
150
|
+
value
|
|
151
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
152
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
153
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
154
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
155
|
+
k_type = Regexp.last_match[:k_type]
|
|
156
|
+
v_type = Regexp.last_match[:v_type]
|
|
157
|
+
{}.tap do |hash|
|
|
158
|
+
value.each do |k, v|
|
|
159
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
else # model
|
|
163
|
+
# models (e.g. Pet) or oneOf
|
|
164
|
+
klass = KabustationClient.const_get(type)
|
|
165
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Returns the string representation of the object
|
|
170
|
+
# @return [String] String presentation of the object
|
|
171
|
+
def to_s
|
|
172
|
+
to_hash.to_s
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
176
|
+
# @return [Hash] Returns the object in the form of hash
|
|
177
|
+
def to_body
|
|
178
|
+
to_hash
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# Returns the object in the form of hash
|
|
182
|
+
# @return [Hash] Returns the object in the form of hash
|
|
183
|
+
def to_hash
|
|
184
|
+
hash = {}
|
|
185
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
186
|
+
value = self.send(attr)
|
|
187
|
+
if value.nil?
|
|
188
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
189
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
hash[param] = _to_hash(value)
|
|
193
|
+
end
|
|
194
|
+
hash
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# Outputs non-array value in the form of hash
|
|
198
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
199
|
+
# @param [Object] value Any valid value
|
|
200
|
+
# @return [Hash] Returns the value in the form of hash
|
|
201
|
+
def _to_hash(value)
|
|
202
|
+
if value.is_a?(Array)
|
|
203
|
+
value.compact.map { |v| _to_hash(v) }
|
|
204
|
+
elsif value.is_a?(Hash)
|
|
205
|
+
{}.tap do |hash|
|
|
206
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
207
|
+
end
|
|
208
|
+
elsif value.respond_to? :to_hash
|
|
209
|
+
value.to_hash
|
|
210
|
+
else
|
|
211
|
+
value
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
end
|