snaptrade 2.0.30 → 2.0.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +31 -29
  3. data/README.md +5 -7
  4. data/lib/snaptrade/api/account_information_api.rb +16 -16
  5. data/lib/snaptrade/models/account_balance.rb +1 -1
  6. data/lib/snaptrade/models/account_balance_total.rb +2 -0
  7. data/lib/snaptrade/models/account_holdings_account.rb +5 -1
  8. data/lib/snaptrade/models/account_order_record.rb +4 -2
  9. data/lib/snaptrade/models/amount.rb +2 -0
  10. data/lib/snaptrade/models/balance.rb +3 -1
  11. data/lib/snaptrade/models/currency.rb +4 -1
  12. data/lib/snaptrade/models/exchange.rb +9 -1
  13. data/lib/snaptrade/models/figi_instrument.rb +3 -1
  14. data/lib/snaptrade/models/option_brokerage_symbol.rb +3 -1
  15. data/lib/snaptrade/models/options_position.rb +4 -3
  16. data/lib/snaptrade/models/options_position_currency.rb +4 -0
  17. data/lib/snaptrade/models/options_symbol.rb +12 -24
  18. data/lib/snaptrade/models/position.rb +6 -4
  19. data/lib/snaptrade/models/position_symbol.rb +6 -1
  20. data/lib/snaptrade/models/security_type.rb +5 -1
  21. data/lib/snaptrade/models/snap_trade_holdings_account_account_id.rb +11 -3
  22. data/lib/snaptrade/models/snap_trade_holdings_total_value.rb +3 -1
  23. data/lib/snaptrade/models/symbol_figi_instrument.rb +2 -0
  24. data/lib/snaptrade/models/underlying_symbol.rb +20 -5
  25. data/lib/snaptrade/models/{model_portfolio.rb → underlying_symbol_exchange.rb} +73 -12
  26. data/lib/snaptrade/models/{brokerage_symbol.rb → underlying_symbol_type.rb} +28 -38
  27. data/lib/snaptrade/models/universal_symbol.rb +9 -3
  28. data/lib/snaptrade/models/{model_asset_class.rb → universal_symbol_currency.rb} +24 -4
  29. data/lib/snaptrade/models/{portfolio_group.rb → universal_symbol_exchange.rb} +78 -7
  30. data/lib/snaptrade/version.rb +1 -1
  31. data/lib/snaptrade.rb +4 -37
  32. data/spec/api/account_information_api_spec.rb +3 -3
  33. data/spec/models/options_symbol_spec.rb +0 -12
  34. data/spec/models/{brokerage_symbol_option_symbol_spec.rb → underlying_symbol_exchange_spec.rb} +14 -14
  35. data/spec/models/underlying_symbol_spec.rb +6 -0
  36. data/spec/models/{trade_impact_spec.rb → underlying_symbol_type_spec.rb} +10 -16
  37. data/spec/models/{model_portfolio_spec.rb → universal_symbol_currency_spec.rb} +8 -8
  38. data/spec/models/{trade_spec.rb → universal_symbol_exchange_spec.rb} +13 -13
  39. metadata +113 -212
  40. data/lib/snaptrade/models/brokerage_authorization_type.rb +0 -216
  41. data/lib/snaptrade/models/brokerage_authorization_type_type.rb +0 -37
  42. data/lib/snaptrade/models/brokerage_symbol_option_symbol.rb +0 -325
  43. data/lib/snaptrade/models/brokerage_symbol_symbol.rb +0 -339
  44. data/lib/snaptrade/models/calculated_trade.rb +0 -228
  45. data/lib/snaptrade/models/excluded_asset.rb +0 -217
  46. data/lib/snaptrade/models/jwt.rb +0 -217
  47. data/lib/snaptrade/models/model_asset_class_details.rb +0 -227
  48. data/lib/snaptrade/models/model_asset_class_target.rb +0 -216
  49. data/lib/snaptrade/models/model_portfolio_asset_class.rb +0 -249
  50. data/lib/snaptrade/models/model_portfolio_details.rb +0 -238
  51. data/lib/snaptrade/models/model_portfolio_security.rb +0 -249
  52. data/lib/snaptrade/models/model_type.rb +0 -38
  53. data/lib/snaptrade/models/options_holdings.rb +0 -267
  54. data/lib/snaptrade/models/portfolio_group_info.rb +0 -325
  55. data/lib/snaptrade/models/portfolio_group_position.rb +0 -237
  56. data/lib/snaptrade/models/portfolio_group_settings.rb +0 -276
  57. data/lib/snaptrade/models/redirect_tokenand_pin.rb +0 -226
  58. data/lib/snaptrade/models/snap_trade_api_disclaimer_accept_status.rb +0 -226
  59. data/lib/snaptrade/models/state.rb +0 -40
  60. data/lib/snaptrade/models/strategy_impact.rb +0 -309
  61. data/lib/snaptrade/models/strategy_impact_legs_inner.rb +0 -270
  62. data/lib/snaptrade/models/strategy_order_place.rb +0 -228
  63. data/lib/snaptrade/models/strategy_order_place_orders_inner.rb +0 -596
  64. data/lib/snaptrade/models/strategy_order_place_orders_inner_legs_inner.rb +0 -270
  65. data/lib/snaptrade/models/target_asset.rb +0 -289
  66. data/lib/snaptrade/models/trade.rb +0 -280
  67. data/lib/snaptrade/models/trade_action.rb +0 -37
  68. data/lib/snaptrade/models/trade_execution_status.rb +0 -297
  69. data/lib/snaptrade/models/trade_execution_status_action.rb +0 -37
  70. data/lib/snaptrade/models/trade_impact.rb +0 -256
  71. data/lib/snaptrade/models/user_error_log.rb +0 -262
  72. data/lib/snaptrade/models/user_settings.rb +0 -298
  73. data/spec/models/brokerage_authorization_type_spec.rb +0 -29
  74. data/spec/models/brokerage_authorization_type_type_spec.rb +0 -23
  75. data/spec/models/brokerage_symbol_spec.rb +0 -59
  76. data/spec/models/brokerage_symbol_symbol_spec.rb +0 -83
  77. data/spec/models/calculated_trade_spec.rb +0 -35
  78. data/spec/models/excluded_asset_spec.rb +0 -29
  79. data/spec/models/jwt_spec.rb +0 -29
  80. data/spec/models/model_asset_class_details_spec.rb +0 -35
  81. data/spec/models/model_asset_class_spec.rb +0 -35
  82. data/spec/models/model_asset_class_target_spec.rb +0 -29
  83. data/spec/models/model_portfolio_asset_class_spec.rb +0 -35
  84. data/spec/models/model_portfolio_details_spec.rb +0 -41
  85. data/spec/models/model_portfolio_security_spec.rb +0 -35
  86. data/spec/models/model_type_spec.rb +0 -23
  87. data/spec/models/options_holdings_spec.rb +0 -59
  88. data/spec/models/portfolio_group_info_spec.rb +0 -89
  89. data/spec/models/portfolio_group_position_spec.rb +0 -41
  90. data/spec/models/portfolio_group_settings_spec.rb +0 -53
  91. data/spec/models/portfolio_group_spec.rb +0 -35
  92. data/spec/models/redirect_tokenand_pin_spec.rb +0 -35
  93. data/spec/models/snap_trade_api_disclaimer_accept_status_spec.rb +0 -35
  94. data/spec/models/state_spec.rb +0 -23
  95. data/spec/models/strategy_impact_legs_inner_spec.rb +0 -65
  96. data/spec/models/strategy_impact_spec.rb +0 -89
  97. data/spec/models/strategy_order_place_orders_inner_legs_inner_spec.rb +0 -65
  98. data/spec/models/strategy_order_place_orders_inner_spec.rb +0 -281
  99. data/spec/models/strategy_order_place_spec.rb +0 -35
  100. data/spec/models/target_asset_spec.rb +0 -59
  101. data/spec/models/trade_action_spec.rb +0 -23
  102. data/spec/models/trade_execution_status_action_spec.rb +0 -23
  103. data/spec/models/trade_execution_status_spec.rb +0 -77
  104. data/spec/models/user_error_log_spec.rb +0 -59
  105. data/spec/models/user_settings_spec.rb +0 -83
@@ -1,256 +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
- # Impact of a group of trade
15
- class TradeImpact
16
- attr_accessor :account
17
-
18
- attr_accessor :currency
19
-
20
- # Remaining balance after executing all trades
21
- attr_accessor :remaining_cash
22
-
23
- # Total estimated commissions across all trades to make
24
- attr_accessor :estimated_commissions
25
-
26
- # Estimated forex fees to pay to excute trades
27
- attr_accessor :forex_fees
28
-
29
- # Attribute mapping from ruby-style variable name to JSON key.
30
- def self.attribute_map
31
- {
32
- :'account' => :'account',
33
- :'currency' => :'currency',
34
- :'remaining_cash' => :'remaining_cash',
35
- :'estimated_commissions' => :'estimated_commissions',
36
- :'forex_fees' => :'forex_fees'
37
- }
38
- end
39
-
40
- # Returns all the JSON keys this model knows about
41
- def self.acceptable_attributes
42
- attribute_map.values
43
- end
44
-
45
- # Attribute type mapping.
46
- def self.openapi_types
47
- {
48
- :'account' => :'Account',
49
- :'currency' => :'Currency',
50
- :'remaining_cash' => :'Float',
51
- :'estimated_commissions' => :'Float',
52
- :'forex_fees' => :'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 `SnapTrade::TradeImpact` 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 `SnapTrade::TradeImpact`. 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?(:'account')
78
- self.account = attributes[:'account']
79
- end
80
-
81
- if attributes.key?(:'currency')
82
- self.currency = attributes[:'currency']
83
- end
84
-
85
- if attributes.key?(:'remaining_cash')
86
- self.remaining_cash = attributes[:'remaining_cash']
87
- end
88
-
89
- if attributes.key?(:'estimated_commissions')
90
- self.estimated_commissions = attributes[:'estimated_commissions']
91
- end
92
-
93
- if attributes.key?(:'forex_fees')
94
- self.forex_fees = attributes[:'forex_fees']
95
- end
96
- end
97
-
98
- # Show invalid properties with the reasons. Usually used together with valid?
99
- # @return Array for valid properties with the reasons
100
- def list_invalid_properties
101
- invalid_properties = Array.new
102
- invalid_properties
103
- end
104
-
105
- # Check to see if the all the properties in the model are valid
106
- # @return true if the model is valid
107
- def valid?
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
- account == o.account &&
117
- currency == o.currency &&
118
- remaining_cash == o.remaining_cash &&
119
- estimated_commissions == o.estimated_commissions &&
120
- forex_fees == o.forex_fees
121
- end
122
-
123
- # @see the `==` method
124
- # @param [Object] Object to be compared
125
- def eql?(o)
126
- self == o
127
- end
128
-
129
- # Calculates hash code according to all attributes.
130
- # @return [Integer] Hash code
131
- def hash
132
- [account, currency, remaining_cash, estimated_commissions, forex_fees].hash
133
- end
134
-
135
- # Builds the object from hash
136
- # @param [Hash] attributes Model attributes in the form of hash
137
- # @return [Object] Returns the model itself
138
- def self.build_from_hash(attributes)
139
- new.build_from_hash(attributes)
140
- end
141
-
142
- # Builds the object from hash
143
- # @param [Hash] attributes Model attributes in the form of hash
144
- # @return [Object] Returns the model itself
145
- def build_from_hash(attributes)
146
- return nil unless attributes.is_a?(Hash)
147
- attributes = attributes.transform_keys(&:to_sym)
148
- self.class.openapi_types.each_pair do |key, type|
149
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
150
- self.send("#{key}=", nil)
151
- elsif type =~ /\AArray<(.*)>/i
152
- # check to ensure the input is an array given that the attribute
153
- # is documented as an array but the input is not
154
- if attributes[self.class.attribute_map[key]].is_a?(Array)
155
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
156
- end
157
- elsif !attributes[self.class.attribute_map[key]].nil?
158
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
159
- end
160
- end
161
-
162
- self
163
- end
164
-
165
- # Deserializes the data based on type
166
- # @param string type Data type
167
- # @param string value Value to be deserialized
168
- # @return [Object] Deserialized data
169
- def _deserialize(type, value)
170
- case type.to_sym
171
- when :Time
172
- Time.parse(value)
173
- when :Date
174
- Date.parse(value)
175
- when :String
176
- value.to_s
177
- when :Integer
178
- value.to_i
179
- when :Float
180
- value.to_f
181
- when :Boolean
182
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
183
- true
184
- else
185
- false
186
- end
187
- when :Object
188
- # generic object (usually a Hash), return directly
189
- value
190
- when /\AArray<(?<inner_type>.+)>\z/
191
- inner_type = Regexp.last_match[:inner_type]
192
- value.map { |v| _deserialize(inner_type, v) }
193
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
194
- k_type = Regexp.last_match[:k_type]
195
- v_type = Regexp.last_match[:v_type]
196
- {}.tap do |hash|
197
- value.each do |k, v|
198
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
199
- end
200
- end
201
- else # model
202
- # models (e.g. Pet) or oneOf
203
- klass = SnapTrade.const_get(type)
204
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
205
- end
206
- end
207
-
208
- # Returns the string representation of the object
209
- # @return [String] String presentation of the object
210
- def to_s
211
- to_hash.to_s
212
- end
213
-
214
- # to_body is an alias to to_hash (backward compatibility)
215
- # @return [Hash] Returns the object in the form of hash
216
- def to_body
217
- to_hash
218
- end
219
-
220
- # Returns the object in the form of hash
221
- # @return [Hash] Returns the object in the form of hash
222
- def to_hash
223
- hash = {}
224
- self.class.attribute_map.each_pair do |attr, param|
225
- value = self.send(attr)
226
- if value.nil?
227
- is_nullable = self.class.openapi_nullable.include?(attr)
228
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
229
- end
230
-
231
- hash[param] = _to_hash(value)
232
- end
233
- hash
234
- end
235
-
236
- # Outputs non-array value in the form of hash
237
- # For object, use to_hash. Otherwise, just return the value
238
- # @param [Object] value Any valid value
239
- # @return [Hash] Returns the value in the form of hash
240
- def _to_hash(value)
241
- if value.is_a?(Array)
242
- value.compact.map { |v| _to_hash(v) }
243
- elsif value.is_a?(Hash)
244
- {}.tap do |hash|
245
- value.each { |k, v| hash[k] = _to_hash(v) }
246
- end
247
- elsif value.respond_to? :to_hash
248
- value.to_hash
249
- else
250
- value
251
- end
252
- end
253
-
254
- end
255
-
256
- end
@@ -1,262 +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
- # An API error log for a specific SnapTrade user.
15
- class UserErrorLog
16
- attr_accessor :requested_at
17
-
18
- attr_accessor :response
19
-
20
- attr_accessor :status_code
21
-
22
- attr_accessor :_query_params
23
-
24
- attr_accessor :http_method
25
-
26
- attr_accessor :endpoint
27
-
28
- # Attribute mapping from ruby-style variable name to JSON key.
29
- def self.attribute_map
30
- {
31
- :'requested_at' => :'requestedAt',
32
- :'response' => :'response',
33
- :'status_code' => :'statusCode',
34
- :'_query_params' => :'queryParams',
35
- :'http_method' => :'httpMethod',
36
- :'endpoint' => :'endpoint'
37
- }
38
- end
39
-
40
- # Returns all the JSON keys this model knows about
41
- def self.acceptable_attributes
42
- attribute_map.values
43
- end
44
-
45
- # Attribute type mapping.
46
- def self.openapi_types
47
- {
48
- :'requested_at' => :'String',
49
- :'response' => :'String',
50
- :'status_code' => :'Float',
51
- :'_query_params' => :'String',
52
- :'http_method' => :'String',
53
- :'endpoint' => :'String'
54
- }
55
- end
56
-
57
- # List of attributes with nullable: true
58
- def self.openapi_nullable
59
- Set.new([
60
- ])
61
- end
62
-
63
- # Initializes the object
64
- # @param [Hash] attributes Model attributes in the form of hash
65
- def initialize(attributes = {})
66
- if (!attributes.is_a?(Hash))
67
- fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::UserErrorLog` initialize method"
68
- end
69
-
70
- # check to see if the attribute exists and convert string to symbol for hash key
71
- attributes = attributes.each_with_object({}) { |(k, v), h|
72
- if (!self.class.attribute_map.key?(k.to_sym))
73
- fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::UserErrorLog`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
74
- end
75
- h[k.to_sym] = v
76
- }
77
-
78
- if attributes.key?(:'requested_at')
79
- self.requested_at = attributes[:'requested_at']
80
- end
81
-
82
- if attributes.key?(:'response')
83
- self.response = attributes[:'response']
84
- end
85
-
86
- if attributes.key?(:'status_code')
87
- self.status_code = attributes[:'status_code']
88
- end
89
-
90
- if attributes.key?(:'_query_params')
91
- self._query_params = attributes[:'_query_params']
92
- end
93
-
94
- if attributes.key?(:'http_method')
95
- self.http_method = attributes[:'http_method']
96
- end
97
-
98
- if attributes.key?(:'endpoint')
99
- self.endpoint = attributes[:'endpoint']
100
- end
101
- end
102
-
103
- # Show invalid properties with the reasons. Usually used together with valid?
104
- # @return Array for valid properties with the reasons
105
- def list_invalid_properties
106
- invalid_properties = Array.new
107
- invalid_properties
108
- end
109
-
110
- # Check to see if the all the properties in the model are valid
111
- # @return true if the model is valid
112
- def valid?
113
- true
114
- end
115
-
116
- # Checks equality by comparing each attribute.
117
- # @param [Object] Object to be compared
118
- def ==(o)
119
- return true if self.equal?(o)
120
- self.class == o.class &&
121
- requested_at == o.requested_at &&
122
- response == o.response &&
123
- status_code == o.status_code &&
124
- _query_params == o._query_params &&
125
- http_method == o.http_method &&
126
- endpoint == o.endpoint
127
- end
128
-
129
- # @see the `==` method
130
- # @param [Object] Object to be compared
131
- def eql?(o)
132
- self == o
133
- end
134
-
135
- # Calculates hash code according to all attributes.
136
- # @return [Integer] Hash code
137
- def hash
138
- [requested_at, response, status_code, _query_params, http_method, endpoint].hash
139
- end
140
-
141
- # Builds the object from hash
142
- # @param [Hash] attributes Model attributes in the form of hash
143
- # @return [Object] Returns the model itself
144
- def self.build_from_hash(attributes)
145
- new.build_from_hash(attributes)
146
- end
147
-
148
- # Builds the object from hash
149
- # @param [Hash] attributes Model attributes in the form of hash
150
- # @return [Object] Returns the model itself
151
- def build_from_hash(attributes)
152
- return nil unless attributes.is_a?(Hash)
153
- attributes = attributes.transform_keys(&:to_sym)
154
- self.class.openapi_types.each_pair do |key, type|
155
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
156
- self.send("#{key}=", nil)
157
- elsif type =~ /\AArray<(.*)>/i
158
- # check to ensure the input is an array given that the attribute
159
- # is documented as an array but the input is not
160
- if attributes[self.class.attribute_map[key]].is_a?(Array)
161
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
162
- end
163
- elsif !attributes[self.class.attribute_map[key]].nil?
164
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
165
- end
166
- end
167
-
168
- self
169
- end
170
-
171
- # Deserializes the data based on type
172
- # @param string type Data type
173
- # @param string value Value to be deserialized
174
- # @return [Object] Deserialized data
175
- def _deserialize(type, value)
176
- case type.to_sym
177
- when :Time
178
- Time.parse(value)
179
- when :Date
180
- Date.parse(value)
181
- when :String
182
- value.to_s
183
- when :Integer
184
- value.to_i
185
- when :Float
186
- value.to_f
187
- when :Boolean
188
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
189
- true
190
- else
191
- false
192
- end
193
- when :Object
194
- # generic object (usually a Hash), return directly
195
- value
196
- when /\AArray<(?<inner_type>.+)>\z/
197
- inner_type = Regexp.last_match[:inner_type]
198
- value.map { |v| _deserialize(inner_type, v) }
199
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
200
- k_type = Regexp.last_match[:k_type]
201
- v_type = Regexp.last_match[:v_type]
202
- {}.tap do |hash|
203
- value.each do |k, v|
204
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
205
- end
206
- end
207
- else # model
208
- # models (e.g. Pet) or oneOf
209
- klass = SnapTrade.const_get(type)
210
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
211
- end
212
- end
213
-
214
- # Returns the string representation of the object
215
- # @return [String] String presentation of the object
216
- def to_s
217
- to_hash.to_s
218
- end
219
-
220
- # to_body is an alias to to_hash (backward compatibility)
221
- # @return [Hash] Returns the object in the form of hash
222
- def to_body
223
- to_hash
224
- end
225
-
226
- # Returns the object in the form of hash
227
- # @return [Hash] Returns the object in the form of hash
228
- def to_hash
229
- hash = {}
230
- self.class.attribute_map.each_pair do |attr, param|
231
- value = self.send(attr)
232
- if value.nil?
233
- is_nullable = self.class.openapi_nullable.include?(attr)
234
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
235
- end
236
-
237
- hash[param] = _to_hash(value)
238
- end
239
- hash
240
- end
241
-
242
- # Outputs non-array value in the form of hash
243
- # For object, use to_hash. Otherwise, just return the value
244
- # @param [Object] value Any valid value
245
- # @return [Hash] Returns the value in the form of hash
246
- def _to_hash(value)
247
- if value.is_a?(Array)
248
- value.compact.map { |v| _to_hash(v) }
249
- elsif value.is_a?(Hash)
250
- {}.tap do |hash|
251
- value.each { |k, v| hash[k] = _to_hash(v) }
252
- end
253
- elsif value.respond_to? :to_hash
254
- value.to_hash
255
- else
256
- value
257
- end
258
- end
259
-
260
- end
261
-
262
- end