ultracart_api 4.1.233 → 4.1.235

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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -2
  3. data/docs/SfvbApi.md +178 -5
  4. data/docs/SfvbApprovalParams.md +1 -1
  5. data/docs/SfvbCommsLookupOwner.md +2 -0
  6. data/docs/SfvbCommsLookupResponse.md +2 -0
  7. data/docs/SfvbPreviewTrackingHtmlRequest.md +20 -0
  8. data/docs/SfvbServerLog.md +1 -1
  9. data/docs/SfvbTrackingCheckPlan.md +42 -0
  10. data/docs/SfvbTrackingCheckPlanEvent.md +22 -0
  11. data/docs/SfvbTrackingCheckPlanGate.md +20 -0
  12. data/docs/SfvbTrackingCheckPlanProvider.md +34 -0
  13. data/docs/SfvbTrackingCheckPlanRequest.md +24 -0
  14. data/docs/SfvbTrackingCheckPlanServerSide.md +20 -0
  15. data/docs/SfvbTrackingCheckPlanUnchecked.md +20 -0
  16. data/docs/SfvbTrackingHtmlRenderRequest.md +20 -0
  17. data/docs/SfvbTrackingHtmlRenderResponse.md +32 -0
  18. data/docs/SfvbTrackingProvider.md +2 -0
  19. data/lib/ultracart_api/api/sfvb_api.rb +255 -4
  20. data/lib/ultracart_api/models/sfvb_approval_params.rb +1 -1
  21. data/lib/ultracart_api/models/sfvb_comms_lookup_owner.rb +11 -1
  22. data/lib/ultracart_api/models/sfvb_comms_lookup_response.rb +11 -1
  23. data/lib/ultracart_api/models/sfvb_preview_tracking_html_request.rb +230 -0
  24. data/lib/ultracart_api/models/sfvb_server_log.rb +1 -1
  25. data/lib/ultracart_api/models/sfvb_tracking_check_plan.rb +394 -0
  26. data/lib/ultracart_api/models/sfvb_tracking_check_plan_event.rb +274 -0
  27. data/lib/ultracart_api/models/sfvb_tracking_check_plan_gate.rb +276 -0
  28. data/lib/ultracart_api/models/sfvb_tracking_check_plan_provider.rb +349 -0
  29. data/lib/ultracart_api/models/sfvb_tracking_check_plan_request.rb +284 -0
  30. data/lib/ultracart_api/models/sfvb_tracking_check_plan_server_side.rb +230 -0
  31. data/lib/ultracart_api/models/sfvb_tracking_check_plan_unchecked.rb +230 -0
  32. data/lib/ultracart_api/models/sfvb_tracking_html_render_request.rb +230 -0
  33. data/lib/ultracart_api/models/sfvb_tracking_html_render_response.rb +328 -0
  34. data/lib/ultracart_api/models/sfvb_tracking_provider.rb +11 -1
  35. data/lib/ultracart_api/version.rb +1 -1
  36. data/lib/ultracart_api.rb +10 -0
  37. metadata +22 -2
@@ -0,0 +1,349 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module UltracartClient
17
+ class SfvbTrackingCheckPlanProvider
18
+ # The dataLayer, gtag and fbq calls it makes, where the template makes them.
19
+ attr_accessor :events
20
+
21
+ # must_load, must_not_load (held back by a gate this consent state and region have not granted, or never sent for this event), or may_load (depends on something the plan cannot know). A missing may_load request is a warning, never a fail.
22
+ attr_accessor :expect
23
+
24
+ attr_accessor :gate
25
+
26
+ # A name to show.
27
+ attr_accessor :name
28
+
29
+ # Why the expectation is what it is, when that is not obvious.
30
+ attr_accessor :note
31
+
32
+ # The provider key, as tracking/providers names it. For custom or affiliate network HTML, the host.
33
+ attr_accessor :provider
34
+
35
+ # The requests it makes.
36
+ attr_accessor :requests
37
+
38
+ # provider for a provider in the catalog, custom_html for the storefront Tracking or Conversion HTML, affiliate_network for an affiliate network pixel.
39
+ attr_accessor :source
40
+
41
+ # The storefront template that writes it, tracking.vm or conversion.vm. Left out for custom and affiliate network HTML.
42
+ attr_accessor :template
43
+
44
+ class EnumAttributeValidator
45
+ attr_reader :datatype
46
+ attr_reader :allowable_values
47
+
48
+ def initialize(datatype, allowable_values)
49
+ @allowable_values = allowable_values.map do |value|
50
+ case datatype.to_s
51
+ when /Integer/i
52
+ value.to_i
53
+ when /Float/i
54
+ value.to_f
55
+ else
56
+ value
57
+ end
58
+ end
59
+ end
60
+
61
+ def valid?(value)
62
+ !value || allowable_values.include?(value)
63
+ end
64
+ end
65
+
66
+ # Attribute mapping from ruby-style variable name to JSON key.
67
+ def self.attribute_map
68
+ {
69
+ :'events' => :'events',
70
+ :'expect' => :'expect',
71
+ :'gate' => :'gate',
72
+ :'name' => :'name',
73
+ :'note' => :'note',
74
+ :'provider' => :'provider',
75
+ :'requests' => :'requests',
76
+ :'source' => :'source',
77
+ :'template' => :'template'
78
+ }
79
+ end
80
+
81
+ # Returns all the JSON keys this model knows about
82
+ def self.acceptable_attributes
83
+ attribute_map.values
84
+ end
85
+
86
+ # Attribute type mapping.
87
+ def self.openapi_types
88
+ {
89
+ :'events' => :'Array<SfvbTrackingCheckPlanEvent>',
90
+ :'expect' => :'String',
91
+ :'gate' => :'SfvbTrackingCheckPlanGate',
92
+ :'name' => :'String',
93
+ :'note' => :'String',
94
+ :'provider' => :'String',
95
+ :'requests' => :'Array<SfvbTrackingCheckPlanRequest>',
96
+ :'source' => :'String',
97
+ :'template' => :'String'
98
+ }
99
+ end
100
+
101
+ # List of attributes with nullable: true
102
+ def self.openapi_nullable
103
+ Set.new([
104
+ ])
105
+ end
106
+
107
+ # Initializes the object
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ def initialize(attributes = {})
110
+ if (!attributes.is_a?(Hash))
111
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbTrackingCheckPlanProvider` initialize method"
112
+ end
113
+
114
+ # check to see if the attribute exists and convert string to symbol for hash key
115
+ attributes = attributes.each_with_object({}) { |(k, v), h|
116
+ if (!self.class.attribute_map.key?(k.to_sym))
117
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbTrackingCheckPlanProvider`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
118
+ end
119
+ h[k.to_sym] = v
120
+ }
121
+
122
+ if attributes.key?(:'events')
123
+ if (value = attributes[:'events']).is_a?(Array)
124
+ self.events = value
125
+ end
126
+ end
127
+
128
+ if attributes.key?(:'expect')
129
+ self.expect = attributes[:'expect']
130
+ end
131
+
132
+ if attributes.key?(:'gate')
133
+ self.gate = attributes[:'gate']
134
+ end
135
+
136
+ if attributes.key?(:'name')
137
+ self.name = attributes[:'name']
138
+ end
139
+
140
+ if attributes.key?(:'note')
141
+ self.note = attributes[:'note']
142
+ end
143
+
144
+ if attributes.key?(:'provider')
145
+ self.provider = attributes[:'provider']
146
+ end
147
+
148
+ if attributes.key?(:'requests')
149
+ if (value = attributes[:'requests']).is_a?(Array)
150
+ self.requests = value
151
+ end
152
+ end
153
+
154
+ if attributes.key?(:'source')
155
+ self.source = attributes[:'source']
156
+ end
157
+
158
+ if attributes.key?(:'template')
159
+ self.template = attributes[:'template']
160
+ end
161
+ end
162
+
163
+ # Show invalid properties with the reasons. Usually used together with valid?
164
+ # @return Array for valid properties with the reasons
165
+ def list_invalid_properties
166
+ invalid_properties = Array.new
167
+ invalid_properties
168
+ end
169
+
170
+ # Check to see if the all the properties in the model are valid
171
+ # @return true if the model is valid
172
+ def valid?
173
+ expect_validator = EnumAttributeValidator.new('String', ["must_load", "must_not_load", "may_load"])
174
+ return false unless expect_validator.valid?(@expect)
175
+ source_validator = EnumAttributeValidator.new('String', ["provider", "custom_html", "affiliate_network"])
176
+ return false unless source_validator.valid?(@source)
177
+ true
178
+ end
179
+
180
+ # Custom attribute writer method checking allowed values (enum).
181
+ # @param [Object] expect Object to be assigned
182
+ def expect=(expect)
183
+ validator = EnumAttributeValidator.new('String', ["must_load", "must_not_load", "may_load"])
184
+ unless validator.valid?(expect)
185
+ fail ArgumentError, "invalid value for \"expect\", must be one of #{validator.allowable_values}."
186
+ end
187
+ @expect = expect
188
+ end
189
+
190
+ # Custom attribute writer method checking allowed values (enum).
191
+ # @param [Object] source Object to be assigned
192
+ def source=(source)
193
+ validator = EnumAttributeValidator.new('String', ["provider", "custom_html", "affiliate_network"])
194
+ unless validator.valid?(source)
195
+ fail ArgumentError, "invalid value for \"source\", must be one of #{validator.allowable_values}."
196
+ end
197
+ @source = source
198
+ end
199
+
200
+ # Checks equality by comparing each attribute.
201
+ # @param [Object] Object to be compared
202
+ def ==(o)
203
+ return true if self.equal?(o)
204
+ self.class == o.class &&
205
+ events == o.events &&
206
+ expect == o.expect &&
207
+ gate == o.gate &&
208
+ name == o.name &&
209
+ note == o.note &&
210
+ provider == o.provider &&
211
+ requests == o.requests &&
212
+ source == o.source &&
213
+ template == o.template
214
+ end
215
+
216
+ # @see the `==` method
217
+ # @param [Object] Object to be compared
218
+ def eql?(o)
219
+ self == o
220
+ end
221
+
222
+ # Calculates hash code according to all attributes.
223
+ # @return [Integer] Hash code
224
+ def hash
225
+ [events, expect, gate, name, note, provider, requests, source, template].hash
226
+ end
227
+
228
+ # Builds the object from hash
229
+ # @param [Hash] attributes Model attributes in the form of hash
230
+ # @return [Object] Returns the model itself
231
+ def self.build_from_hash(attributes)
232
+ new.build_from_hash(attributes)
233
+ end
234
+
235
+ # Builds the object from hash
236
+ # @param [Hash] attributes Model attributes in the form of hash
237
+ # @return [Object] Returns the model itself
238
+ def build_from_hash(attributes)
239
+ return nil unless attributes.is_a?(Hash)
240
+ attributes = attributes.transform_keys(&:to_sym)
241
+ self.class.openapi_types.each_pair do |key, type|
242
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
243
+ self.send("#{key}=", nil)
244
+ elsif type =~ /\AArray<(.*)>/i
245
+ # check to ensure the input is an array given that the attribute
246
+ # is documented as an array but the input is not
247
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
248
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
249
+ end
250
+ elsif !attributes[self.class.attribute_map[key]].nil?
251
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
252
+ end
253
+ end
254
+
255
+ self
256
+ end
257
+
258
+ # Deserializes the data based on type
259
+ # @param string type Data type
260
+ # @param string value Value to be deserialized
261
+ # @return [Object] Deserialized data
262
+ def _deserialize(type, value)
263
+ case type.to_sym
264
+ when :Time
265
+ Time.parse(value)
266
+ when :Date
267
+ Date.parse(value)
268
+ when :String
269
+ value.to_s
270
+ when :Integer
271
+ value.to_i
272
+ when :Float
273
+ value.to_f
274
+ when :Boolean
275
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
276
+ true
277
+ else
278
+ false
279
+ end
280
+ when :Object
281
+ # generic object (usually a Hash), return directly
282
+ value
283
+ when /\AArray<(?<inner_type>.+)>\z/
284
+ inner_type = Regexp.last_match[:inner_type]
285
+ value.map { |v| _deserialize(inner_type, v) }
286
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
287
+ k_type = Regexp.last_match[:k_type]
288
+ v_type = Regexp.last_match[:v_type]
289
+ {}.tap do |hash|
290
+ value.each do |k, v|
291
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
292
+ end
293
+ end
294
+ else # model
295
+ # models (e.g. Pet) or oneOf
296
+ klass = UltracartClient.const_get(type)
297
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
298
+ end
299
+ end
300
+
301
+ # Returns the string representation of the object
302
+ # @return [String] String presentation of the object
303
+ def to_s
304
+ to_hash.to_s
305
+ end
306
+
307
+ # to_body is an alias to to_hash (backward compatibility)
308
+ # @return [Hash] Returns the object in the form of hash
309
+ def to_body
310
+ to_hash
311
+ end
312
+
313
+ # Returns the object in the form of hash
314
+ # @return [Hash] Returns the object in the form of hash
315
+ def to_hash
316
+ hash = {}
317
+ self.class.attribute_map.each_pair do |attr, param|
318
+ value = self.send(attr)
319
+ if value.nil?
320
+ is_nullable = self.class.openapi_nullable.include?(attr)
321
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
322
+ end
323
+
324
+ hash[param] = _to_hash(value)
325
+ end
326
+ hash
327
+ end
328
+
329
+ # Outputs non-array value in the form of hash
330
+ # For object, use to_hash. Otherwise, just return the value
331
+ # @param [Object] value Any valid value
332
+ # @return [Hash] Returns the value in the form of hash
333
+ def _to_hash(value)
334
+ if value.is_a?(Array)
335
+ value.compact.map { |v| _to_hash(v) }
336
+ elsif value.is_a?(Hash)
337
+ {}.tap do |hash|
338
+ value.each { |k, v| hash[k] = _to_hash(v) }
339
+ end
340
+ elsif value.respond_to? :to_hash
341
+ value.to_hash
342
+ else
343
+ value
344
+ end
345
+ end
346
+
347
+ end
348
+
349
+ end
@@ -0,0 +1,284 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module UltracartClient
17
+ class SfvbTrackingCheckPlanRequest
18
+ # The host, exactly, or with a leading star and dot for any subdomain.
19
+ attr_accessor :host
20
+
21
+ # script, beacon or pixel.
22
+ attr_accessor :kind
23
+
24
+ # Query params that must be on the request. A star means present with any value.
25
+ attr_accessor :params
26
+
27
+ # The start of the path.
28
+ attr_accessor :path_prefix
29
+
30
+ class EnumAttributeValidator
31
+ attr_reader :datatype
32
+ attr_reader :allowable_values
33
+
34
+ def initialize(datatype, allowable_values)
35
+ @allowable_values = allowable_values.map do |value|
36
+ case datatype.to_s
37
+ when /Integer/i
38
+ value.to_i
39
+ when /Float/i
40
+ value.to_f
41
+ else
42
+ value
43
+ end
44
+ end
45
+ end
46
+
47
+ def valid?(value)
48
+ !value || allowable_values.include?(value)
49
+ end
50
+ end
51
+
52
+ # Attribute mapping from ruby-style variable name to JSON key.
53
+ def self.attribute_map
54
+ {
55
+ :'host' => :'host',
56
+ :'kind' => :'kind',
57
+ :'params' => :'params',
58
+ :'path_prefix' => :'path_prefix'
59
+ }
60
+ end
61
+
62
+ # Returns all the JSON keys this model knows about
63
+ def self.acceptable_attributes
64
+ attribute_map.values
65
+ end
66
+
67
+ # Attribute type mapping.
68
+ def self.openapi_types
69
+ {
70
+ :'host' => :'String',
71
+ :'kind' => :'String',
72
+ :'params' => :'Object',
73
+ :'path_prefix' => :'String'
74
+ }
75
+ end
76
+
77
+ # List of attributes with nullable: true
78
+ def self.openapi_nullable
79
+ Set.new([
80
+ ])
81
+ end
82
+
83
+ # Initializes the object
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ def initialize(attributes = {})
86
+ if (!attributes.is_a?(Hash))
87
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbTrackingCheckPlanRequest` initialize method"
88
+ end
89
+
90
+ # check to see if the attribute exists and convert string to symbol for hash key
91
+ attributes = attributes.each_with_object({}) { |(k, v), h|
92
+ if (!self.class.attribute_map.key?(k.to_sym))
93
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbTrackingCheckPlanRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
94
+ end
95
+ h[k.to_sym] = v
96
+ }
97
+
98
+ if attributes.key?(:'host')
99
+ self.host = attributes[:'host']
100
+ end
101
+
102
+ if attributes.key?(:'kind')
103
+ self.kind = attributes[:'kind']
104
+ end
105
+
106
+ if attributes.key?(:'params')
107
+ self.params = attributes[:'params']
108
+ end
109
+
110
+ if attributes.key?(:'path_prefix')
111
+ self.path_prefix = attributes[:'path_prefix']
112
+ end
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properties with the reasons
117
+ def list_invalid_properties
118
+ invalid_properties = Array.new
119
+ invalid_properties
120
+ end
121
+
122
+ # Check to see if the all the properties in the model are valid
123
+ # @return true if the model is valid
124
+ def valid?
125
+ kind_validator = EnumAttributeValidator.new('String', ["script", "beacon", "pixel"])
126
+ return false unless kind_validator.valid?(@kind)
127
+ true
128
+ end
129
+
130
+ # Custom attribute writer method checking allowed values (enum).
131
+ # @param [Object] kind Object to be assigned
132
+ def kind=(kind)
133
+ validator = EnumAttributeValidator.new('String', ["script", "beacon", "pixel"])
134
+ unless validator.valid?(kind)
135
+ fail ArgumentError, "invalid value for \"kind\", must be one of #{validator.allowable_values}."
136
+ end
137
+ @kind = kind
138
+ end
139
+
140
+ # Checks equality by comparing each attribute.
141
+ # @param [Object] Object to be compared
142
+ def ==(o)
143
+ return true if self.equal?(o)
144
+ self.class == o.class &&
145
+ host == o.host &&
146
+ kind == o.kind &&
147
+ params == o.params &&
148
+ path_prefix == o.path_prefix
149
+ end
150
+
151
+ # @see the `==` method
152
+ # @param [Object] Object to be compared
153
+ def eql?(o)
154
+ self == o
155
+ end
156
+
157
+ # Calculates hash code according to all attributes.
158
+ # @return [Integer] Hash code
159
+ def hash
160
+ [host, kind, params, path_prefix].hash
161
+ end
162
+
163
+ # Builds the object from hash
164
+ # @param [Hash] attributes Model attributes in the form of hash
165
+ # @return [Object] Returns the model itself
166
+ def self.build_from_hash(attributes)
167
+ new.build_from_hash(attributes)
168
+ end
169
+
170
+ # Builds the object from hash
171
+ # @param [Hash] attributes Model attributes in the form of hash
172
+ # @return [Object] Returns the model itself
173
+ def build_from_hash(attributes)
174
+ return nil unless attributes.is_a?(Hash)
175
+ attributes = attributes.transform_keys(&:to_sym)
176
+ self.class.openapi_types.each_pair do |key, type|
177
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
178
+ self.send("#{key}=", nil)
179
+ elsif type =~ /\AArray<(.*)>/i
180
+ # check to ensure the input is an array given that the attribute
181
+ # is documented as an array but the input is not
182
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
183
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
184
+ end
185
+ elsif !attributes[self.class.attribute_map[key]].nil?
186
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
187
+ end
188
+ end
189
+
190
+ self
191
+ end
192
+
193
+ # Deserializes the data based on type
194
+ # @param string type Data type
195
+ # @param string value Value to be deserialized
196
+ # @return [Object] Deserialized data
197
+ def _deserialize(type, value)
198
+ case type.to_sym
199
+ when :Time
200
+ Time.parse(value)
201
+ when :Date
202
+ Date.parse(value)
203
+ when :String
204
+ value.to_s
205
+ when :Integer
206
+ value.to_i
207
+ when :Float
208
+ value.to_f
209
+ when :Boolean
210
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
211
+ true
212
+ else
213
+ false
214
+ end
215
+ when :Object
216
+ # generic object (usually a Hash), return directly
217
+ value
218
+ when /\AArray<(?<inner_type>.+)>\z/
219
+ inner_type = Regexp.last_match[:inner_type]
220
+ value.map { |v| _deserialize(inner_type, v) }
221
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
222
+ k_type = Regexp.last_match[:k_type]
223
+ v_type = Regexp.last_match[:v_type]
224
+ {}.tap do |hash|
225
+ value.each do |k, v|
226
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
227
+ end
228
+ end
229
+ else # model
230
+ # models (e.g. Pet) or oneOf
231
+ klass = UltracartClient.const_get(type)
232
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
233
+ end
234
+ end
235
+
236
+ # Returns the string representation of the object
237
+ # @return [String] String presentation of the object
238
+ def to_s
239
+ to_hash.to_s
240
+ end
241
+
242
+ # to_body is an alias to to_hash (backward compatibility)
243
+ # @return [Hash] Returns the object in the form of hash
244
+ def to_body
245
+ to_hash
246
+ end
247
+
248
+ # Returns the object in the form of hash
249
+ # @return [Hash] Returns the object in the form of hash
250
+ def to_hash
251
+ hash = {}
252
+ self.class.attribute_map.each_pair do |attr, param|
253
+ value = self.send(attr)
254
+ if value.nil?
255
+ is_nullable = self.class.openapi_nullable.include?(attr)
256
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
257
+ end
258
+
259
+ hash[param] = _to_hash(value)
260
+ end
261
+ hash
262
+ end
263
+
264
+ # Outputs non-array value in the form of hash
265
+ # For object, use to_hash. Otherwise, just return the value
266
+ # @param [Object] value Any valid value
267
+ # @return [Hash] Returns the value in the form of hash
268
+ def _to_hash(value)
269
+ if value.is_a?(Array)
270
+ value.compact.map { |v| _to_hash(v) }
271
+ elsif value.is_a?(Hash)
272
+ {}.tap do |hash|
273
+ value.each { |k, v| hash[k] = _to_hash(v) }
274
+ end
275
+ elsif value.respond_to? :to_hash
276
+ value.to_hash
277
+ else
278
+ value
279
+ end
280
+ end
281
+
282
+ end
283
+
284
+ end