snaptrade 2.0.31 → 2.0.33

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