snaptrade 2.0.31 → 2.0.32

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.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +31 -29
  3. data/README.md +4 -2
  4. data/lib/snaptrade/api/account_information_api.rb +6 -2
  5. data/lib/snaptrade/models/account_holdings_account.rb +1 -1
  6. data/lib/snaptrade/models/account_order_record.rb +4 -2
  7. data/lib/snaptrade/models/exchange.rb +9 -1
  8. data/lib/snaptrade/models/figi_instrument.rb +3 -1
  9. data/lib/snaptrade/models/option_brokerage_symbol.rb +3 -1
  10. data/lib/snaptrade/models/options_position.rb +1 -1
  11. data/lib/snaptrade/models/options_position_currency.rb +1 -0
  12. data/lib/snaptrade/models/options_symbol.rb +12 -24
  13. data/lib/snaptrade/models/position_symbol.rb +6 -1
  14. data/lib/snaptrade/models/security_type.rb +5 -1
  15. data/lib/snaptrade/models/symbol_figi_instrument.rb +2 -0
  16. data/lib/snaptrade/models/underlying_symbol.rb +20 -5
  17. data/lib/snaptrade/models/{model_portfolio.rb → underlying_symbol_exchange.rb} +73 -12
  18. data/lib/snaptrade/models/{brokerage_symbol.rb → underlying_symbol_type.rb} +28 -38
  19. data/lib/snaptrade/models/universal_symbol.rb +9 -3
  20. data/lib/snaptrade/models/{model_asset_class.rb → universal_symbol_currency.rb} +24 -4
  21. data/lib/snaptrade/models/{portfolio_group.rb → universal_symbol_exchange.rb} +78 -7
  22. data/lib/snaptrade/version.rb +1 -1
  23. data/lib/snaptrade.rb +4 -36
  24. data/spec/api/account_information_api_spec.rb +1 -1
  25. data/spec/models/options_symbol_spec.rb +0 -12
  26. data/spec/models/{brokerage_symbol_option_symbol_spec.rb → underlying_symbol_exchange_spec.rb} +14 -14
  27. data/spec/models/underlying_symbol_spec.rb +6 -0
  28. data/spec/models/{trade_impact_spec.rb → underlying_symbol_type_spec.rb} +10 -16
  29. data/spec/models/{model_portfolio_spec.rb → universal_symbol_currency_spec.rb} +8 -8
  30. data/spec/models/{trade_spec.rb → universal_symbol_exchange_spec.rb} +13 -13
  31. metadata +113 -209
  32. data/lib/snaptrade/models/brokerage_authorization_type.rb +0 -216
  33. data/lib/snaptrade/models/brokerage_authorization_type_type.rb +0 -37
  34. data/lib/snaptrade/models/brokerage_symbol_option_symbol.rb +0 -325
  35. data/lib/snaptrade/models/brokerage_symbol_symbol.rb +0 -339
  36. data/lib/snaptrade/models/calculated_trade.rb +0 -228
  37. data/lib/snaptrade/models/excluded_asset.rb +0 -217
  38. data/lib/snaptrade/models/jwt.rb +0 -217
  39. data/lib/snaptrade/models/model_asset_class_details.rb +0 -227
  40. data/lib/snaptrade/models/model_asset_class_target.rb +0 -216
  41. data/lib/snaptrade/models/model_portfolio_asset_class.rb +0 -249
  42. data/lib/snaptrade/models/model_portfolio_details.rb +0 -238
  43. data/lib/snaptrade/models/model_portfolio_security.rb +0 -249
  44. data/lib/snaptrade/models/model_type.rb +0 -38
  45. data/lib/snaptrade/models/portfolio_group_info.rb +0 -325
  46. data/lib/snaptrade/models/portfolio_group_position.rb +0 -237
  47. data/lib/snaptrade/models/portfolio_group_settings.rb +0 -276
  48. data/lib/snaptrade/models/redirect_tokenand_pin.rb +0 -226
  49. data/lib/snaptrade/models/snap_trade_api_disclaimer_accept_status.rb +0 -226
  50. data/lib/snaptrade/models/state.rb +0 -40
  51. data/lib/snaptrade/models/strategy_impact.rb +0 -309
  52. data/lib/snaptrade/models/strategy_impact_legs_inner.rb +0 -270
  53. data/lib/snaptrade/models/strategy_order_place.rb +0 -228
  54. data/lib/snaptrade/models/strategy_order_place_orders_inner.rb +0 -596
  55. data/lib/snaptrade/models/strategy_order_place_orders_inner_legs_inner.rb +0 -270
  56. data/lib/snaptrade/models/target_asset.rb +0 -289
  57. data/lib/snaptrade/models/trade.rb +0 -280
  58. data/lib/snaptrade/models/trade_action.rb +0 -37
  59. data/lib/snaptrade/models/trade_execution_status.rb +0 -297
  60. data/lib/snaptrade/models/trade_execution_status_action.rb +0 -37
  61. data/lib/snaptrade/models/trade_impact.rb +0 -256
  62. data/lib/snaptrade/models/user_error_log.rb +0 -262
  63. data/lib/snaptrade/models/user_settings.rb +0 -298
  64. data/spec/models/brokerage_authorization_type_spec.rb +0 -29
  65. data/spec/models/brokerage_authorization_type_type_spec.rb +0 -23
  66. data/spec/models/brokerage_symbol_spec.rb +0 -59
  67. data/spec/models/brokerage_symbol_symbol_spec.rb +0 -83
  68. data/spec/models/calculated_trade_spec.rb +0 -35
  69. data/spec/models/excluded_asset_spec.rb +0 -29
  70. data/spec/models/jwt_spec.rb +0 -29
  71. data/spec/models/model_asset_class_details_spec.rb +0 -35
  72. data/spec/models/model_asset_class_spec.rb +0 -35
  73. data/spec/models/model_asset_class_target_spec.rb +0 -29
  74. data/spec/models/model_portfolio_asset_class_spec.rb +0 -35
  75. data/spec/models/model_portfolio_details_spec.rb +0 -41
  76. data/spec/models/model_portfolio_security_spec.rb +0 -35
  77. data/spec/models/model_type_spec.rb +0 -23
  78. data/spec/models/portfolio_group_info_spec.rb +0 -89
  79. data/spec/models/portfolio_group_position_spec.rb +0 -41
  80. data/spec/models/portfolio_group_settings_spec.rb +0 -53
  81. data/spec/models/portfolio_group_spec.rb +0 -35
  82. data/spec/models/redirect_tokenand_pin_spec.rb +0 -35
  83. data/spec/models/snap_trade_api_disclaimer_accept_status_spec.rb +0 -35
  84. data/spec/models/state_spec.rb +0 -23
  85. data/spec/models/strategy_impact_legs_inner_spec.rb +0 -65
  86. data/spec/models/strategy_impact_spec.rb +0 -89
  87. data/spec/models/strategy_order_place_orders_inner_legs_inner_spec.rb +0 -65
  88. data/spec/models/strategy_order_place_orders_inner_spec.rb +0 -281
  89. data/spec/models/strategy_order_place_spec.rb +0 -35
  90. data/spec/models/target_asset_spec.rb +0 -59
  91. data/spec/models/trade_action_spec.rb +0 -23
  92. data/spec/models/trade_execution_status_action_spec.rb +0 -23
  93. data/spec/models/trade_execution_status_spec.rb +0 -77
  94. data/spec/models/user_error_log_spec.rb +0 -59
  95. data/spec/models/user_settings_spec.rb +0 -83
@@ -1,339 +0,0 @@
1
- =begin
2
- #SnapTrade
3
-
4
- #Connect brokerage accounts to your app for live positions and trading
5
-
6
- The version of the OpenAPI document: 1.0.0
7
- Contact: api@snaptrade.com
8
- =end
9
-
10
- require 'date'
11
- require 'time'
12
-
13
- module SnapTrade
14
- class BrokerageSymbolSymbol
15
- attr_accessor :id
16
-
17
- attr_accessor :symbol
18
-
19
- attr_accessor :raw_symbol
20
-
21
- attr_accessor :description
22
-
23
- attr_accessor :currency
24
-
25
- attr_accessor :exchange
26
-
27
- attr_accessor :type
28
-
29
- attr_accessor :currencies
30
-
31
- attr_accessor :figi_code
32
-
33
- attr_accessor :figi_instrument
34
-
35
- # Attribute mapping from ruby-style variable name to JSON key.
36
- def self.attribute_map
37
- {
38
- :'id' => :'id',
39
- :'symbol' => :'symbol',
40
- :'raw_symbol' => :'raw_symbol',
41
- :'description' => :'description',
42
- :'currency' => :'currency',
43
- :'exchange' => :'exchange',
44
- :'type' => :'type',
45
- :'currencies' => :'currencies',
46
- :'figi_code' => :'figi_code',
47
- :'figi_instrument' => :'figi_instrument'
48
- }
49
- end
50
-
51
- # Returns all the JSON keys this model knows about
52
- def self.acceptable_attributes
53
- attribute_map.values
54
- end
55
-
56
- # Attribute type mapping.
57
- def self.openapi_types
58
- {
59
- :'id' => :'String',
60
- :'symbol' => :'String',
61
- :'raw_symbol' => :'String',
62
- :'description' => :'String',
63
- :'currency' => :'Currency',
64
- :'exchange' => :'Exchange',
65
- :'type' => :'SecurityType',
66
- :'currencies' => :'Array<Currency>',
67
- :'figi_code' => :'String',
68
- :'figi_instrument' => :'SymbolFigiInstrument'
69
- }
70
- end
71
-
72
- # List of attributes with nullable: true
73
- def self.openapi_nullable
74
- Set.new([
75
- :'description',
76
- :'figi_code',
77
- :'figi_instrument'
78
- ])
79
- end
80
-
81
- # List of class defined in allOf (OpenAPI v3)
82
- def self.openapi_all_of
83
- [
84
- :'UniversalSymbol'
85
- ]
86
- end
87
-
88
- # Initializes the object
89
- # @param [Hash] attributes Model attributes in the form of hash
90
- def initialize(attributes = {})
91
- if (!attributes.is_a?(Hash))
92
- fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::BrokerageSymbolSymbol` initialize method"
93
- end
94
-
95
- # check to see if the attribute exists and convert string to symbol for hash key
96
- attributes = attributes.each_with_object({}) { |(k, v), h|
97
- if (!self.class.attribute_map.key?(k.to_sym))
98
- fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::BrokerageSymbolSymbol`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
99
- end
100
- h[k.to_sym] = v
101
- }
102
-
103
- if attributes.key?(:'id')
104
- self.id = attributes[:'id']
105
- end
106
-
107
- if attributes.key?(:'symbol')
108
- self.symbol = attributes[:'symbol']
109
- end
110
-
111
- if attributes.key?(:'raw_symbol')
112
- self.raw_symbol = attributes[:'raw_symbol']
113
- end
114
-
115
- if attributes.key?(:'description')
116
- self.description = attributes[:'description']
117
- end
118
-
119
- if attributes.key?(:'currency')
120
- self.currency = attributes[:'currency']
121
- end
122
-
123
- if attributes.key?(:'exchange')
124
- self.exchange = attributes[:'exchange']
125
- end
126
-
127
- if attributes.key?(:'type')
128
- self.type = attributes[:'type']
129
- end
130
-
131
- if attributes.key?(:'currencies')
132
- if (value = attributes[:'currencies']).is_a?(Array)
133
- self.currencies = value
134
- end
135
- end
136
-
137
- if attributes.key?(:'figi_code')
138
- self.figi_code = attributes[:'figi_code']
139
- end
140
-
141
- if attributes.key?(:'figi_instrument')
142
- self.figi_instrument = attributes[:'figi_instrument']
143
- end
144
- end
145
-
146
- # Show invalid properties with the reasons. Usually used together with valid?
147
- # @return Array for valid properties with the reasons
148
- def list_invalid_properties
149
- invalid_properties = Array.new
150
- if @id.nil?
151
- invalid_properties.push('invalid value for "id", id cannot be nil.')
152
- end
153
-
154
- if @symbol.nil?
155
- invalid_properties.push('invalid value for "symbol", symbol cannot be nil.')
156
- end
157
-
158
- if @raw_symbol.nil?
159
- invalid_properties.push('invalid value for "raw_symbol", raw_symbol cannot be nil.')
160
- end
161
-
162
- if @currency.nil?
163
- invalid_properties.push('invalid value for "currency", currency cannot be nil.')
164
- end
165
-
166
- if @type.nil?
167
- invalid_properties.push('invalid value for "type", type cannot be nil.')
168
- end
169
-
170
- if @currencies.nil?
171
- invalid_properties.push('invalid value for "currencies", currencies cannot be nil.')
172
- end
173
-
174
- invalid_properties
175
- end
176
-
177
- # Check to see if the all the properties in the model are valid
178
- # @return true if the model is valid
179
- def valid?
180
- return false if @id.nil?
181
- return false if @symbol.nil?
182
- return false if @raw_symbol.nil?
183
- return false if @currency.nil?
184
- return false if @type.nil?
185
- return false if @currencies.nil?
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
- id == o.id &&
195
- symbol == o.symbol &&
196
- raw_symbol == o.raw_symbol &&
197
- description == o.description &&
198
- currency == o.currency &&
199
- exchange == o.exchange &&
200
- type == o.type &&
201
- currencies == o.currencies &&
202
- figi_code == o.figi_code &&
203
- figi_instrument == o.figi_instrument
204
- end
205
-
206
- # @see the `==` method
207
- # @param [Object] Object to be compared
208
- def eql?(o)
209
- self == o
210
- end
211
-
212
- # Calculates hash code according to all attributes.
213
- # @return [Integer] Hash code
214
- def hash
215
- [id, symbol, raw_symbol, description, currency, exchange, type, currencies, figi_code, figi_instrument].hash
216
- end
217
-
218
- # Builds the object from hash
219
- # @param [Hash] attributes Model attributes in the form of hash
220
- # @return [Object] Returns the model itself
221
- def self.build_from_hash(attributes)
222
- new.build_from_hash(attributes)
223
- end
224
-
225
- # Builds the object from hash
226
- # @param [Hash] attributes Model attributes in the form of hash
227
- # @return [Object] Returns the model itself
228
- def build_from_hash(attributes)
229
- return nil unless attributes.is_a?(Hash)
230
- attributes = attributes.transform_keys(&:to_sym)
231
- self.class.openapi_types.each_pair do |key, type|
232
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
233
- self.send("#{key}=", nil)
234
- elsif type =~ /\AArray<(.*)>/i
235
- # check to ensure the input is an array given that the attribute
236
- # is documented as an array but the input is not
237
- if attributes[self.class.attribute_map[key]].is_a?(Array)
238
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
239
- end
240
- elsif !attributes[self.class.attribute_map[key]].nil?
241
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
242
- end
243
- end
244
-
245
- self
246
- end
247
-
248
- # Deserializes the data based on type
249
- # @param string type Data type
250
- # @param string value Value to be deserialized
251
- # @return [Object] Deserialized data
252
- def _deserialize(type, value)
253
- case type.to_sym
254
- when :Time
255
- Time.parse(value)
256
- when :Date
257
- Date.parse(value)
258
- when :String
259
- value.to_s
260
- when :Integer
261
- value.to_i
262
- when :Float
263
- value.to_f
264
- when :Boolean
265
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
266
- true
267
- else
268
- false
269
- end
270
- when :Object
271
- # generic object (usually a Hash), return directly
272
- value
273
- when /\AArray<(?<inner_type>.+)>\z/
274
- inner_type = Regexp.last_match[:inner_type]
275
- value.map { |v| _deserialize(inner_type, v) }
276
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
277
- k_type = Regexp.last_match[:k_type]
278
- v_type = Regexp.last_match[:v_type]
279
- {}.tap do |hash|
280
- value.each do |k, v|
281
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
282
- end
283
- end
284
- else # model
285
- # models (e.g. Pet) or oneOf
286
- klass = SnapTrade.const_get(type)
287
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
288
- end
289
- end
290
-
291
- # Returns the string representation of the object
292
- # @return [String] String presentation of the object
293
- def to_s
294
- to_hash.to_s
295
- end
296
-
297
- # to_body is an alias to to_hash (backward compatibility)
298
- # @return [Hash] Returns the object in the form of hash
299
- def to_body
300
- to_hash
301
- end
302
-
303
- # Returns the object in the form of hash
304
- # @return [Hash] Returns the object in the form of hash
305
- def to_hash
306
- hash = {}
307
- self.class.attribute_map.each_pair do |attr, param|
308
- value = self.send(attr)
309
- if value.nil?
310
- is_nullable = self.class.openapi_nullable.include?(attr)
311
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
312
- end
313
-
314
- hash[param] = _to_hash(value)
315
- end
316
- hash
317
- end
318
-
319
- # Outputs non-array value in the form of hash
320
- # For object, use to_hash. Otherwise, just return the value
321
- # @param [Object] value Any valid value
322
- # @return [Hash] Returns the value in the form of hash
323
- def _to_hash(value)
324
- if value.is_a?(Array)
325
- value.compact.map { |v| _to_hash(v) }
326
- elsif value.is_a?(Hash)
327
- {}.tap do |hash|
328
- value.each { |k, v| hash[k] = _to_hash(v) }
329
- end
330
- elsif value.respond_to? :to_hash
331
- value.to_hash
332
- else
333
- value
334
- end
335
- end
336
-
337
- end
338
-
339
- end
@@ -1,228 +0,0 @@
1
- =begin
2
- #SnapTrade
3
-
4
- #Connect brokerage accounts to your app for live positions and trading
5
-
6
- The version of the OpenAPI document: 1.0.0
7
- Contact: api@snaptrade.com
8
- =end
9
-
10
- require 'date'
11
- require 'time'
12
-
13
- module SnapTrade
14
- # Array of trades to make to rebalance portfolio
15
- class CalculatedTrade
16
- attr_accessor :id
17
-
18
- attr_accessor :trades
19
-
20
- # Attribute mapping from ruby-style variable name to JSON key.
21
- def self.attribute_map
22
- {
23
- :'id' => :'id',
24
- :'trades' => :'trades'
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
- :'id' => :'String',
37
- :'trades' => :'Array<Trade>'
38
- }
39
- end
40
-
41
- # List of attributes with nullable: true
42
- def self.openapi_nullable
43
- Set.new([
44
- ])
45
- end
46
-
47
- # Initializes the object
48
- # @param [Hash] attributes Model attributes in the form of hash
49
- def initialize(attributes = {})
50
- if (!attributes.is_a?(Hash))
51
- fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::CalculatedTrade` initialize method"
52
- end
53
-
54
- # check to see if the attribute exists and convert string to symbol for hash key
55
- attributes = attributes.each_with_object({}) { |(k, v), h|
56
- if (!self.class.attribute_map.key?(k.to_sym))
57
- fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::CalculatedTrade`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
58
- end
59
- h[k.to_sym] = v
60
- }
61
-
62
- if attributes.key?(:'id')
63
- self.id = attributes[:'id']
64
- end
65
-
66
- if attributes.key?(:'trades')
67
- if (value = attributes[:'trades']).is_a?(Array)
68
- self.trades = value
69
- end
70
- end
71
- end
72
-
73
- # Show invalid properties with the reasons. Usually used together with valid?
74
- # @return Array for valid properties with the reasons
75
- def list_invalid_properties
76
- invalid_properties = Array.new
77
- invalid_properties
78
- end
79
-
80
- # Check to see if the all the properties in the model are valid
81
- # @return true if the model is valid
82
- def valid?
83
- true
84
- end
85
-
86
- # Checks equality by comparing each attribute.
87
- # @param [Object] Object to be compared
88
- def ==(o)
89
- return true if self.equal?(o)
90
- self.class == o.class &&
91
- id == o.id &&
92
- trades == o.trades
93
- end
94
-
95
- # @see the `==` method
96
- # @param [Object] Object to be compared
97
- def eql?(o)
98
- self == o
99
- end
100
-
101
- # Calculates hash code according to all attributes.
102
- # @return [Integer] Hash code
103
- def hash
104
- [id, trades].hash
105
- end
106
-
107
- # Builds the object from hash
108
- # @param [Hash] attributes Model attributes in the form of hash
109
- # @return [Object] Returns the model itself
110
- def self.build_from_hash(attributes)
111
- new.build_from_hash(attributes)
112
- end
113
-
114
- # Builds the object from hash
115
- # @param [Hash] attributes Model attributes in the form of hash
116
- # @return [Object] Returns the model itself
117
- def build_from_hash(attributes)
118
- return nil unless attributes.is_a?(Hash)
119
- attributes = attributes.transform_keys(&:to_sym)
120
- self.class.openapi_types.each_pair do |key, type|
121
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
122
- self.send("#{key}=", nil)
123
- elsif type =~ /\AArray<(.*)>/i
124
- # check to ensure the input is an array given that the attribute
125
- # is documented as an array but the input is not
126
- if attributes[self.class.attribute_map[key]].is_a?(Array)
127
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
128
- end
129
- elsif !attributes[self.class.attribute_map[key]].nil?
130
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
131
- end
132
- end
133
-
134
- self
135
- end
136
-
137
- # Deserializes the data based on type
138
- # @param string type Data type
139
- # @param string value Value to be deserialized
140
- # @return [Object] Deserialized data
141
- def _deserialize(type, value)
142
- case type.to_sym
143
- when :Time
144
- Time.parse(value)
145
- when :Date
146
- Date.parse(value)
147
- when :String
148
- value.to_s
149
- when :Integer
150
- value.to_i
151
- when :Float
152
- value.to_f
153
- when :Boolean
154
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
155
- true
156
- else
157
- false
158
- end
159
- when :Object
160
- # generic object (usually a Hash), return directly
161
- value
162
- when /\AArray<(?<inner_type>.+)>\z/
163
- inner_type = Regexp.last_match[:inner_type]
164
- value.map { |v| _deserialize(inner_type, v) }
165
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
166
- k_type = Regexp.last_match[:k_type]
167
- v_type = Regexp.last_match[:v_type]
168
- {}.tap do |hash|
169
- value.each do |k, v|
170
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
171
- end
172
- end
173
- else # model
174
- # models (e.g. Pet) or oneOf
175
- klass = SnapTrade.const_get(type)
176
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
177
- end
178
- end
179
-
180
- # Returns the string representation of the object
181
- # @return [String] String presentation of the object
182
- def to_s
183
- to_hash.to_s
184
- end
185
-
186
- # to_body is an alias to to_hash (backward compatibility)
187
- # @return [Hash] Returns the object in the form of hash
188
- def to_body
189
- to_hash
190
- end
191
-
192
- # Returns the object in the form of hash
193
- # @return [Hash] Returns the object in the form of hash
194
- def to_hash
195
- hash = {}
196
- self.class.attribute_map.each_pair do |attr, param|
197
- value = self.send(attr)
198
- if value.nil?
199
- is_nullable = self.class.openapi_nullable.include?(attr)
200
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
201
- end
202
-
203
- hash[param] = _to_hash(value)
204
- end
205
- hash
206
- end
207
-
208
- # Outputs non-array value in the form of hash
209
- # For object, use to_hash. Otherwise, just return the value
210
- # @param [Object] value Any valid value
211
- # @return [Hash] Returns the value in the form of hash
212
- def _to_hash(value)
213
- if value.is_a?(Array)
214
- value.compact.map { |v| _to_hash(v) }
215
- elsif value.is_a?(Hash)
216
- {}.tap do |hash|
217
- value.each { |k, v| hash[k] = _to_hash(v) }
218
- end
219
- elsif value.respond_to? :to_hash
220
- value.to_hash
221
- else
222
- value
223
- end
224
- end
225
-
226
- end
227
-
228
- end