tinkoff_invest_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 +169 -0
- data/Rakefile +10 -0
- data/docs/BrokerAccountType.md +15 -0
- data/docs/Candle.md +32 -0
- data/docs/CandleResolution.md +15 -0
- data/docs/Candles.md +22 -0
- data/docs/CandlesResponse.md +22 -0
- data/docs/Currencies.md +18 -0
- data/docs/Currency.md +15 -0
- data/docs/CurrencyPosition.md +22 -0
- data/docs/Empty.md +22 -0
- data/docs/Error.md +22 -0
- data/docs/ErrorPayload.md +20 -0
- data/docs/InstrumentType.md +15 -0
- data/docs/LimitOrderRequest.md +22 -0
- data/docs/LimitOrderResponse.md +22 -0
- data/docs/MarketApi.md +547 -0
- data/docs/MarketInstrument.md +34 -0
- data/docs/MarketInstrumentList.md +20 -0
- data/docs/MarketInstrumentListResponse.md +22 -0
- data/docs/MarketInstrumentResponse.md +22 -0
- data/docs/MarketOrderRequest.md +20 -0
- data/docs/MarketOrderResponse.md +22 -0
- data/docs/MoneyAmount.md +20 -0
- data/docs/Operation.md +44 -0
- data/docs/OperationStatus.md +15 -0
- data/docs/OperationTrade.md +24 -0
- data/docs/OperationType.md +15 -0
- data/docs/OperationTypeWithCommission.md +15 -0
- data/docs/Operations.md +18 -0
- data/docs/OperationsApi.md +83 -0
- data/docs/OperationsResponse.md +22 -0
- data/docs/Order.md +32 -0
- data/docs/OrderResponse.md +20 -0
- data/docs/OrderStatus.md +15 -0
- data/docs/OrderType.md +15 -0
- data/docs/Orderbook.md +38 -0
- data/docs/OrderbookResponse.md +22 -0
- data/docs/OrdersApi.md +297 -0
- data/docs/OrdersResponse.md +22 -0
- data/docs/PlacedLimitOrder.md +32 -0
- data/docs/PlacedMarketOrder.md +32 -0
- data/docs/Portfolio.md +18 -0
- data/docs/PortfolioApi.md +147 -0
- data/docs/PortfolioCurrenciesResponse.md +22 -0
- data/docs/PortfolioPosition.md +38 -0
- data/docs/PortfolioResponse.md +22 -0
- data/docs/SandboxAccount.md +20 -0
- data/docs/SandboxApi.md +367 -0
- data/docs/SandboxCurrency.md +15 -0
- data/docs/SandboxRegisterRequest.md +18 -0
- data/docs/SandboxRegisterResponse.md +22 -0
- data/docs/SandboxSetCurrencyBalanceRequest.md +20 -0
- data/docs/SandboxSetPositionBalanceRequest.md +20 -0
- data/docs/SearchMarketInstrument.md +32 -0
- data/docs/SearchMarketInstrumentResponse.md +22 -0
- data/docs/TradeStatus.md +15 -0
- data/docs/UserAccount.md +20 -0
- data/docs/UserAccounts.md +18 -0
- data/docs/UserAccountsResponse.md +22 -0
- data/docs/UserApi.md +72 -0
- data/generator_options.md +1 -0
- data/git_push.sh +58 -0
- data/lib/tinkoff_invest_client.rb +98 -0
- data/lib/tinkoff_invest_client/api/market_api.rb +518 -0
- data/lib/tinkoff_invest_client/api/operations_api.rb +97 -0
- data/lib/tinkoff_invest_client/api/orders_api.rb +291 -0
- data/lib/tinkoff_invest_client/api/portfolio_api.rb +138 -0
- data/lib/tinkoff_invest_client/api/sandbox_api.rb +335 -0
- data/lib/tinkoff_invest_client/api/user_api.rb +77 -0
- data/lib/tinkoff_invest_client/api_client.rb +390 -0
- data/lib/tinkoff_invest_client/api_error.rb +57 -0
- data/lib/tinkoff_invest_client/configuration.rb +281 -0
- data/lib/tinkoff_invest_client/models/broker_account_type.rb +37 -0
- data/lib/tinkoff_invest_client/models/candle.rb +322 -0
- data/lib/tinkoff_invest_client/models/candle_resolution.rb +46 -0
- data/lib/tinkoff_invest_client/models/candles.rb +253 -0
- data/lib/tinkoff_invest_client/models/candles_response.rb +253 -0
- data/lib/tinkoff_invest_client/models/currencies.rb +225 -0
- data/lib/tinkoff_invest_client/models/currency.rb +44 -0
- data/lib/tinkoff_invest_client/models/currency_position.rb +246 -0
- data/lib/tinkoff_invest_client/models/empty.rb +253 -0
- data/lib/tinkoff_invest_client/models/error.rb +253 -0
- data/lib/tinkoff_invest_client/models/error_payload.rb +227 -0
- data/lib/tinkoff_invest_client/models/instrument_type.rb +39 -0
- data/lib/tinkoff_invest_client/models/limit_order_request.rb +251 -0
- data/lib/tinkoff_invest_client/models/limit_order_response.rb +253 -0
- data/lib/tinkoff_invest_client/models/market_instrument.rb +317 -0
- data/lib/tinkoff_invest_client/models/market_instrument_list.rb +239 -0
- data/lib/tinkoff_invest_client/models/market_instrument_list_response.rb +253 -0
- data/lib/tinkoff_invest_client/models/market_instrument_response.rb +253 -0
- data/lib/tinkoff_invest_client/models/market_order_request.rb +237 -0
- data/lib/tinkoff_invest_client/models/market_order_response.rb +253 -0
- data/lib/tinkoff_invest_client/models/money_amount.rb +237 -0
- data/lib/tinkoff_invest_client/models/operation.rb +370 -0
- data/lib/tinkoff_invest_client/models/operation_status.rb +38 -0
- data/lib/tinkoff_invest_client/models/operation_trade.rb +266 -0
- data/lib/tinkoff_invest_client/models/operation_type.rb +37 -0
- data/lib/tinkoff_invest_client/models/operation_type_with_commission.rb +56 -0
- data/lib/tinkoff_invest_client/models/operations.rb +225 -0
- data/lib/tinkoff_invest_client/models/operations_response.rb +253 -0
- data/lib/tinkoff_invest_client/models/order.rb +321 -0
- data/lib/tinkoff_invest_client/models/order_response.rb +237 -0
- data/lib/tinkoff_invest_client/models/order_status.rb +44 -0
- data/lib/tinkoff_invest_client/models/order_type.rb +37 -0
- data/lib/tinkoff_invest_client/models/orderbook.rb +346 -0
- data/lib/tinkoff_invest_client/models/orderbook_response.rb +253 -0
- data/lib/tinkoff_invest_client/models/orders_response.rb +255 -0
- data/lib/tinkoff_invest_client/models/placed_limit_order.rb +307 -0
- data/lib/tinkoff_invest_client/models/placed_market_order.rb +307 -0
- data/lib/tinkoff_invest_client/models/portfolio.rb +225 -0
- data/lib/tinkoff_invest_client/models/portfolio_currencies_response.rb +253 -0
- data/lib/tinkoff_invest_client/models/portfolio_position.rb +333 -0
- data/lib/tinkoff_invest_client/models/portfolio_response.rb +253 -0
- data/lib/tinkoff_invest_client/models/sandbox_account.rb +237 -0
- data/lib/tinkoff_invest_client/models/sandbox_currency.rb +44 -0
- data/lib/tinkoff_invest_client/models/sandbox_register_request.rb +218 -0
- data/lib/tinkoff_invest_client/models/sandbox_register_response.rb +253 -0
- data/lib/tinkoff_invest_client/models/sandbox_set_currency_balance_request.rb +237 -0
- data/lib/tinkoff_invest_client/models/sandbox_set_position_balance_request.rb +232 -0
- data/lib/tinkoff_invest_client/models/search_market_instrument.rb +307 -0
- data/lib/tinkoff_invest_client/models/search_market_instrument_response.rb +253 -0
- data/lib/tinkoff_invest_client/models/trade_status.rb +37 -0
- data/lib/tinkoff_invest_client/models/user_account.rb +237 -0
- data/lib/tinkoff_invest_client/models/user_accounts.rb +225 -0
- data/lib/tinkoff_invest_client/models/user_accounts_response.rb +253 -0
- data/lib/tinkoff_invest_client/version.rb +15 -0
- data/spec/api/market_api_spec.rb +123 -0
- data/spec/api/operations_api_spec.rb +49 -0
- data/spec/api/orders_api_spec.rb +84 -0
- data/spec/api/portfolio_api_spec.rb +57 -0
- data/spec/api/sandbox_api_spec.rb +95 -0
- data/spec/api/user_api_spec.rb +45 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/broker_account_type_spec.rb +28 -0
- data/spec/models/candle_resolution_spec.rb +28 -0
- data/spec/models/candle_spec.rb +76 -0
- data/spec/models/candles_response_spec.rb +46 -0
- data/spec/models/candles_spec.rb +46 -0
- data/spec/models/currencies_spec.rb +34 -0
- data/spec/models/currency_position_spec.rb +46 -0
- data/spec/models/currency_spec.rb +28 -0
- data/spec/models/empty_spec.rb +46 -0
- data/spec/models/error_payload_spec.rb +40 -0
- data/spec/models/error_spec.rb +46 -0
- data/spec/models/instrument_type_spec.rb +28 -0
- data/spec/models/limit_order_request_spec.rb +46 -0
- data/spec/models/limit_order_response_spec.rb +46 -0
- data/spec/models/market_instrument_list_response_spec.rb +46 -0
- data/spec/models/market_instrument_list_spec.rb +40 -0
- data/spec/models/market_instrument_response_spec.rb +46 -0
- data/spec/models/market_instrument_spec.rb +82 -0
- data/spec/models/market_order_request_spec.rb +40 -0
- data/spec/models/market_order_response_spec.rb +46 -0
- data/spec/models/money_amount_spec.rb +40 -0
- data/spec/models/operation_spec.rb +112 -0
- data/spec/models/operation_status_spec.rb +28 -0
- data/spec/models/operation_trade_spec.rb +52 -0
- data/spec/models/operation_type_spec.rb +28 -0
- data/spec/models/operation_type_with_commission_spec.rb +28 -0
- data/spec/models/operations_response_spec.rb +46 -0
- data/spec/models/operations_spec.rb +34 -0
- data/spec/models/order_response_spec.rb +40 -0
- data/spec/models/order_spec.rb +76 -0
- data/spec/models/order_status_spec.rb +28 -0
- data/spec/models/order_type_spec.rb +28 -0
- data/spec/models/orderbook_response_spec.rb +46 -0
- data/spec/models/orderbook_spec.rb +94 -0
- data/spec/models/orders_response_spec.rb +46 -0
- data/spec/models/placed_limit_order_spec.rb +76 -0
- data/spec/models/placed_market_order_spec.rb +76 -0
- data/spec/models/portfolio_currencies_response_spec.rb +46 -0
- data/spec/models/portfolio_position_spec.rb +94 -0
- data/spec/models/portfolio_response_spec.rb +46 -0
- data/spec/models/portfolio_spec.rb +34 -0
- data/spec/models/sandbox_account_spec.rb +40 -0
- data/spec/models/sandbox_currency_spec.rb +28 -0
- data/spec/models/sandbox_register_request_spec.rb +34 -0
- data/spec/models/sandbox_register_response_spec.rb +46 -0
- data/spec/models/sandbox_set_currency_balance_request_spec.rb +40 -0
- data/spec/models/sandbox_set_position_balance_request_spec.rb +40 -0
- data/spec/models/search_market_instrument_response_spec.rb +46 -0
- data/spec/models/search_market_instrument_spec.rb +76 -0
- data/spec/models/trade_status_spec.rb +28 -0
- data/spec/models/user_account_spec.rb +40 -0
- data/spec/models/user_accounts_response_spec.rb +46 -0
- data/spec/models/user_accounts_spec.rb +34 -0
- data/spec/spec_helper.rb +111 -0
- data/tinkoff_invest_client.gemspec +38 -0
- metadata +336 -0
@@ -0,0 +1,44 @@
|
|
1
|
+
=begin
|
2
|
+
#OpenAPI
|
3
|
+
|
4
|
+
#tinkoff.ru/invest OpenAPI.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: al.a.volkov@tinkoff.ru
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.0.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module TinkoffInvestClient
|
17
|
+
class SandboxCurrency
|
18
|
+
RUB = "RUB".freeze
|
19
|
+
USD = "USD".freeze
|
20
|
+
EUR = "EUR".freeze
|
21
|
+
GBP = "GBP".freeze
|
22
|
+
HKD = "HKD".freeze
|
23
|
+
CHF = "CHF".freeze
|
24
|
+
JPY = "JPY".freeze
|
25
|
+
CNY = "CNY".freeze
|
26
|
+
TRY = "TRY".freeze
|
27
|
+
|
28
|
+
# Builds the enum from string
|
29
|
+
# @param [String] The enum value in the form of the string
|
30
|
+
# @return [String] The enum value
|
31
|
+
def self.build_from_hash(value)
|
32
|
+
new.build_from_hash(value)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Builds the enum from string
|
36
|
+
# @param [String] The enum value in the form of the string
|
37
|
+
# @return [String] The enum value
|
38
|
+
def build_from_hash(value)
|
39
|
+
constantValues = SandboxCurrency.constants.select { |c| SandboxCurrency::const_get(c) == value }
|
40
|
+
raise "Invalid ENUM value #{value} for class #SandboxCurrency" if constantValues.empty?
|
41
|
+
value
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,218 @@
|
|
1
|
+
=begin
|
2
|
+
#OpenAPI
|
3
|
+
|
4
|
+
#tinkoff.ru/invest OpenAPI.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: al.a.volkov@tinkoff.ru
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.0.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module TinkoffInvestClient
|
17
|
+
class SandboxRegisterRequest
|
18
|
+
attr_accessor :broker_account_type
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'broker_account_type' => :'brokerAccountType'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Returns all the JSON keys this model knows about
|
28
|
+
def self.acceptable_attributes
|
29
|
+
attribute_map.values
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.openapi_types
|
34
|
+
{
|
35
|
+
:'broker_account_type' => :'BrokerAccountType'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# List of attributes with nullable: true
|
40
|
+
def self.openapi_nullable
|
41
|
+
Set.new([
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TinkoffInvestClient::SandboxRegisterRequest` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TinkoffInvestClient::SandboxRegisterRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'broker_account_type')
|
61
|
+
self.broker_account_type = attributes[:'broker_account_type']
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
66
|
+
# @return Array for valid properties with the reasons
|
67
|
+
def list_invalid_properties
|
68
|
+
invalid_properties = Array.new
|
69
|
+
invalid_properties
|
70
|
+
end
|
71
|
+
|
72
|
+
# Check to see if the all the properties in the model are valid
|
73
|
+
# @return true if the model is valid
|
74
|
+
def valid?
|
75
|
+
true
|
76
|
+
end
|
77
|
+
|
78
|
+
# Checks equality by comparing each attribute.
|
79
|
+
# @param [Object] Object to be compared
|
80
|
+
def ==(o)
|
81
|
+
return true if self.equal?(o)
|
82
|
+
self.class == o.class &&
|
83
|
+
broker_account_type == o.broker_account_type
|
84
|
+
end
|
85
|
+
|
86
|
+
# @see the `==` method
|
87
|
+
# @param [Object] Object to be compared
|
88
|
+
def eql?(o)
|
89
|
+
self == o
|
90
|
+
end
|
91
|
+
|
92
|
+
# Calculates hash code according to all attributes.
|
93
|
+
# @return [Integer] Hash code
|
94
|
+
def hash
|
95
|
+
[broker_account_type].hash
|
96
|
+
end
|
97
|
+
|
98
|
+
# Builds the object from hash
|
99
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
100
|
+
# @return [Object] Returns the model itself
|
101
|
+
def self.build_from_hash(attributes)
|
102
|
+
new.build_from_hash(attributes)
|
103
|
+
end
|
104
|
+
|
105
|
+
# Builds the object from hash
|
106
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
107
|
+
# @return [Object] Returns the model itself
|
108
|
+
def build_from_hash(attributes)
|
109
|
+
return nil unless attributes.is_a?(Hash)
|
110
|
+
self.class.openapi_types.each_pair do |key, type|
|
111
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
112
|
+
self.send("#{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[self.class.attribute_map[key]].is_a?(Array)
|
117
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
118
|
+
end
|
119
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
120
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
self
|
125
|
+
end
|
126
|
+
|
127
|
+
# Deserializes the data based on type
|
128
|
+
# @param string type Data type
|
129
|
+
# @param string value Value to be deserialized
|
130
|
+
# @return [Object] Deserialized data
|
131
|
+
def _deserialize(type, value)
|
132
|
+
case type.to_sym
|
133
|
+
when :Time
|
134
|
+
Time.parse(value)
|
135
|
+
when :Date
|
136
|
+
Date.parse(value)
|
137
|
+
when :String
|
138
|
+
value.to_s
|
139
|
+
when :Integer
|
140
|
+
value.to_i
|
141
|
+
when :Float
|
142
|
+
value.to_f
|
143
|
+
when :Boolean
|
144
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
145
|
+
true
|
146
|
+
else
|
147
|
+
false
|
148
|
+
end
|
149
|
+
when :Object
|
150
|
+
# generic object (usually a Hash), return directly
|
151
|
+
value
|
152
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
153
|
+
inner_type = Regexp.last_match[:inner_type]
|
154
|
+
value.map { |v| _deserialize(inner_type, v) }
|
155
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
156
|
+
k_type = Regexp.last_match[:k_type]
|
157
|
+
v_type = Regexp.last_match[:v_type]
|
158
|
+
{}.tap do |hash|
|
159
|
+
value.each do |k, v|
|
160
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
else # model
|
164
|
+
# models (e.g. Pet) or oneOf
|
165
|
+
klass = TinkoffInvestClient.const_get(type)
|
166
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
# Returns the string representation of the object
|
171
|
+
# @return [String] String presentation of the object
|
172
|
+
def to_s
|
173
|
+
to_hash.to_s
|
174
|
+
end
|
175
|
+
|
176
|
+
# to_body is an alias to to_hash (backward compatibility)
|
177
|
+
# @return [Hash] Returns the object in the form of hash
|
178
|
+
def to_body
|
179
|
+
to_hash
|
180
|
+
end
|
181
|
+
|
182
|
+
# Returns the object in the form of hash
|
183
|
+
# @return [Hash] Returns the object in the form of hash
|
184
|
+
def to_hash
|
185
|
+
hash = {}
|
186
|
+
self.class.attribute_map.each_pair do |attr, param|
|
187
|
+
value = self.send(attr)
|
188
|
+
if value.nil?
|
189
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
190
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
191
|
+
end
|
192
|
+
|
193
|
+
hash[param] = _to_hash(value)
|
194
|
+
end
|
195
|
+
hash
|
196
|
+
end
|
197
|
+
|
198
|
+
# Outputs non-array value in the form of hash
|
199
|
+
# For object, use to_hash. Otherwise, just return the value
|
200
|
+
# @param [Object] value Any valid value
|
201
|
+
# @return [Hash] Returns the value in the form of hash
|
202
|
+
def _to_hash(value)
|
203
|
+
if value.is_a?(Array)
|
204
|
+
value.compact.map { |v| _to_hash(v) }
|
205
|
+
elsif value.is_a?(Hash)
|
206
|
+
{}.tap do |hash|
|
207
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
208
|
+
end
|
209
|
+
elsif value.respond_to? :to_hash
|
210
|
+
value.to_hash
|
211
|
+
else
|
212
|
+
value
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|
@@ -0,0 +1,253 @@
|
|
1
|
+
=begin
|
2
|
+
#OpenAPI
|
3
|
+
|
4
|
+
#tinkoff.ru/invest OpenAPI.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: al.a.volkov@tinkoff.ru
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.0.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module TinkoffInvestClient
|
17
|
+
class SandboxRegisterResponse
|
18
|
+
attr_accessor :tracking_id
|
19
|
+
|
20
|
+
attr_accessor :status
|
21
|
+
|
22
|
+
attr_accessor :payload
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'tracking_id' => :'trackingId',
|
28
|
+
:'status' => :'status',
|
29
|
+
:'payload' => :'payload'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Returns all the JSON keys this model knows about
|
34
|
+
def self.acceptable_attributes
|
35
|
+
attribute_map.values
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.openapi_types
|
40
|
+
{
|
41
|
+
:'tracking_id' => :'String',
|
42
|
+
:'status' => :'String',
|
43
|
+
:'payload' => :'SandboxAccount'
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
# List of attributes with nullable: true
|
48
|
+
def self.openapi_nullable
|
49
|
+
Set.new([
|
50
|
+
])
|
51
|
+
end
|
52
|
+
|
53
|
+
# Initializes the object
|
54
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
55
|
+
def initialize(attributes = {})
|
56
|
+
if (!attributes.is_a?(Hash))
|
57
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TinkoffInvestClient::SandboxRegisterResponse` initialize method"
|
58
|
+
end
|
59
|
+
|
60
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
61
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
62
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
63
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TinkoffInvestClient::SandboxRegisterResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
64
|
+
end
|
65
|
+
h[k.to_sym] = v
|
66
|
+
}
|
67
|
+
|
68
|
+
if attributes.key?(:'tracking_id')
|
69
|
+
self.tracking_id = attributes[:'tracking_id']
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.key?(:'status')
|
73
|
+
self.status = attributes[:'status']
|
74
|
+
else
|
75
|
+
self.status = 'Ok'
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.key?(:'payload')
|
79
|
+
self.payload = attributes[:'payload']
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
84
|
+
# @return Array for valid properties with the reasons
|
85
|
+
def list_invalid_properties
|
86
|
+
invalid_properties = Array.new
|
87
|
+
if @tracking_id.nil?
|
88
|
+
invalid_properties.push('invalid value for "tracking_id", tracking_id cannot be nil.')
|
89
|
+
end
|
90
|
+
|
91
|
+
if @status.nil?
|
92
|
+
invalid_properties.push('invalid value for "status", status cannot be nil.')
|
93
|
+
end
|
94
|
+
|
95
|
+
if @payload.nil?
|
96
|
+
invalid_properties.push('invalid value for "payload", payload cannot be nil.')
|
97
|
+
end
|
98
|
+
|
99
|
+
invalid_properties
|
100
|
+
end
|
101
|
+
|
102
|
+
# Check to see if the all the properties in the model are valid
|
103
|
+
# @return true if the model is valid
|
104
|
+
def valid?
|
105
|
+
return false if @tracking_id.nil?
|
106
|
+
return false if @status.nil?
|
107
|
+
return false if @payload.nil?
|
108
|
+
true
|
109
|
+
end
|
110
|
+
|
111
|
+
# Checks equality by comparing each attribute.
|
112
|
+
# @param [Object] Object to be compared
|
113
|
+
def ==(o)
|
114
|
+
return true if self.equal?(o)
|
115
|
+
self.class == o.class &&
|
116
|
+
tracking_id == o.tracking_id &&
|
117
|
+
status == o.status &&
|
118
|
+
payload == o.payload
|
119
|
+
end
|
120
|
+
|
121
|
+
# @see the `==` method
|
122
|
+
# @param [Object] Object to be compared
|
123
|
+
def eql?(o)
|
124
|
+
self == o
|
125
|
+
end
|
126
|
+
|
127
|
+
# Calculates hash code according to all attributes.
|
128
|
+
# @return [Integer] Hash code
|
129
|
+
def hash
|
130
|
+
[tracking_id, status, payload].hash
|
131
|
+
end
|
132
|
+
|
133
|
+
# Builds the object from hash
|
134
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
135
|
+
# @return [Object] Returns the model itself
|
136
|
+
def self.build_from_hash(attributes)
|
137
|
+
new.build_from_hash(attributes)
|
138
|
+
end
|
139
|
+
|
140
|
+
# Builds the object from hash
|
141
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
142
|
+
# @return [Object] Returns the model itself
|
143
|
+
def build_from_hash(attributes)
|
144
|
+
return nil unless attributes.is_a?(Hash)
|
145
|
+
self.class.openapi_types.each_pair do |key, type|
|
146
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
147
|
+
self.send("#{key}=", nil)
|
148
|
+
elsif type =~ /\AArray<(.*)>/i
|
149
|
+
# check to ensure the input is an array given that the attribute
|
150
|
+
# is documented as an array but the input is not
|
151
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
152
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
153
|
+
end
|
154
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
155
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
self
|
160
|
+
end
|
161
|
+
|
162
|
+
# Deserializes the data based on type
|
163
|
+
# @param string type Data type
|
164
|
+
# @param string value Value to be deserialized
|
165
|
+
# @return [Object] Deserialized data
|
166
|
+
def _deserialize(type, value)
|
167
|
+
case type.to_sym
|
168
|
+
when :Time
|
169
|
+
Time.parse(value)
|
170
|
+
when :Date
|
171
|
+
Date.parse(value)
|
172
|
+
when :String
|
173
|
+
value.to_s
|
174
|
+
when :Integer
|
175
|
+
value.to_i
|
176
|
+
when :Float
|
177
|
+
value.to_f
|
178
|
+
when :Boolean
|
179
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
180
|
+
true
|
181
|
+
else
|
182
|
+
false
|
183
|
+
end
|
184
|
+
when :Object
|
185
|
+
# generic object (usually a Hash), return directly
|
186
|
+
value
|
187
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
188
|
+
inner_type = Regexp.last_match[:inner_type]
|
189
|
+
value.map { |v| _deserialize(inner_type, v) }
|
190
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
191
|
+
k_type = Regexp.last_match[:k_type]
|
192
|
+
v_type = Regexp.last_match[:v_type]
|
193
|
+
{}.tap do |hash|
|
194
|
+
value.each do |k, v|
|
195
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
else # model
|
199
|
+
# models (e.g. Pet) or oneOf
|
200
|
+
klass = TinkoffInvestClient.const_get(type)
|
201
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
# Returns the string representation of the object
|
206
|
+
# @return [String] String presentation of the object
|
207
|
+
def to_s
|
208
|
+
to_hash.to_s
|
209
|
+
end
|
210
|
+
|
211
|
+
# to_body is an alias to to_hash (backward compatibility)
|
212
|
+
# @return [Hash] Returns the object in the form of hash
|
213
|
+
def to_body
|
214
|
+
to_hash
|
215
|
+
end
|
216
|
+
|
217
|
+
# Returns the object in the form of hash
|
218
|
+
# @return [Hash] Returns the object in the form of hash
|
219
|
+
def to_hash
|
220
|
+
hash = {}
|
221
|
+
self.class.attribute_map.each_pair do |attr, param|
|
222
|
+
value = self.send(attr)
|
223
|
+
if value.nil?
|
224
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
225
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
226
|
+
end
|
227
|
+
|
228
|
+
hash[param] = _to_hash(value)
|
229
|
+
end
|
230
|
+
hash
|
231
|
+
end
|
232
|
+
|
233
|
+
# Outputs non-array value in the form of hash
|
234
|
+
# For object, use to_hash. Otherwise, just return the value
|
235
|
+
# @param [Object] value Any valid value
|
236
|
+
# @return [Hash] Returns the value in the form of hash
|
237
|
+
def _to_hash(value)
|
238
|
+
if value.is_a?(Array)
|
239
|
+
value.compact.map { |v| _to_hash(v) }
|
240
|
+
elsif value.is_a?(Hash)
|
241
|
+
{}.tap do |hash|
|
242
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
243
|
+
end
|
244
|
+
elsif value.respond_to? :to_hash
|
245
|
+
value.to_hash
|
246
|
+
else
|
247
|
+
value
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
end
|
252
|
+
|
253
|
+
end
|