ultracart_api 3.10.29 → 3.10.32

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 ConversationEventTyping
17
+ attr_accessor :author_conversation_participant_arn
18
+
19
+ attr_accessor :author_conversation_participant_name
20
+
21
+ attr_accessor :value
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'author_conversation_participant_arn' => :'author_conversation_participant_arn',
27
+ :'author_conversation_participant_name' => :'author_conversation_participant_name',
28
+ :'value' => :'value'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'author_conversation_participant_arn' => :'String',
36
+ :'author_conversation_participant_name' => :'String',
37
+ :'value' => :'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?(:'author_conversation_participant_arn')
50
+ self.author_conversation_participant_arn = attributes[:'author_conversation_participant_arn']
51
+ end
52
+
53
+ if attributes.has_key?(:'author_conversation_participant_name')
54
+ self.author_conversation_participant_name = attributes[:'author_conversation_participant_name']
55
+ end
56
+
57
+ if attributes.has_key?(:'value')
58
+ self.value = attributes[:'value']
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
+ author_conversation_participant_arn == o.author_conversation_participant_arn &&
81
+ author_conversation_participant_name == o.author_conversation_participant_name &&
82
+ value == o.value
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
+ [author_conversation_participant_arn, author_conversation_participant_name, value].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
@@ -29,8 +29,33 @@ module UltracartClient
29
29
 
30
30
  attr_accessor :transport_statuses
31
31
 
32
+ # Message type
33
+ attr_accessor :type
34
+
32
35
  attr_accessor :upload_keys
33
36
 
37
+ class EnumAttributeValidator
38
+ attr_reader :datatype
39
+ attr_reader :allowable_values
40
+
41
+ def initialize(datatype, allowable_values)
42
+ @allowable_values = allowable_values.map do |value|
43
+ case datatype.to_s
44
+ when /Integer/i
45
+ value.to_i
46
+ when /Float/i
47
+ value.to_f
48
+ else
49
+ value
50
+ end
51
+ end
52
+ end
53
+
54
+ def valid?(value)
55
+ !value || allowable_values.include?(value)
56
+ end
57
+ end
58
+
34
59
  # Attribute mapping from ruby-style variable name to JSON key.
35
60
  def self.attribute_map
36
61
  {
@@ -41,6 +66,7 @@ module UltracartClient
41
66
  :'media_urls' => :'media_urls',
42
67
  :'message_dts' => :'message_dts',
43
68
  :'transport_statuses' => :'transport_statuses',
69
+ :'type' => :'type',
44
70
  :'upload_keys' => :'upload_keys'
45
71
  }
46
72
  end
@@ -55,6 +81,7 @@ module UltracartClient
55
81
  :'media_urls' => :'Array<String>',
56
82
  :'message_dts' => :'String',
57
83
  :'transport_statuses' => :'Array<ConversationMessageTransportStatus>',
84
+ :'type' => :'String',
58
85
  :'upload_keys' => :'Array<String>'
59
86
  }
60
87
  end
@@ -99,6 +126,10 @@ module UltracartClient
99
126
  end
100
127
  end
101
128
 
129
+ if attributes.has_key?(:'type')
130
+ self.type = attributes[:'type']
131
+ end
132
+
102
133
  if attributes.has_key?(:'upload_keys')
103
134
  if (value = attributes[:'upload_keys']).is_a?(Array)
104
135
  self.upload_keys = value
@@ -116,9 +147,21 @@ module UltracartClient
116
147
  # Check to see if the all the properties in the model are valid
117
148
  # @return true if the model is valid
118
149
  def valid?
150
+ type_validator = EnumAttributeValidator.new('String', ['message', 'notice'])
151
+ return false unless type_validator.valid?(@type)
119
152
  true
120
153
  end
121
154
 
155
+ # Custom attribute writer method checking allowed values (enum).
156
+ # @param [Object] type Object to be assigned
157
+ def type=(type)
158
+ validator = EnumAttributeValidator.new('String', ['message', 'notice'])
159
+ unless validator.valid?(type)
160
+ fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
161
+ end
162
+ @type = type
163
+ end
164
+
122
165
  # Checks equality by comparing each attribute.
123
166
  # @param [Object] Object to be compared
124
167
  def ==(o)
@@ -131,6 +174,7 @@ module UltracartClient
131
174
  media_urls == o.media_urls &&
132
175
  message_dts == o.message_dts &&
133
176
  transport_statuses == o.transport_statuses &&
177
+ type == o.type &&
134
178
  upload_keys == o.upload_keys
135
179
  end
136
180
 
@@ -143,7 +187,7 @@ module UltracartClient
143
187
  # Calculates hash code according to all attributes.
144
188
  # @return [Fixnum] Hash code
145
189
  def hash
146
- [author_conversation_participant_arn, author_conversation_participant_name, body, client_message_id, media_urls, message_dts, transport_statuses, upload_keys].hash
190
+ [author_conversation_participant_arn, author_conversation_participant_name, body, client_message_id, media_urls, message_dts, transport_statuses, type, upload_keys].hash
147
191
  end
148
192
 
149
193
  # Builds the object from hash
@@ -27,9 +27,13 @@ module UltracartClient
27
27
 
28
28
  attr_accessor :event_queue_status_update
29
29
 
30
+ attr_accessor :event_rrweb
31
+
30
32
  # Type of event
31
33
  attr_accessor :event_type
32
34
 
35
+ attr_accessor :event_typing
36
+
33
37
  attr_accessor :event_updated_message
34
38
 
35
39
  attr_accessor :message
@@ -68,7 +72,9 @@ module UltracartClient
68
72
  :'event_new_message' => :'event_new_message',
69
73
  :'event_queue_position' => :'event_queue_position',
70
74
  :'event_queue_status_update' => :'event_queue_status_update',
75
+ :'event_rrweb' => :'event_rrweb',
71
76
  :'event_type' => :'event_type',
77
+ :'event_typing' => :'event_typing',
72
78
  :'event_updated_message' => :'event_updated_message',
73
79
  :'message' => :'message',
74
80
  :'type' => :'type'
@@ -84,7 +90,9 @@ module UltracartClient
84
90
  :'event_new_message' => :'ConversationSummary',
85
91
  :'event_queue_position' => :'ConversationEventQueuePosition',
86
92
  :'event_queue_status_update' => :'ConversationWebchatQueueStatus',
93
+ :'event_rrweb' => :'ConversationEventRRWeb',
87
94
  :'event_type' => :'String',
95
+ :'event_typing' => :'ConversationEventTyping',
88
96
  :'event_updated_message' => :'ConversationMessage',
89
97
  :'message' => :'ConversationMessage',
90
98
  :'type' => :'String'
@@ -123,10 +131,18 @@ module UltracartClient
123
131
  self.event_queue_status_update = attributes[:'event_queue_status_update']
124
132
  end
125
133
 
134
+ if attributes.has_key?(:'event_rrweb')
135
+ self.event_rrweb = attributes[:'event_rrweb']
136
+ end
137
+
126
138
  if attributes.has_key?(:'event_type')
127
139
  self.event_type = attributes[:'event_type']
128
140
  end
129
141
 
142
+ if attributes.has_key?(:'event_typing')
143
+ self.event_typing = attributes[:'event_typing']
144
+ end
145
+
130
146
  if attributes.has_key?(:'event_updated_message')
131
147
  self.event_updated_message = attributes[:'event_updated_message']
132
148
  end
@@ -150,9 +166,9 @@ module UltracartClient
150
166
  # Check to see if the all the properties in the model are valid
151
167
  # @return true if the model is valid
152
168
  def valid?
153
- event_type_validator = EnumAttributeValidator.new('String', ['queue position', 'webchat start conversation', 'conversation closed', 'new conversation', 'new message', 'updated message', 'queue status update'])
169
+ event_type_validator = EnumAttributeValidator.new('String', ['queue position', 'webchat start conversation', 'conversation closed', 'new conversation', 'new message', 'updated message', 'queue status update', 'rrweb'])
154
170
  return false unless event_type_validator.valid?(@event_type)
155
- type_validator = EnumAttributeValidator.new('String', ['message', 'event', 'ping'])
171
+ type_validator = EnumAttributeValidator.new('String', ['message', 'event', 'ping', 'check queue position'])
156
172
  return false unless type_validator.valid?(@type)
157
173
  true
158
174
  end
@@ -160,7 +176,7 @@ module UltracartClient
160
176
  # Custom attribute writer method checking allowed values (enum).
161
177
  # @param [Object] event_type Object to be assigned
162
178
  def event_type=(event_type)
163
- validator = EnumAttributeValidator.new('String', ['queue position', 'webchat start conversation', 'conversation closed', 'new conversation', 'new message', 'updated message', 'queue status update'])
179
+ validator = EnumAttributeValidator.new('String', ['queue position', 'webchat start conversation', 'conversation closed', 'new conversation', 'new message', 'updated message', 'queue status update', 'rrweb'])
164
180
  unless validator.valid?(event_type)
165
181
  fail ArgumentError, 'invalid value for "event_type", must be one of #{validator.allowable_values}.'
166
182
  end
@@ -170,7 +186,7 @@ module UltracartClient
170
186
  # Custom attribute writer method checking allowed values (enum).
171
187
  # @param [Object] type Object to be assigned
172
188
  def type=(type)
173
- validator = EnumAttributeValidator.new('String', ['message', 'event', 'ping'])
189
+ validator = EnumAttributeValidator.new('String', ['message', 'event', 'ping', 'check queue position'])
174
190
  unless validator.valid?(type)
175
191
  fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
176
192
  end
@@ -188,7 +204,9 @@ module UltracartClient
188
204
  event_new_message == o.event_new_message &&
189
205
  event_queue_position == o.event_queue_position &&
190
206
  event_queue_status_update == o.event_queue_status_update &&
207
+ event_rrweb == o.event_rrweb &&
191
208
  event_type == o.event_type &&
209
+ event_typing == o.event_typing &&
192
210
  event_updated_message == o.event_updated_message &&
193
211
  message == o.message &&
194
212
  type == o.type
@@ -203,7 +221,7 @@ module UltracartClient
203
221
  # Calculates hash code according to all attributes.
204
222
  # @return [Fixnum] Hash code
205
223
  def hash
206
- [conversation_uuid, event_conversation_closed, event_new_conversation, event_new_message, event_queue_position, event_queue_status_update, event_type, event_updated_message, message, type].hash
224
+ [conversation_uuid, event_conversation_closed, event_new_conversation, event_new_message, event_queue_position, event_queue_status_update, event_rrweb, event_type, event_typing, event_updated_message, message, type].hash
207
225
  end
208
226
 
209
227
  # Builds the object from hash
@@ -0,0 +1,249 @@
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 EmailCommseqSequenceTestRequest
17
+ attr_accessor :cart_id
18
+
19
+ attr_accessor :cart_item_ids
20
+
21
+ attr_accessor :esp_commseq_uuid
22
+
23
+ attr_accessor :name
24
+
25
+ attr_accessor :order_id
26
+
27
+ attr_accessor :please_review
28
+
29
+ attr_accessor :send_to_email
30
+
31
+ attr_accessor :send_to_logged_in_user
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'cart_id' => :'cart_id',
37
+ :'cart_item_ids' => :'cart_item_ids',
38
+ :'esp_commseq_uuid' => :'esp_commseq_uuid',
39
+ :'name' => :'name',
40
+ :'order_id' => :'order_id',
41
+ :'please_review' => :'please_review',
42
+ :'send_to_email' => :'send_to_email',
43
+ :'send_to_logged_in_user' => :'send_to_logged_in_user'
44
+ }
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.swagger_types
49
+ {
50
+ :'cart_id' => :'String',
51
+ :'cart_item_ids' => :'Array<String>',
52
+ :'esp_commseq_uuid' => :'String',
53
+ :'name' => :'String',
54
+ :'order_id' => :'String',
55
+ :'please_review' => :'BOOLEAN',
56
+ :'send_to_email' => :'String',
57
+ :'send_to_logged_in_user' => :'BOOLEAN'
58
+ }
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ return unless attributes.is_a?(Hash)
65
+
66
+ # convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
68
+
69
+ if attributes.has_key?(:'cart_id')
70
+ self.cart_id = attributes[:'cart_id']
71
+ end
72
+
73
+ if attributes.has_key?(:'cart_item_ids')
74
+ if (value = attributes[:'cart_item_ids']).is_a?(Array)
75
+ self.cart_item_ids = value
76
+ end
77
+ end
78
+
79
+ if attributes.has_key?(:'esp_commseq_uuid')
80
+ self.esp_commseq_uuid = attributes[:'esp_commseq_uuid']
81
+ end
82
+
83
+ if attributes.has_key?(:'name')
84
+ self.name = attributes[:'name']
85
+ end
86
+
87
+ if attributes.has_key?(:'order_id')
88
+ self.order_id = attributes[:'order_id']
89
+ end
90
+
91
+ if attributes.has_key?(:'please_review')
92
+ self.please_review = attributes[:'please_review']
93
+ end
94
+
95
+ if attributes.has_key?(:'send_to_email')
96
+ self.send_to_email = attributes[:'send_to_email']
97
+ end
98
+
99
+ if attributes.has_key?(:'send_to_logged_in_user')
100
+ self.send_to_logged_in_user = attributes[:'send_to_logged_in_user']
101
+ end
102
+ end
103
+
104
+ # Show invalid properties with the reasons. Usually used together with valid?
105
+ # @return Array for valid properties with the reasons
106
+ def list_invalid_properties
107
+ invalid_properties = Array.new
108
+ invalid_properties
109
+ end
110
+
111
+ # Check to see if the all the properties in the model are valid
112
+ # @return true if the model is valid
113
+ def valid?
114
+ true
115
+ end
116
+
117
+ # Checks equality by comparing each attribute.
118
+ # @param [Object] Object to be compared
119
+ def ==(o)
120
+ return true if self.equal?(o)
121
+ self.class == o.class &&
122
+ cart_id == o.cart_id &&
123
+ cart_item_ids == o.cart_item_ids &&
124
+ esp_commseq_uuid == o.esp_commseq_uuid &&
125
+ name == o.name &&
126
+ order_id == o.order_id &&
127
+ please_review == o.please_review &&
128
+ send_to_email == o.send_to_email &&
129
+ send_to_logged_in_user == o.send_to_logged_in_user
130
+ end
131
+
132
+ # @see the `==` method
133
+ # @param [Object] Object to be compared
134
+ def eql?(o)
135
+ self == o
136
+ end
137
+
138
+ # Calculates hash code according to all attributes.
139
+ # @return [Fixnum] Hash code
140
+ def hash
141
+ [cart_id, cart_item_ids, esp_commseq_uuid, name, order_id, please_review, send_to_email, send_to_logged_in_user].hash
142
+ end
143
+
144
+ # Builds the object from hash
145
+ # @param [Hash] attributes Model attributes in the form of hash
146
+ # @return [Object] Returns the model itself
147
+ def build_from_hash(attributes)
148
+ return nil unless attributes.is_a?(Hash)
149
+ self.class.swagger_types.each_pair do |key, type|
150
+ if type =~ /\AArray<(.*)>/i
151
+ # check to ensure the input is an array given that the attribute
152
+ # is documented as an array but the input is not
153
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
154
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
155
+ end
156
+ elsif !attributes[self.class.attribute_map[key]].nil?
157
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
158
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
159
+ end
160
+
161
+ self
162
+ end
163
+
164
+ # Deserializes the data based on type
165
+ # @param string type Data type
166
+ # @param string value Value to be deserialized
167
+ # @return [Object] Deserialized data
168
+ def _deserialize(type, value)
169
+ case type.to_sym
170
+ when :DateTime
171
+ DateTime.parse(value)
172
+ when :Date
173
+ Date.parse(value)
174
+ when :String
175
+ value.to_s
176
+ when :Integer
177
+ value.to_i
178
+ when :Float
179
+ value.to_f
180
+ when :BOOLEAN
181
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
182
+ true
183
+ else
184
+ false
185
+ end
186
+ when :Object
187
+ # generic object (usually a Hash), return directly
188
+ value
189
+ when /\AArray<(?<inner_type>.+)>\z/
190
+ inner_type = Regexp.last_match[:inner_type]
191
+ value.map { |v| _deserialize(inner_type, v) }
192
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
193
+ k_type = Regexp.last_match[:k_type]
194
+ v_type = Regexp.last_match[:v_type]
195
+ {}.tap do |hash|
196
+ value.each do |k, v|
197
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
198
+ end
199
+ end
200
+ else # model
201
+ temp_model = UltracartClient.const_get(type).new
202
+ temp_model.build_from_hash(value)
203
+ end
204
+ end
205
+
206
+ # Returns the string representation of the object
207
+ # @return [String] String presentation of the object
208
+ def to_s
209
+ to_hash.to_s
210
+ end
211
+
212
+ # to_body is an alias to to_hash (backward compatibility)
213
+ # @return [Hash] Returns the object in the form of hash
214
+ def to_body
215
+ to_hash
216
+ end
217
+
218
+ # Returns the object in the form of hash
219
+ # @return [Hash] Returns the object in the form of hash
220
+ def to_hash
221
+ hash = {}
222
+ self.class.attribute_map.each_pair do |attr, param|
223
+ value = self.send(attr)
224
+ next if value.nil?
225
+ hash[param] = _to_hash(value)
226
+ end
227
+ hash
228
+ end
229
+
230
+ # Outputs non-array value in the form of hash
231
+ # For object, use to_hash. Otherwise, just return the value
232
+ # @param [Object] value Any valid value
233
+ # @return [Hash] Returns the value in the form of hash
234
+ def _to_hash(value)
235
+ if value.is_a?(Array)
236
+ value.compact.map { |v| _to_hash(v) }
237
+ elsif value.is_a?(Hash)
238
+ {}.tap do |hash|
239
+ value.each { |k, v| hash[k] = _to_hash(v) }
240
+ end
241
+ elsif value.respond_to? :to_hash
242
+ value.to_hash
243
+ else
244
+ value
245
+ end
246
+ end
247
+
248
+ end
249
+ end