ultracart_api 3.10.184 → 3.10.186

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +84 -4
  3. data/docs/ConversationApi.md +2466 -340
  4. data/docs/ConversationPbxAgent.md +16 -0
  5. data/docs/ConversationPbxAgentResponse.md +12 -0
  6. data/docs/ConversationPbxAgentsResponse.md +12 -0
  7. data/docs/ConversationPbxAudio.md +16 -0
  8. data/docs/ConversationPbxAudioResponse.md +12 -0
  9. data/docs/ConversationPbxAudiosResponse.md +12 -0
  10. data/docs/ConversationPbxCustomerSnapshotRequest.md +15 -0
  11. data/docs/ConversationPbxCustomerSnapshotResponse.md +14 -0
  12. data/docs/ConversationPbxMenu.md +17 -0
  13. data/docs/ConversationPbxMenuMapping.md +11 -0
  14. data/docs/ConversationPbxMenuResponse.md +12 -0
  15. data/docs/ConversationPbxMenusResponse.md +12 -0
  16. data/docs/ConversationPbxPhoneNumber.md +12 -0
  17. data/docs/ConversationPbxPhoneNumberResponse.md +12 -0
  18. data/docs/ConversationPbxPhoneNumbersResponse.md +12 -0
  19. data/docs/ConversationPbxQueue.md +27 -0
  20. data/docs/ConversationPbxQueueMembers.md +9 -0
  21. data/docs/ConversationPbxQueueResponse.md +12 -0
  22. data/docs/ConversationPbxQueuesResponse.md +12 -0
  23. data/docs/ConversationPbxTimeBased.md +11 -0
  24. data/docs/ConversationPbxTimeBasedMapping.md +11 -0
  25. data/docs/ConversationPbxTimeBasedMappingConfig.md +9 -0
  26. data/docs/ConversationPbxTimeBasedResponse.md +12 -0
  27. data/docs/ConversationPbxTimeBasedsResponse.md +12 -0
  28. data/docs/ConversationPbxTimeRange.md +12 -0
  29. data/docs/ConversationPbxTimeRangeConfig.md +13 -0
  30. data/docs/ConversationPbxTimeRangeResponse.md +12 -0
  31. data/docs/ConversationPbxTimeRangesResponse.md +12 -0
  32. data/docs/ConversationPbxVoicemailMailbox.md +18 -0
  33. data/docs/ConversationPbxVoicemailMailboxResponse.md +12 -0
  34. data/docs/ConversationPbxVoicemailMailboxesResponse.md +12 -0
  35. data/docs/WorkflowAgentAuth.md +10 -0
  36. data/docs/WorkflowAgentAuthResponse.md +12 -0
  37. data/docs/WorkflowApi.md +92 -0
  38. data/docs/WorkflowTaskTagsResponse.md +12 -0
  39. data/lib/ultracart_api/api/conversation_api.rb +2919 -609
  40. data/lib/ultracart_api/api/workflow_api.rb +98 -0
  41. data/lib/ultracart_api/models/conversation_pbx_agent.rb +325 -0
  42. data/lib/ultracart_api/models/conversation_pbx_agent_response.rb +221 -0
  43. data/lib/ultracart_api/models/conversation_pbx_agents_response.rb +223 -0
  44. data/lib/ultracart_api/models/conversation_pbx_audio.rb +355 -0
  45. data/lib/ultracart_api/models/conversation_pbx_audio_response.rb +221 -0
  46. data/lib/ultracart_api/models/conversation_pbx_audios_response.rb +223 -0
  47. data/lib/ultracart_api/models/conversation_pbx_customer_snapshot_request.rb +248 -0
  48. data/lib/ultracart_api/models/conversation_pbx_customer_snapshot_response.rb +243 -0
  49. data/lib/ultracart_api/models/conversation_pbx_menu.rb +367 -0
  50. data/lib/ultracart_api/models/conversation_pbx_menu_mapping.rb +215 -0
  51. data/lib/ultracart_api/models/conversation_pbx_menu_response.rb +221 -0
  52. data/lib/ultracart_api/models/conversation_pbx_menus_response.rb +223 -0
  53. data/lib/ultracart_api/models/conversation_pbx_phone_number.rb +300 -0
  54. data/lib/ultracart_api/models/conversation_pbx_phone_number_response.rb +221 -0
  55. data/lib/ultracart_api/models/conversation_pbx_phone_numbers_response.rb +223 -0
  56. data/lib/ultracart_api/models/conversation_pbx_queue.rb +524 -0
  57. data/lib/ultracart_api/models/conversation_pbx_queue_members.rb +197 -0
  58. data/lib/ultracart_api/models/conversation_pbx_queue_response.rb +221 -0
  59. data/lib/ultracart_api/models/conversation_pbx_queues_response.rb +223 -0
  60. data/lib/ultracart_api/models/conversation_pbx_time_based.rb +211 -0
  61. data/lib/ultracart_api/models/conversation_pbx_time_based_mapping.rb +275 -0
  62. data/lib/ultracart_api/models/conversation_pbx_time_based_mapping_config.rb +196 -0
  63. data/lib/ultracart_api/models/conversation_pbx_time_based_response.rb +221 -0
  64. data/lib/ultracart_api/models/conversation_pbx_time_baseds_response.rb +223 -0
  65. data/lib/ultracart_api/models/conversation_pbx_time_range.rb +287 -0
  66. data/lib/ultracart_api/models/conversation_pbx_time_range_config.rb +235 -0
  67. data/lib/ultracart_api/models/conversation_pbx_time_range_response.rb +221 -0
  68. data/lib/ultracart_api/models/conversation_pbx_time_ranges_response.rb +223 -0
  69. data/lib/ultracart_api/models/conversation_pbx_voicemail_mailbox.rb +405 -0
  70. data/lib/ultracart_api/models/conversation_pbx_voicemail_mailbox_response.rb +221 -0
  71. data/lib/ultracart_api/models/conversation_pbx_voicemail_mailboxes_response.rb +223 -0
  72. data/lib/ultracart_api/models/workflow_agent_auth.rb +202 -0
  73. data/lib/ultracart_api/models/workflow_agent_auth_response.rb +221 -0
  74. data/lib/ultracart_api/models/workflow_task_tags_response.rb +224 -0
  75. data/lib/ultracart_api/version.rb +1 -1
  76. data/lib/ultracart_api.rb +34 -0
  77. metadata +70 -2
@@ -0,0 +1,287 @@
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 ConversationPbxTimeRange
17
+ # Configurations for all ranges in this time range
18
+ attr_accessor :configs
19
+
20
+ # Conversation Pbx Time Range UUID
21
+ attr_accessor :conversation_pbx_time_range_uuid
22
+
23
+ # Merchant Id
24
+ attr_accessor :merchant_id
25
+
26
+ # Time range name
27
+ attr_accessor :time_range_name
28
+
29
+ # Timezone
30
+ attr_accessor :timezone
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'configs' => :'configs',
36
+ :'conversation_pbx_time_range_uuid' => :'conversation_pbx_time_range_uuid',
37
+ :'merchant_id' => :'merchant_id',
38
+ :'time_range_name' => :'time_range_name',
39
+ :'timezone' => :'timezone'
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.swagger_types
45
+ {
46
+ :'configs' => :'Array<ConversationPbxTimeRangeConfig>',
47
+ :'conversation_pbx_time_range_uuid' => :'String',
48
+ :'merchant_id' => :'String',
49
+ :'time_range_name' => :'String',
50
+ :'timezone' => :'String'
51
+ }
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ return unless attributes.is_a?(Hash)
58
+
59
+ # convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
61
+
62
+ if attributes.has_key?(:'configs')
63
+ if (value = attributes[:'configs']).is_a?(Array)
64
+ self.configs = value
65
+ end
66
+ end
67
+
68
+ if attributes.has_key?(:'conversation_pbx_time_range_uuid')
69
+ self.conversation_pbx_time_range_uuid = attributes[:'conversation_pbx_time_range_uuid']
70
+ end
71
+
72
+ if attributes.has_key?(:'merchant_id')
73
+ self.merchant_id = attributes[:'merchant_id']
74
+ end
75
+
76
+ if attributes.has_key?(:'time_range_name')
77
+ self.time_range_name = attributes[:'time_range_name']
78
+ end
79
+
80
+ if attributes.has_key?(:'timezone')
81
+ self.timezone = attributes[:'timezone']
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ invalid_properties = Array.new
89
+ if !@conversation_pbx_time_range_uuid.nil? && @conversation_pbx_time_range_uuid.to_s.length > 50
90
+ invalid_properties.push('invalid value for "conversation_pbx_time_range_uuid", the character length must be smaller than or equal to 50.')
91
+ end
92
+
93
+ if !@merchant_id.nil? && @merchant_id.to_s.length > 5
94
+ invalid_properties.push('invalid value for "merchant_id", the character length must be smaller than or equal to 5.')
95
+ end
96
+
97
+ if !@time_range_name.nil? && @time_range_name.to_s.length > 50
98
+ invalid_properties.push('invalid value for "time_range_name", the character length must be smaller than or equal to 50.')
99
+ end
100
+
101
+ if !@timezone.nil? && @timezone.to_s.length > 100
102
+ invalid_properties.push('invalid value for "timezone", the character length must be smaller than or equal to 100.')
103
+ end
104
+
105
+ invalid_properties
106
+ end
107
+
108
+ # Check to see if the all the properties in the model are valid
109
+ # @return true if the model is valid
110
+ def valid?
111
+ return false if !@conversation_pbx_time_range_uuid.nil? && @conversation_pbx_time_range_uuid.to_s.length > 50
112
+ return false if !@merchant_id.nil? && @merchant_id.to_s.length > 5
113
+ return false if !@time_range_name.nil? && @time_range_name.to_s.length > 50
114
+ return false if !@timezone.nil? && @timezone.to_s.length > 100
115
+ true
116
+ end
117
+
118
+ # Custom attribute writer method with validation
119
+ # @param [Object] conversation_pbx_time_range_uuid Value to be assigned
120
+ def conversation_pbx_time_range_uuid=(conversation_pbx_time_range_uuid)
121
+ if !conversation_pbx_time_range_uuid.nil? && conversation_pbx_time_range_uuid.to_s.length > 50
122
+ fail ArgumentError, 'invalid value for "conversation_pbx_time_range_uuid", the character length must be smaller than or equal to 50.'
123
+ end
124
+
125
+ @conversation_pbx_time_range_uuid = conversation_pbx_time_range_uuid
126
+ end
127
+
128
+ # Custom attribute writer method with validation
129
+ # @param [Object] merchant_id Value to be assigned
130
+ def merchant_id=(merchant_id)
131
+ if !merchant_id.nil? && merchant_id.to_s.length > 5
132
+ fail ArgumentError, 'invalid value for "merchant_id", the character length must be smaller than or equal to 5.'
133
+ end
134
+
135
+ @merchant_id = merchant_id
136
+ end
137
+
138
+ # Custom attribute writer method with validation
139
+ # @param [Object] time_range_name Value to be assigned
140
+ def time_range_name=(time_range_name)
141
+ if !time_range_name.nil? && time_range_name.to_s.length > 50
142
+ fail ArgumentError, 'invalid value for "time_range_name", the character length must be smaller than or equal to 50.'
143
+ end
144
+
145
+ @time_range_name = time_range_name
146
+ end
147
+
148
+ # Custom attribute writer method with validation
149
+ # @param [Object] timezone Value to be assigned
150
+ def timezone=(timezone)
151
+ if !timezone.nil? && timezone.to_s.length > 100
152
+ fail ArgumentError, 'invalid value for "timezone", the character length must be smaller than or equal to 100.'
153
+ end
154
+
155
+ @timezone = timezone
156
+ end
157
+
158
+ # Checks equality by comparing each attribute.
159
+ # @param [Object] Object to be compared
160
+ def ==(o)
161
+ return true if self.equal?(o)
162
+ self.class == o.class &&
163
+ configs == o.configs &&
164
+ conversation_pbx_time_range_uuid == o.conversation_pbx_time_range_uuid &&
165
+ merchant_id == o.merchant_id &&
166
+ time_range_name == o.time_range_name &&
167
+ timezone == o.timezone
168
+ end
169
+
170
+ # @see the `==` method
171
+ # @param [Object] Object to be compared
172
+ def eql?(o)
173
+ self == o
174
+ end
175
+
176
+ # Calculates hash code according to all attributes.
177
+ # @return [Fixnum] Hash code
178
+ def hash
179
+ [configs, conversation_pbx_time_range_uuid, merchant_id, time_range_name, timezone].hash
180
+ end
181
+
182
+ # Builds the object from hash
183
+ # @param [Hash] attributes Model attributes in the form of hash
184
+ # @return [Object] Returns the model itself
185
+ def build_from_hash(attributes)
186
+ return nil unless attributes.is_a?(Hash)
187
+ self.class.swagger_types.each_pair do |key, type|
188
+ if type =~ /\AArray<(.*)>/i
189
+ # check to ensure the input is an array given that the attribute
190
+ # is documented as an array but the input is not
191
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
192
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
193
+ end
194
+ elsif !attributes[self.class.attribute_map[key]].nil?
195
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
196
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
197
+ end
198
+
199
+ self
200
+ end
201
+
202
+ # Deserializes the data based on type
203
+ # @param string type Data type
204
+ # @param string value Value to be deserialized
205
+ # @return [Object] Deserialized data
206
+ def _deserialize(type, value)
207
+ case type.to_sym
208
+ when :DateTime
209
+ DateTime.parse(value)
210
+ when :Date
211
+ Date.parse(value)
212
+ when :String
213
+ value.to_s
214
+ when :Integer
215
+ value.to_i
216
+ when :Float
217
+ value.to_f
218
+ when :BOOLEAN
219
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
220
+ true
221
+ else
222
+ false
223
+ end
224
+ when :Object
225
+ # generic object (usually a Hash), return directly
226
+ value
227
+ when /\AArray<(?<inner_type>.+)>\z/
228
+ inner_type = Regexp.last_match[:inner_type]
229
+ value.map { |v| _deserialize(inner_type, v) }
230
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
231
+ k_type = Regexp.last_match[:k_type]
232
+ v_type = Regexp.last_match[:v_type]
233
+ {}.tap do |hash|
234
+ value.each do |k, v|
235
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
236
+ end
237
+ end
238
+ else # model
239
+ temp_model = UltracartClient.const_get(type).new
240
+ temp_model.build_from_hash(value)
241
+ end
242
+ end
243
+
244
+ # Returns the string representation of the object
245
+ # @return [String] String presentation of the object
246
+ def to_s
247
+ to_hash.to_s
248
+ end
249
+
250
+ # to_body is an alias to to_hash (backward compatibility)
251
+ # @return [Hash] Returns the object in the form of hash
252
+ def to_body
253
+ to_hash
254
+ end
255
+
256
+ # Returns the object in the form of hash
257
+ # @return [Hash] Returns the object in the form of hash
258
+ def to_hash
259
+ hash = {}
260
+ self.class.attribute_map.each_pair do |attr, param|
261
+ value = self.send(attr)
262
+ next if value.nil?
263
+ hash[param] = _to_hash(value)
264
+ end
265
+ hash
266
+ end
267
+
268
+ # Outputs non-array value in the form of hash
269
+ # For object, use to_hash. Otherwise, just return the value
270
+ # @param [Object] value Any valid value
271
+ # @return [Hash] Returns the value in the form of hash
272
+ def _to_hash(value)
273
+ if value.is_a?(Array)
274
+ value.compact.map { |v| _to_hash(v) }
275
+ elsif value.is_a?(Hash)
276
+ {}.tap do |hash|
277
+ value.each { |k, v| hash[k] = _to_hash(v) }
278
+ end
279
+ elsif value.respond_to? :to_hash
280
+ value.to_hash
281
+ else
282
+ value
283
+ end
284
+ end
285
+
286
+ end
287
+ end
@@ -0,0 +1,235 @@
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 ConversationPbxTimeRangeConfig
17
+ # End date
18
+ attr_accessor :end_date
19
+
20
+ # End day of week
21
+ attr_accessor :end_day_of_week
22
+
23
+ # End time
24
+ attr_accessor :end_time
25
+
26
+ # Start date
27
+ attr_accessor :start_date
28
+
29
+ # Start day of week
30
+ attr_accessor :start_day_of_week
31
+
32
+ # Start time
33
+ attr_accessor :start_time
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'end_date' => :'end_date',
39
+ :'end_day_of_week' => :'end_day_of_week',
40
+ :'end_time' => :'end_time',
41
+ :'start_date' => :'start_date',
42
+ :'start_day_of_week' => :'start_day_of_week',
43
+ :'start_time' => :'start_time'
44
+ }
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.swagger_types
49
+ {
50
+ :'end_date' => :'String',
51
+ :'end_day_of_week' => :'Integer',
52
+ :'end_time' => :'String',
53
+ :'start_date' => :'String',
54
+ :'start_day_of_week' => :'Integer',
55
+ :'start_time' => :'String'
56
+ }
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ return unless attributes.is_a?(Hash)
63
+
64
+ # convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
66
+
67
+ if attributes.has_key?(:'end_date')
68
+ self.end_date = attributes[:'end_date']
69
+ end
70
+
71
+ if attributes.has_key?(:'end_day_of_week')
72
+ self.end_day_of_week = attributes[:'end_day_of_week']
73
+ end
74
+
75
+ if attributes.has_key?(:'end_time')
76
+ self.end_time = attributes[:'end_time']
77
+ end
78
+
79
+ if attributes.has_key?(:'start_date')
80
+ self.start_date = attributes[:'start_date']
81
+ end
82
+
83
+ if attributes.has_key?(:'start_day_of_week')
84
+ self.start_day_of_week = attributes[:'start_day_of_week']
85
+ end
86
+
87
+ if attributes.has_key?(:'start_time')
88
+ self.start_time = attributes[:'start_time']
89
+ end
90
+ end
91
+
92
+ # Show invalid properties with the reasons. Usually used together with valid?
93
+ # @return Array for valid properties with the reasons
94
+ def list_invalid_properties
95
+ invalid_properties = Array.new
96
+ invalid_properties
97
+ end
98
+
99
+ # Check to see if the all the properties in the model are valid
100
+ # @return true if the model is valid
101
+ def valid?
102
+ true
103
+ end
104
+
105
+ # Checks equality by comparing each attribute.
106
+ # @param [Object] Object to be compared
107
+ def ==(o)
108
+ return true if self.equal?(o)
109
+ self.class == o.class &&
110
+ end_date == o.end_date &&
111
+ end_day_of_week == o.end_day_of_week &&
112
+ end_time == o.end_time &&
113
+ start_date == o.start_date &&
114
+ start_day_of_week == o.start_day_of_week &&
115
+ start_time == o.start_time
116
+ end
117
+
118
+ # @see the `==` method
119
+ # @param [Object] Object to be compared
120
+ def eql?(o)
121
+ self == o
122
+ end
123
+
124
+ # Calculates hash code according to all attributes.
125
+ # @return [Fixnum] Hash code
126
+ def hash
127
+ [end_date, end_day_of_week, end_time, start_date, start_day_of_week, start_time].hash
128
+ end
129
+
130
+ # Builds the object from hash
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ # @return [Object] Returns the model itself
133
+ def build_from_hash(attributes)
134
+ return nil unless attributes.is_a?(Hash)
135
+ self.class.swagger_types.each_pair do |key, type|
136
+ if type =~ /\AArray<(.*)>/i
137
+ # check to ensure the input is an array given that the attribute
138
+ # is documented as an array but the input is not
139
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
140
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
141
+ end
142
+ elsif !attributes[self.class.attribute_map[key]].nil?
143
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
144
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
145
+ end
146
+
147
+ self
148
+ end
149
+
150
+ # Deserializes the data based on type
151
+ # @param string type Data type
152
+ # @param string value Value to be deserialized
153
+ # @return [Object] Deserialized data
154
+ def _deserialize(type, value)
155
+ case type.to_sym
156
+ when :DateTime
157
+ DateTime.parse(value)
158
+ when :Date
159
+ Date.parse(value)
160
+ when :String
161
+ value.to_s
162
+ when :Integer
163
+ value.to_i
164
+ when :Float
165
+ value.to_f
166
+ when :BOOLEAN
167
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
168
+ true
169
+ else
170
+ false
171
+ end
172
+ when :Object
173
+ # generic object (usually a Hash), return directly
174
+ value
175
+ when /\AArray<(?<inner_type>.+)>\z/
176
+ inner_type = Regexp.last_match[:inner_type]
177
+ value.map { |v| _deserialize(inner_type, v) }
178
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
179
+ k_type = Regexp.last_match[:k_type]
180
+ v_type = Regexp.last_match[:v_type]
181
+ {}.tap do |hash|
182
+ value.each do |k, v|
183
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
184
+ end
185
+ end
186
+ else # model
187
+ temp_model = UltracartClient.const_get(type).new
188
+ temp_model.build_from_hash(value)
189
+ end
190
+ end
191
+
192
+ # Returns the string representation of the object
193
+ # @return [String] String presentation of the object
194
+ def to_s
195
+ to_hash.to_s
196
+ end
197
+
198
+ # to_body is an alias to to_hash (backward compatibility)
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_body
201
+ to_hash
202
+ end
203
+
204
+ # Returns the object in the form of hash
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_hash
207
+ hash = {}
208
+ self.class.attribute_map.each_pair do |attr, param|
209
+ value = self.send(attr)
210
+ next if value.nil?
211
+ hash[param] = _to_hash(value)
212
+ end
213
+ hash
214
+ end
215
+
216
+ # Outputs non-array value in the form of hash
217
+ # For object, use to_hash. Otherwise, just return the value
218
+ # @param [Object] value Any valid value
219
+ # @return [Hash] Returns the value in the form of hash
220
+ def _to_hash(value)
221
+ if value.is_a?(Array)
222
+ value.compact.map { |v| _to_hash(v) }
223
+ elsif value.is_a?(Hash)
224
+ {}.tap do |hash|
225
+ value.each { |k, v| hash[k] = _to_hash(v) }
226
+ end
227
+ elsif value.respond_to? :to_hash
228
+ value.to_hash
229
+ else
230
+ value
231
+ end
232
+ end
233
+
234
+ end
235
+ end