ultracart_api 3.1.43 → 3.1.48

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -5
  3. data/docs/Error.md +1 -0
  4. data/docs/IntegrationLog.md +22 -0
  5. data/docs/IntegrationLogApi.md +121 -0
  6. data/docs/IntegrationLogFile.md +10 -0
  7. data/docs/IntegrationLogLog.md +9 -0
  8. data/docs/IntegrationLogQueryFilterValues.md +16 -0
  9. data/docs/IntegrationLogQueryRequest.md +19 -0
  10. data/docs/IntegrationLogQueryResponse.md +13 -0
  11. data/docs/ItemChannelPartnerMapping.md +1 -0
  12. data/docs/ItemReviews.md +2 -0
  13. data/docs/ScreenRecordingHeatmapIndexRequest.md +8 -0
  14. data/docs/ScreenRecordingHeatmapUrl.md +1 -0
  15. data/docs/StorefrontApi.md +13 -2
  16. data/lib/ultracart_api.rb +8 -0
  17. data/lib/ultracart_api/api/integration_log_api.rb +161 -0
  18. data/lib/ultracart_api/api/storefront_api.rb +19 -4
  19. data/lib/ultracart_api/models/error.rb +11 -1
  20. data/lib/ultracart_api/models/integration_log.rb +316 -0
  21. data/lib/ultracart_api/models/integration_log_file.rb +202 -0
  22. data/lib/ultracart_api/models/integration_log_log.rb +193 -0
  23. data/lib/ultracart_api/models/integration_log_query_filter_values.rb +274 -0
  24. data/lib/ultracart_api/models/integration_log_query_request.rb +289 -0
  25. data/lib/ultracart_api/models/integration_log_query_response.rb +232 -0
  26. data/lib/ultracart_api/models/item_channel_partner_mapping.rb +11 -1
  27. data/lib/ultracart_api/models/item_reviews.rb +24 -4
  28. data/lib/ultracart_api/models/screen_recording_heatmap_index_request.rb +184 -0
  29. data/lib/ultracart_api/models/screen_recording_heatmap_url.rb +10 -1
  30. data/lib/ultracart_api/version.rb +1 -1
  31. metadata +18 -2
@@ -4562,19 +4562,27 @@ module UltracartClient
4562
4562
  # Get screen recording heatmap index
4563
4563
  # Get screen recording heatmap index
4564
4564
  # @param storefront_oid
4565
+ # @param query Query
4565
4566
  # @param [Hash] opts the optional parameters
4567
+ # @option opts [Integer] :_limit The maximum number of records to return on this one API call. (Default 100, Max 500) (default to 100)
4568
+ # @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index. (default to 0)
4569
+ # @option opts [String] :_sort The sort order of the items. See Sorting documentation for examples of using multiple values and sorting by ascending and descending.
4566
4570
  # @return [ScreenRecordingHeatmapIndexResponse]
4567
- def get_heatmap_index(storefront_oid, opts = {})
4568
- data, _status_code, _headers = get_heatmap_index_with_http_info(storefront_oid, opts)
4571
+ def get_heatmap_index(storefront_oid, query, opts = {})
4572
+ data, _status_code, _headers = get_heatmap_index_with_http_info(storefront_oid, query, opts)
4569
4573
  data
4570
4574
  end
4571
4575
 
4572
4576
  # Get screen recording heatmap index
4573
4577
  # Get screen recording heatmap index
4574
4578
  # @param storefront_oid
4579
+ # @param query Query
4575
4580
  # @param [Hash] opts the optional parameters
4581
+ # @option opts [Integer] :_limit The maximum number of records to return on this one API call. (Default 100, Max 500)
4582
+ # @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index.
4583
+ # @option opts [String] :_sort The sort order of the items. See Sorting documentation for examples of using multiple values and sorting by ascending and descending.
4576
4584
  # @return [Array<(ScreenRecordingHeatmapIndexResponse, Fixnum, Hash)>] ScreenRecordingHeatmapIndexResponse data, response status code and response headers
4577
- def get_heatmap_index_with_http_info(storefront_oid, opts = {})
4585
+ def get_heatmap_index_with_http_info(storefront_oid, query, opts = {})
4578
4586
  if @api_client.config.debugging
4579
4587
  @api_client.config.logger.debug 'Calling API: StorefrontApi.get_heatmap_index ...'
4580
4588
  end
@@ -4582,11 +4590,18 @@ module UltracartClient
4582
4590
  if @api_client.config.client_side_validation && storefront_oid.nil?
4583
4591
  fail ArgumentError, "Missing the required parameter 'storefront_oid' when calling StorefrontApi.get_heatmap_index"
4584
4592
  end
4593
+ # verify the required parameter 'query' is set
4594
+ if @api_client.config.client_side_validation && query.nil?
4595
+ fail ArgumentError, "Missing the required parameter 'query' when calling StorefrontApi.get_heatmap_index"
4596
+ end
4585
4597
  # resource path
4586
4598
  local_var_path = '/storefront/{storefront_oid}/screen_recordings/heatmap/index'.sub('{' + 'storefront_oid' + '}', storefront_oid.to_s)
4587
4599
 
4588
4600
  # query parameters
4589
4601
  query_params = {}
4602
+ query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil?
4603
+ query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil?
4604
+ query_params[:'_sort'] = opts[:'_sort'] if !opts[:'_sort'].nil?
4590
4605
 
4591
4606
  # header parameters
4592
4607
  header_params = {}
@@ -4600,7 +4615,7 @@ module UltracartClient
4600
4615
  form_params = {}
4601
4616
 
4602
4617
  # http body (model)
4603
- post_body = nil
4618
+ post_body = @api_client.object_to_http_body(query)
4604
4619
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
4605
4620
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
4606
4621
  :header_params => header_params,
@@ -23,6 +23,9 @@ module UltracartClient
23
23
  # Additional information often a link to additional documentation
24
24
  attr_accessor :more_info
25
25
 
26
+ # Object id that the error is associated with
27
+ attr_accessor :object_id
28
+
26
29
  # An end-user friendly message suitable for display to the customer
27
30
  attr_accessor :user_message
28
31
 
@@ -32,6 +35,7 @@ module UltracartClient
32
35
  :'developer_message' => :'developer_message',
33
36
  :'error_code' => :'error_code',
34
37
  :'more_info' => :'more_info',
38
+ :'object_id' => :'object_id',
35
39
  :'user_message' => :'user_message'
36
40
  }
37
41
  end
@@ -42,6 +46,7 @@ module UltracartClient
42
46
  :'developer_message' => :'String',
43
47
  :'error_code' => :'String',
44
48
  :'more_info' => :'String',
49
+ :'object_id' => :'String',
45
50
  :'user_message' => :'String'
46
51
  }
47
52
  end
@@ -66,6 +71,10 @@ module UltracartClient
66
71
  self.more_info = attributes[:'more_info']
67
72
  end
68
73
 
74
+ if attributes.has_key?(:'object_id')
75
+ self.object_id = attributes[:'object_id']
76
+ end
77
+
69
78
  if attributes.has_key?(:'user_message')
70
79
  self.user_message = attributes[:'user_message']
71
80
  end
@@ -92,6 +101,7 @@ module UltracartClient
92
101
  developer_message == o.developer_message &&
93
102
  error_code == o.error_code &&
94
103
  more_info == o.more_info &&
104
+ object_id == o.object_id &&
95
105
  user_message == o.user_message
96
106
  end
97
107
 
@@ -104,7 +114,7 @@ module UltracartClient
104
114
  # Calculates hash code according to all attributes.
105
115
  # @return [Fixnum] Hash code
106
116
  def hash
107
- [developer_message, error_code, more_info, user_message].hash
117
+ [developer_message, error_code, more_info, object_id, user_message].hash
108
118
  end
109
119
 
110
120
  # Builds the object from hash
@@ -0,0 +1,316 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ OpenAPI spec version: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.15-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module UltracartClient
16
+ class IntegrationLog
17
+ attr_accessor :action
18
+
19
+ attr_accessor :direction
20
+
21
+ attr_accessor :email
22
+
23
+ attr_accessor :files
24
+
25
+ attr_accessor :integration_log_oid
26
+
27
+ attr_accessor :item_id
28
+
29
+ attr_accessor :item_ipn_oid
30
+
31
+ attr_accessor :log_dts
32
+
33
+ attr_accessor :log_type
34
+
35
+ attr_accessor :logger_id
36
+
37
+ attr_accessor :logs
38
+
39
+ attr_accessor :order_ids
40
+
41
+ attr_accessor :pk
42
+
43
+ attr_accessor :sk
44
+
45
+ attr_accessor :status
46
+
47
+ # Attribute mapping from ruby-style variable name to JSON key.
48
+ def self.attribute_map
49
+ {
50
+ :'action' => :'action',
51
+ :'direction' => :'direction',
52
+ :'email' => :'email',
53
+ :'files' => :'files',
54
+ :'integration_log_oid' => :'integration_log_oid',
55
+ :'item_id' => :'item_id',
56
+ :'item_ipn_oid' => :'item_ipn_oid',
57
+ :'log_dts' => :'log_dts',
58
+ :'log_type' => :'log_type',
59
+ :'logger_id' => :'logger_id',
60
+ :'logs' => :'logs',
61
+ :'order_ids' => :'order_ids',
62
+ :'pk' => :'pk',
63
+ :'sk' => :'sk',
64
+ :'status' => :'status'
65
+ }
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.swagger_types
70
+ {
71
+ :'action' => :'String',
72
+ :'direction' => :'String',
73
+ :'email' => :'String',
74
+ :'files' => :'Array<IntegrationLogFile>',
75
+ :'integration_log_oid' => :'Integer',
76
+ :'item_id' => :'String',
77
+ :'item_ipn_oid' => :'Integer',
78
+ :'log_dts' => :'String',
79
+ :'log_type' => :'String',
80
+ :'logger_id' => :'String',
81
+ :'logs' => :'Array<IntegrationLogLog>',
82
+ :'order_ids' => :'Array<String>',
83
+ :'pk' => :'String',
84
+ :'sk' => :'String',
85
+ :'status' => :'String'
86
+ }
87
+ end
88
+
89
+ # Initializes the object
90
+ # @param [Hash] attributes Model attributes in the form of hash
91
+ def initialize(attributes = {})
92
+ return unless attributes.is_a?(Hash)
93
+
94
+ # convert string to symbol for hash key
95
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
96
+
97
+ if attributes.has_key?(:'action')
98
+ self.action = attributes[:'action']
99
+ end
100
+
101
+ if attributes.has_key?(:'direction')
102
+ self.direction = attributes[:'direction']
103
+ end
104
+
105
+ if attributes.has_key?(:'email')
106
+ self.email = attributes[:'email']
107
+ end
108
+
109
+ if attributes.has_key?(:'files')
110
+ if (value = attributes[:'files']).is_a?(Array)
111
+ self.files = value
112
+ end
113
+ end
114
+
115
+ if attributes.has_key?(:'integration_log_oid')
116
+ self.integration_log_oid = attributes[:'integration_log_oid']
117
+ end
118
+
119
+ if attributes.has_key?(:'item_id')
120
+ self.item_id = attributes[:'item_id']
121
+ end
122
+
123
+ if attributes.has_key?(:'item_ipn_oid')
124
+ self.item_ipn_oid = attributes[:'item_ipn_oid']
125
+ end
126
+
127
+ if attributes.has_key?(:'log_dts')
128
+ self.log_dts = attributes[:'log_dts']
129
+ end
130
+
131
+ if attributes.has_key?(:'log_type')
132
+ self.log_type = attributes[:'log_type']
133
+ end
134
+
135
+ if attributes.has_key?(:'logger_id')
136
+ self.logger_id = attributes[:'logger_id']
137
+ end
138
+
139
+ if attributes.has_key?(:'logs')
140
+ if (value = attributes[:'logs']).is_a?(Array)
141
+ self.logs = value
142
+ end
143
+ end
144
+
145
+ if attributes.has_key?(:'order_ids')
146
+ if (value = attributes[:'order_ids']).is_a?(Array)
147
+ self.order_ids = value
148
+ end
149
+ end
150
+
151
+ if attributes.has_key?(:'pk')
152
+ self.pk = attributes[:'pk']
153
+ end
154
+
155
+ if attributes.has_key?(:'sk')
156
+ self.sk = attributes[:'sk']
157
+ end
158
+
159
+ if attributes.has_key?(:'status')
160
+ self.status = attributes[:'status']
161
+ end
162
+ end
163
+
164
+ # Show invalid properties with the reasons. Usually used together with valid?
165
+ # @return Array for valid properties with the reasons
166
+ def list_invalid_properties
167
+ invalid_properties = Array.new
168
+ invalid_properties
169
+ end
170
+
171
+ # Check to see if the all the properties in the model are valid
172
+ # @return true if the model is valid
173
+ def valid?
174
+ true
175
+ end
176
+
177
+ # Checks equality by comparing each attribute.
178
+ # @param [Object] Object to be compared
179
+ def ==(o)
180
+ return true if self.equal?(o)
181
+ self.class == o.class &&
182
+ action == o.action &&
183
+ direction == o.direction &&
184
+ email == o.email &&
185
+ files == o.files &&
186
+ integration_log_oid == o.integration_log_oid &&
187
+ item_id == o.item_id &&
188
+ item_ipn_oid == o.item_ipn_oid &&
189
+ log_dts == o.log_dts &&
190
+ log_type == o.log_type &&
191
+ logger_id == o.logger_id &&
192
+ logs == o.logs &&
193
+ order_ids == o.order_ids &&
194
+ pk == o.pk &&
195
+ sk == o.sk &&
196
+ status == o.status
197
+ end
198
+
199
+ # @see the `==` method
200
+ # @param [Object] Object to be compared
201
+ def eql?(o)
202
+ self == o
203
+ end
204
+
205
+ # Calculates hash code according to all attributes.
206
+ # @return [Fixnum] Hash code
207
+ def hash
208
+ [action, direction, email, files, integration_log_oid, item_id, item_ipn_oid, log_dts, log_type, logger_id, logs, order_ids, pk, sk, status].hash
209
+ end
210
+
211
+ # Builds the object from hash
212
+ # @param [Hash] attributes Model attributes in the form of hash
213
+ # @return [Object] Returns the model itself
214
+ def build_from_hash(attributes)
215
+ return nil unless attributes.is_a?(Hash)
216
+ self.class.swagger_types.each_pair do |key, type|
217
+ if type =~ /\AArray<(.*)>/i
218
+ # check to ensure the input is an array given that the attribute
219
+ # is documented as an array but the input is not
220
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
221
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
222
+ end
223
+ elsif !attributes[self.class.attribute_map[key]].nil?
224
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
225
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
226
+ end
227
+
228
+ self
229
+ end
230
+
231
+ # Deserializes the data based on type
232
+ # @param string type Data type
233
+ # @param string value Value to be deserialized
234
+ # @return [Object] Deserialized data
235
+ def _deserialize(type, value)
236
+ case type.to_sym
237
+ when :DateTime
238
+ DateTime.parse(value)
239
+ when :Date
240
+ Date.parse(value)
241
+ when :String
242
+ value.to_s
243
+ when :Integer
244
+ value.to_i
245
+ when :Float
246
+ value.to_f
247
+ when :BOOLEAN
248
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
249
+ true
250
+ else
251
+ false
252
+ end
253
+ when :Object
254
+ # generic object (usually a Hash), return directly
255
+ value
256
+ when /\AArray<(?<inner_type>.+)>\z/
257
+ inner_type = Regexp.last_match[:inner_type]
258
+ value.map { |v| _deserialize(inner_type, v) }
259
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
260
+ k_type = Regexp.last_match[:k_type]
261
+ v_type = Regexp.last_match[:v_type]
262
+ {}.tap do |hash|
263
+ value.each do |k, v|
264
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
265
+ end
266
+ end
267
+ else # model
268
+ temp_model = UltracartClient.const_get(type).new
269
+ temp_model.build_from_hash(value)
270
+ end
271
+ end
272
+
273
+ # Returns the string representation of the object
274
+ # @return [String] String presentation of the object
275
+ def to_s
276
+ to_hash.to_s
277
+ end
278
+
279
+ # to_body is an alias to to_hash (backward compatibility)
280
+ # @return [Hash] Returns the object in the form of hash
281
+ def to_body
282
+ to_hash
283
+ end
284
+
285
+ # Returns the object in the form of hash
286
+ # @return [Hash] Returns the object in the form of hash
287
+ def to_hash
288
+ hash = {}
289
+ self.class.attribute_map.each_pair do |attr, param|
290
+ value = self.send(attr)
291
+ next if value.nil?
292
+ hash[param] = _to_hash(value)
293
+ end
294
+ hash
295
+ end
296
+
297
+ # Outputs non-array value in the form of hash
298
+ # For object, use to_hash. Otherwise, just return the value
299
+ # @param [Object] value Any valid value
300
+ # @return [Hash] Returns the value in the form of hash
301
+ def _to_hash(value)
302
+ if value.is_a?(Array)
303
+ value.compact.map { |v| _to_hash(v) }
304
+ elsif value.is_a?(Hash)
305
+ {}.tap do |hash|
306
+ value.each { |k, v| hash[k] = _to_hash(v) }
307
+ end
308
+ elsif value.respond_to? :to_hash
309
+ value.to_hash
310
+ else
311
+ value
312
+ end
313
+ end
314
+
315
+ end
316
+ end
@@ -0,0 +1,202 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ OpenAPI spec version: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.15-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module UltracartClient
16
+ class IntegrationLogFile
17
+ attr_accessor :name
18
+
19
+ attr_accessor :size
20
+
21
+ attr_accessor :uuid
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'name' => :'name',
27
+ :'size' => :'size',
28
+ :'uuid' => :'uuid'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'name' => :'String',
36
+ :'size' => :'Integer',
37
+ :'uuid' => :'String'
38
+ }
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ return unless attributes.is_a?(Hash)
45
+
46
+ # convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
48
+
49
+ if attributes.has_key?(:'name')
50
+ self.name = attributes[:'name']
51
+ end
52
+
53
+ if attributes.has_key?(:'size')
54
+ self.size = attributes[:'size']
55
+ end
56
+
57
+ if attributes.has_key?(:'uuid')
58
+ self.uuid = attributes[:'uuid']
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
+ name == o.name &&
81
+ size == o.size &&
82
+ uuid == o.uuid
83
+ end
84
+
85
+ # @see the `==` method
86
+ # @param [Object] Object to be compared
87
+ def eql?(o)
88
+ self == o
89
+ end
90
+
91
+ # Calculates hash code according to all attributes.
92
+ # @return [Fixnum] Hash code
93
+ def hash
94
+ [name, size, uuid].hash
95
+ end
96
+
97
+ # Builds the object from hash
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ # @return [Object] Returns the model itself
100
+ def build_from_hash(attributes)
101
+ return nil unless attributes.is_a?(Hash)
102
+ self.class.swagger_types.each_pair do |key, type|
103
+ if type =~ /\AArray<(.*)>/i
104
+ # check to ensure the input is an array given that the attribute
105
+ # is documented as an array but the input is not
106
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
107
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
108
+ end
109
+ elsif !attributes[self.class.attribute_map[key]].nil?
110
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
111
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
112
+ end
113
+
114
+ self
115
+ end
116
+
117
+ # Deserializes the data based on type
118
+ # @param string type Data type
119
+ # @param string value Value to be deserialized
120
+ # @return [Object] Deserialized data
121
+ def _deserialize(type, value)
122
+ case type.to_sym
123
+ when :DateTime
124
+ DateTime.parse(value)
125
+ when :Date
126
+ Date.parse(value)
127
+ when :String
128
+ value.to_s
129
+ when :Integer
130
+ value.to_i
131
+ when :Float
132
+ value.to_f
133
+ when :BOOLEAN
134
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
135
+ true
136
+ else
137
+ false
138
+ end
139
+ when :Object
140
+ # generic object (usually a Hash), return directly
141
+ value
142
+ when /\AArray<(?<inner_type>.+)>\z/
143
+ inner_type = Regexp.last_match[:inner_type]
144
+ value.map { |v| _deserialize(inner_type, v) }
145
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
146
+ k_type = Regexp.last_match[:k_type]
147
+ v_type = Regexp.last_match[:v_type]
148
+ {}.tap do |hash|
149
+ value.each do |k, v|
150
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
151
+ end
152
+ end
153
+ else # model
154
+ temp_model = UltracartClient.const_get(type).new
155
+ temp_model.build_from_hash(value)
156
+ end
157
+ end
158
+
159
+ # Returns the string representation of the object
160
+ # @return [String] String presentation of the object
161
+ def to_s
162
+ to_hash.to_s
163
+ end
164
+
165
+ # to_body is an alias to to_hash (backward compatibility)
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_body
168
+ to_hash
169
+ end
170
+
171
+ # Returns the object in the form of hash
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_hash
174
+ hash = {}
175
+ self.class.attribute_map.each_pair do |attr, param|
176
+ value = self.send(attr)
177
+ next if value.nil?
178
+ hash[param] = _to_hash(value)
179
+ end
180
+ hash
181
+ end
182
+
183
+ # Outputs non-array value in the form of hash
184
+ # For object, use to_hash. Otherwise, just return the value
185
+ # @param [Object] value Any valid value
186
+ # @return [Hash] Returns the value in the form of hash
187
+ def _to_hash(value)
188
+ if value.is_a?(Array)
189
+ value.compact.map { |v| _to_hash(v) }
190
+ elsif value.is_a?(Hash)
191
+ {}.tap do |hash|
192
+ value.each { |k, v| hash[k] = _to_hash(v) }
193
+ end
194
+ elsif value.respond_to? :to_hash
195
+ value.to_hash
196
+ else
197
+ value
198
+ end
199
+ end
200
+
201
+ end
202
+ end