mailslurp_client 4.3.3 → 7.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +5 -5
  2. data/lib/mailslurp_client.rb +76 -7
  3. metadata +14 -255
  4. data/Gemfile +0 -8
  5. data/Gemfile.lock +0 -79
  6. data/LICENSE +0 -22
  7. data/README.md +0 -126
  8. data/Rakefile +0 -10
  9. data/docs/BasicAuthOptions.md +0 -9
  10. data/docs/BulkSendEmailOptions.md +0 -9
  11. data/docs/CommonOperationsApi.md +0 -166
  12. data/docs/CreateWebhookOptions.md +0 -10
  13. data/docs/Email.md +0 -22
  14. data/docs/EmailAnalysis.md +0 -12
  15. data/docs/EmailPreview.md +0 -9
  16. data/docs/ExtraOperationsApi.md +0 -855
  17. data/docs/Inbox.md +0 -11
  18. data/docs/SendEmailOptions.md +0 -16
  19. data/docs/Webhook.md +0 -13
  20. data/git_push.sh +0 -55
  21. data/lib/mailslurp_client/api/common_operations_api.rb +0 -175
  22. data/lib/mailslurp_client/api/extra_operations_api.rb +0 -879
  23. data/lib/mailslurp_client/api_client.rb +0 -389
  24. data/lib/mailslurp_client/api_error.rb +0 -38
  25. data/lib/mailslurp_client/configuration.rb +0 -251
  26. data/lib/mailslurp_client/models/basic_auth_options.rb +0 -202
  27. data/lib/mailslurp_client/models/bulk_send_email_options.rb +0 -201
  28. data/lib/mailslurp_client/models/create_webhook_options.rb +0 -202
  29. data/lib/mailslurp_client/models/email.rb +0 -350
  30. data/lib/mailslurp_client/models/email_analysis.rb +0 -245
  31. data/lib/mailslurp_client/models/email_preview.rb +0 -203
  32. data/lib/mailslurp_client/models/inbox.rb +0 -212
  33. data/lib/mailslurp_client/models/send_email_options.rb +0 -275
  34. data/lib/mailslurp_client/models/webhook.rb +0 -242
  35. data/lib/mailslurp_client/version.rb +0 -15
  36. data/mailslurp_client.gemspec +0 -45
  37. data/spec/api/common_operations_api_spec.rb +0 -71
  38. data/spec/api/extra_operations_api_spec.rb +0 -231
  39. data/spec/api_client_spec.rb +0 -226
  40. data/spec/configuration_spec.rb +0 -42
  41. data/spec/models/basic_auth_options_spec.rb +0 -47
  42. data/spec/models/bulk_send_email_options_spec.rb +0 -47
  43. data/spec/models/create_webhook_options_spec.rb +0 -53
  44. data/spec/models/email_analysis_spec.rb +0 -65
  45. data/spec/models/email_preview_spec.rb +0 -47
  46. data/spec/models/email_spec.rb +0 -125
  47. data/spec/models/inbox_spec.rb +0 -59
  48. data/spec/models/send_email_options_spec.rb +0 -89
  49. data/spec/models/webhook_spec.rb +0 -71
  50. data/spec/spec_helper.rb +0 -111
@@ -1,203 +0,0 @@
1
- =begin
2
- #MailSlurp API
3
-
4
- #For documentation see [developer guide](https://www.mailslurp.com/developers). [Create an account](https://app.mailslurp.com) in the MailSlurp Dashboard to [view your API Key](https://app). For all bugs, feature requests, or help please [see support](https://www.mailslurp.com/support/).
5
-
6
- OpenAPI spec version: 0.0.1-alpha
7
- Contact: contact@mailslurp.dev
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 3.3.4
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module MailSlurpClient
16
- # Preview of an email message. For full message call the message endpoint with a given message id.
17
- class EmailPreview
18
- attr_accessor :created
19
-
20
- attr_accessor :id
21
-
22
- # Attribute mapping from ruby-style variable name to JSON key.
23
- def self.attribute_map
24
- {
25
- :'created' => :'created',
26
- :'id' => :'id'
27
- }
28
- end
29
-
30
- # Attribute type mapping.
31
- def self.openapi_types
32
- {
33
- :'created' => :'DateTime',
34
- :'id' => :'String'
35
- }
36
- end
37
-
38
- # Initializes the object
39
- # @param [Hash] attributes Model attributes in the form of hash
40
- def initialize(attributes = {})
41
- return unless attributes.is_a?(Hash)
42
-
43
- # convert string to symbol for hash key
44
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
45
-
46
- if attributes.has_key?(:'created')
47
- self.created = attributes[:'created']
48
- end
49
-
50
- if attributes.has_key?(:'id')
51
- self.id = attributes[:'id']
52
- end
53
- end
54
-
55
- # Show invalid properties with the reasons. Usually used together with valid?
56
- # @return Array for valid properties with the reasons
57
- def list_invalid_properties
58
- invalid_properties = Array.new
59
- if @created.nil?
60
- invalid_properties.push('invalid value for "created", created cannot be nil.')
61
- end
62
-
63
- if @id.nil?
64
- invalid_properties.push('invalid value for "id", id cannot be nil.')
65
- end
66
-
67
- invalid_properties
68
- end
69
-
70
- # Check to see if the all the properties in the model are valid
71
- # @return true if the model is valid
72
- def valid?
73
- return false if @created.nil?
74
- return false if @id.nil?
75
- true
76
- end
77
-
78
- # Checks equality by comparing each attribute.
79
- # @param [Object] Object to be compared
80
- def ==(o)
81
- return true if self.equal?(o)
82
- self.class == o.class &&
83
- created == o.created &&
84
- id == o.id
85
- end
86
-
87
- # @see the `==` method
88
- # @param [Object] Object to be compared
89
- def eql?(o)
90
- self == o
91
- end
92
-
93
- # Calculates hash code according to all attributes.
94
- # @return [Fixnum] Hash code
95
- def hash
96
- [created, id].hash
97
- end
98
-
99
- # Builds the object from hash
100
- # @param [Hash] attributes Model attributes in the form of hash
101
- # @return [Object] Returns the model itself
102
- def build_from_hash(attributes)
103
- return nil unless attributes.is_a?(Hash)
104
- self.class.openapi_types.each_pair do |key, type|
105
- if type =~ /\AArray<(.*)>/i
106
- # check to ensure the input is an array given that the the attribute
107
- # is documented as an array but the input is not
108
- if attributes[self.class.attribute_map[key]].is_a?(Array)
109
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
110
- end
111
- elsif !attributes[self.class.attribute_map[key]].nil?
112
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
113
- end # or else data not found in attributes(hash), not an issue as the data can be optional
114
- end
115
-
116
- self
117
- end
118
-
119
- # Deserializes the data based on type
120
- # @param string type Data type
121
- # @param string value Value to be deserialized
122
- # @return [Object] Deserialized data
123
- def _deserialize(type, value)
124
- case type.to_sym
125
- when :DateTime
126
- DateTime.parse(value)
127
- when :Date
128
- Date.parse(value)
129
- when :String
130
- value.to_s
131
- when :Integer
132
- value.to_i
133
- when :Float
134
- value.to_f
135
- when :BOOLEAN
136
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
137
- true
138
- else
139
- false
140
- end
141
- when :Object
142
- # generic object (usually a Hash), return directly
143
- value
144
- when /\AArray<(?<inner_type>.+)>\z/
145
- inner_type = Regexp.last_match[:inner_type]
146
- value.map { |v| _deserialize(inner_type, v) }
147
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
148
- k_type = Regexp.last_match[:k_type]
149
- v_type = Regexp.last_match[:v_type]
150
- {}.tap do |hash|
151
- value.each do |k, v|
152
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
153
- end
154
- end
155
- else # model
156
- temp_model = MailSlurpClient.const_get(type).new
157
- temp_model.build_from_hash(value)
158
- end
159
- end
160
-
161
- # Returns the string representation of the object
162
- # @return [String] String presentation of the object
163
- def to_s
164
- to_hash.to_s
165
- end
166
-
167
- # to_body is an alias to to_hash (backward compatibility)
168
- # @return [Hash] Returns the object in the form of hash
169
- def to_body
170
- to_hash
171
- end
172
-
173
- # Returns the object in the form of hash
174
- # @return [Hash] Returns the object in the form of hash
175
- def to_hash
176
- hash = {}
177
- self.class.attribute_map.each_pair do |attr, param|
178
- value = self.send(attr)
179
- next if value.nil?
180
- hash[param] = _to_hash(value)
181
- end
182
- hash
183
- end
184
-
185
- # Outputs non-array value in the form of hash
186
- # For object, use to_hash. Otherwise, just return the value
187
- # @param [Object] value Any valid value
188
- # @return [Hash] Returns the value in the form of hash
189
- def _to_hash(value)
190
- if value.is_a?(Array)
191
- value.compact.map { |v| _to_hash(v) }
192
- elsif value.is_a?(Hash)
193
- {}.tap do |hash|
194
- value.each { |k, v| hash[k] = _to_hash(v) }
195
- end
196
- elsif value.respond_to? :to_hash
197
- value.to_hash
198
- else
199
- value
200
- end
201
- end
202
- end
203
- end
@@ -1,212 +0,0 @@
1
- =begin
2
- #MailSlurp API
3
-
4
- #For documentation see [developer guide](https://www.mailslurp.com/developers). [Create an account](https://app.mailslurp.com) in the MailSlurp Dashboard to [view your API Key](https://app). For all bugs, feature requests, or help please [see support](https://www.mailslurp.com/support/).
5
-
6
- OpenAPI spec version: 0.0.1-alpha
7
- Contact: contact@mailslurp.dev
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 3.3.4
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module MailSlurpClient
16
- # Representation of an inbox with an email address. Emails can be sent to or from this email address.
17
- class Inbox
18
- attr_accessor :created
19
-
20
- # The inbox's email address. Send an email to this address and the inbox will receive it
21
- attr_accessor :email_address
22
-
23
- attr_accessor :id
24
-
25
- attr_accessor :user_id
26
-
27
- # Attribute mapping from ruby-style variable name to JSON key.
28
- def self.attribute_map
29
- {
30
- :'created' => :'created',
31
- :'email_address' => :'emailAddress',
32
- :'id' => :'id',
33
- :'user_id' => :'userId'
34
- }
35
- end
36
-
37
- # Attribute type mapping.
38
- def self.openapi_types
39
- {
40
- :'created' => :'DateTime',
41
- :'email_address' => :'String',
42
- :'id' => :'String',
43
- :'user_id' => :'String'
44
- }
45
- end
46
-
47
- # Initializes the object
48
- # @param [Hash] attributes Model attributes in the form of hash
49
- def initialize(attributes = {})
50
- return unless attributes.is_a?(Hash)
51
-
52
- # convert string to symbol for hash key
53
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
54
-
55
- if attributes.has_key?(:'created')
56
- self.created = attributes[:'created']
57
- end
58
-
59
- if attributes.has_key?(:'emailAddress')
60
- self.email_address = attributes[:'emailAddress']
61
- end
62
-
63
- if attributes.has_key?(:'id')
64
- self.id = attributes[:'id']
65
- end
66
-
67
- if attributes.has_key?(:'userId')
68
- self.user_id = attributes[:'userId']
69
- end
70
- end
71
-
72
- # Show invalid properties with the reasons. Usually used together with valid?
73
- # @return Array for valid properties with the reasons
74
- def list_invalid_properties
75
- invalid_properties = Array.new
76
- invalid_properties
77
- end
78
-
79
- # Check to see if the all the properties in the model are valid
80
- # @return true if the model is valid
81
- def valid?
82
- true
83
- end
84
-
85
- # Checks equality by comparing each attribute.
86
- # @param [Object] Object to be compared
87
- def ==(o)
88
- return true if self.equal?(o)
89
- self.class == o.class &&
90
- created == o.created &&
91
- email_address == o.email_address &&
92
- id == o.id &&
93
- user_id == o.user_id
94
- end
95
-
96
- # @see the `==` method
97
- # @param [Object] Object to be compared
98
- def eql?(o)
99
- self == o
100
- end
101
-
102
- # Calculates hash code according to all attributes.
103
- # @return [Fixnum] Hash code
104
- def hash
105
- [created, email_address, id, user_id].hash
106
- end
107
-
108
- # Builds the object from hash
109
- # @param [Hash] attributes Model attributes in the form of hash
110
- # @return [Object] Returns the model itself
111
- def build_from_hash(attributes)
112
- return nil unless attributes.is_a?(Hash)
113
- self.class.openapi_types.each_pair do |key, type|
114
- if type =~ /\AArray<(.*)>/i
115
- # check to ensure the input is an array given that the the attribute
116
- # is documented as an array but the input is not
117
- if attributes[self.class.attribute_map[key]].is_a?(Array)
118
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
119
- end
120
- elsif !attributes[self.class.attribute_map[key]].nil?
121
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
122
- end # or else data not found in attributes(hash), not an issue as the data can be optional
123
- end
124
-
125
- self
126
- end
127
-
128
- # Deserializes the data based on type
129
- # @param string type Data type
130
- # @param string value Value to be deserialized
131
- # @return [Object] Deserialized data
132
- def _deserialize(type, value)
133
- case type.to_sym
134
- when :DateTime
135
- DateTime.parse(value)
136
- when :Date
137
- Date.parse(value)
138
- when :String
139
- value.to_s
140
- when :Integer
141
- value.to_i
142
- when :Float
143
- value.to_f
144
- when :BOOLEAN
145
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
146
- true
147
- else
148
- false
149
- end
150
- when :Object
151
- # generic object (usually a Hash), return directly
152
- value
153
- when /\AArray<(?<inner_type>.+)>\z/
154
- inner_type = Regexp.last_match[:inner_type]
155
- value.map { |v| _deserialize(inner_type, v) }
156
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
157
- k_type = Regexp.last_match[:k_type]
158
- v_type = Regexp.last_match[:v_type]
159
- {}.tap do |hash|
160
- value.each do |k, v|
161
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
162
- end
163
- end
164
- else # model
165
- temp_model = MailSlurpClient.const_get(type).new
166
- temp_model.build_from_hash(value)
167
- end
168
- end
169
-
170
- # Returns the string representation of the object
171
- # @return [String] String presentation of the object
172
- def to_s
173
- to_hash.to_s
174
- end
175
-
176
- # to_body is an alias to to_hash (backward compatibility)
177
- # @return [Hash] Returns the object in the form of hash
178
- def to_body
179
- to_hash
180
- end
181
-
182
- # Returns the object in the form of hash
183
- # @return [Hash] Returns the object in the form of hash
184
- def to_hash
185
- hash = {}
186
- self.class.attribute_map.each_pair do |attr, param|
187
- value = self.send(attr)
188
- next if value.nil?
189
- hash[param] = _to_hash(value)
190
- end
191
- hash
192
- end
193
-
194
- # Outputs non-array value in the form of hash
195
- # For object, use to_hash. Otherwise, just return the value
196
- # @param [Object] value Any valid value
197
- # @return [Hash] Returns the value in the form of hash
198
- def _to_hash(value)
199
- if value.is_a?(Array)
200
- value.compact.map { |v| _to_hash(v) }
201
- elsif value.is_a?(Hash)
202
- {}.tap do |hash|
203
- value.each { |k, v| hash[k] = _to_hash(v) }
204
- end
205
- elsif value.respond_to? :to_hash
206
- value.to_hash
207
- else
208
- value
209
- end
210
- end
211
- end
212
- end
@@ -1,275 +0,0 @@
1
- =begin
2
- #MailSlurp API
3
-
4
- #For documentation see [developer guide](https://www.mailslurp.com/developers). [Create an account](https://app.mailslurp.com) in the MailSlurp Dashboard to [view your API Key](https://app). For all bugs, feature requests, or help please [see support](https://www.mailslurp.com/support/).
5
-
6
- OpenAPI spec version: 0.0.1-alpha
7
- Contact: contact@mailslurp.dev
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 3.3.4
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module MailSlurpClient
16
- # Options for sending an email message from an inbox
17
- class SendEmailOptions
18
- # Optional list of bcc destination email addresses
19
- attr_accessor :bcc
20
-
21
- # Contents of email
22
- attr_accessor :body
23
-
24
- # Optional list of cc destination email addresses
25
- attr_accessor :cc
26
-
27
- # Optional charset
28
- attr_accessor :charset
29
-
30
- # Optional from address. If not set source inbox address will be used
31
- attr_accessor :from
32
-
33
- attr_accessor :html
34
-
35
- # Optional replyTo header
36
- attr_accessor :reply_to
37
-
38
- # Optional email subject line
39
- attr_accessor :subject
40
-
41
- # List of destination email addresses. Even single recipients must be in array form.
42
- attr_accessor :to
43
-
44
- # Attribute mapping from ruby-style variable name to JSON key.
45
- def self.attribute_map
46
- {
47
- :'bcc' => :'bcc',
48
- :'body' => :'body',
49
- :'cc' => :'cc',
50
- :'charset' => :'charset',
51
- :'from' => :'from',
52
- :'html' => :'html',
53
- :'reply_to' => :'replyTo',
54
- :'subject' => :'subject',
55
- :'to' => :'to'
56
- }
57
- end
58
-
59
- # Attribute type mapping.
60
- def self.openapi_types
61
- {
62
- :'bcc' => :'Array<String>',
63
- :'body' => :'String',
64
- :'cc' => :'Array<String>',
65
- :'charset' => :'String',
66
- :'from' => :'String',
67
- :'html' => :'BOOLEAN',
68
- :'reply_to' => :'String',
69
- :'subject' => :'String',
70
- :'to' => :'Array<String>'
71
- }
72
- end
73
-
74
- # Initializes the object
75
- # @param [Hash] attributes Model attributes in the form of hash
76
- def initialize(attributes = {})
77
- return unless attributes.is_a?(Hash)
78
-
79
- # convert string to symbol for hash key
80
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
81
-
82
- if attributes.has_key?(:'bcc')
83
- if (value = attributes[:'bcc']).is_a?(Array)
84
- self.bcc = value
85
- end
86
- end
87
-
88
- if attributes.has_key?(:'body')
89
- self.body = attributes[:'body']
90
- end
91
-
92
- if attributes.has_key?(:'cc')
93
- if (value = attributes[:'cc']).is_a?(Array)
94
- self.cc = value
95
- end
96
- end
97
-
98
- if attributes.has_key?(:'charset')
99
- self.charset = attributes[:'charset']
100
- end
101
-
102
- if attributes.has_key?(:'from')
103
- self.from = attributes[:'from']
104
- end
105
-
106
- if attributes.has_key?(:'html')
107
- self.html = attributes[:'html']
108
- end
109
-
110
- if attributes.has_key?(:'replyTo')
111
- self.reply_to = attributes[:'replyTo']
112
- end
113
-
114
- if attributes.has_key?(:'subject')
115
- self.subject = attributes[:'subject']
116
- end
117
-
118
- if attributes.has_key?(:'to')
119
- if (value = attributes[:'to']).is_a?(Array)
120
- self.to = value
121
- end
122
- end
123
- end
124
-
125
- # Show invalid properties with the reasons. Usually used together with valid?
126
- # @return Array for valid properties with the reasons
127
- def list_invalid_properties
128
- invalid_properties = Array.new
129
- if @to.nil?
130
- invalid_properties.push('invalid value for "to", to cannot be nil.')
131
- end
132
-
133
- invalid_properties
134
- end
135
-
136
- # Check to see if the all the properties in the model are valid
137
- # @return true if the model is valid
138
- def valid?
139
- return false if @to.nil?
140
- true
141
- end
142
-
143
- # Checks equality by comparing each attribute.
144
- # @param [Object] Object to be compared
145
- def ==(o)
146
- return true if self.equal?(o)
147
- self.class == o.class &&
148
- bcc == o.bcc &&
149
- body == o.body &&
150
- cc == o.cc &&
151
- charset == o.charset &&
152
- from == o.from &&
153
- html == o.html &&
154
- reply_to == o.reply_to &&
155
- subject == o.subject &&
156
- to == o.to
157
- end
158
-
159
- # @see the `==` method
160
- # @param [Object] Object to be compared
161
- def eql?(o)
162
- self == o
163
- end
164
-
165
- # Calculates hash code according to all attributes.
166
- # @return [Fixnum] Hash code
167
- def hash
168
- [bcc, body, cc, charset, from, html, reply_to, subject, to].hash
169
- end
170
-
171
- # Builds the object from hash
172
- # @param [Hash] attributes Model attributes in the form of hash
173
- # @return [Object] Returns the model itself
174
- def build_from_hash(attributes)
175
- return nil unless attributes.is_a?(Hash)
176
- self.class.openapi_types.each_pair do |key, type|
177
- if type =~ /\AArray<(.*)>/i
178
- # check to ensure the input is an array given that the the attribute
179
- # is documented as an array but the input is not
180
- if attributes[self.class.attribute_map[key]].is_a?(Array)
181
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
182
- end
183
- elsif !attributes[self.class.attribute_map[key]].nil?
184
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
185
- end # or else data not found in attributes(hash), not an issue as the data can be optional
186
- end
187
-
188
- self
189
- end
190
-
191
- # Deserializes the data based on type
192
- # @param string type Data type
193
- # @param string value Value to be deserialized
194
- # @return [Object] Deserialized data
195
- def _deserialize(type, value)
196
- case type.to_sym
197
- when :DateTime
198
- DateTime.parse(value)
199
- when :Date
200
- Date.parse(value)
201
- when :String
202
- value.to_s
203
- when :Integer
204
- value.to_i
205
- when :Float
206
- value.to_f
207
- when :BOOLEAN
208
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
209
- true
210
- else
211
- false
212
- end
213
- when :Object
214
- # generic object (usually a Hash), return directly
215
- value
216
- when /\AArray<(?<inner_type>.+)>\z/
217
- inner_type = Regexp.last_match[:inner_type]
218
- value.map { |v| _deserialize(inner_type, v) }
219
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
220
- k_type = Regexp.last_match[:k_type]
221
- v_type = Regexp.last_match[:v_type]
222
- {}.tap do |hash|
223
- value.each do |k, v|
224
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
225
- end
226
- end
227
- else # model
228
- temp_model = MailSlurpClient.const_get(type).new
229
- temp_model.build_from_hash(value)
230
- end
231
- end
232
-
233
- # Returns the string representation of the object
234
- # @return [String] String presentation of the object
235
- def to_s
236
- to_hash.to_s
237
- end
238
-
239
- # to_body is an alias to to_hash (backward compatibility)
240
- # @return [Hash] Returns the object in the form of hash
241
- def to_body
242
- to_hash
243
- end
244
-
245
- # Returns the object in the form of hash
246
- # @return [Hash] Returns the object in the form of hash
247
- def to_hash
248
- hash = {}
249
- self.class.attribute_map.each_pair do |attr, param|
250
- value = self.send(attr)
251
- next if value.nil?
252
- hash[param] = _to_hash(value)
253
- end
254
- hash
255
- end
256
-
257
- # Outputs non-array value in the form of hash
258
- # For object, use to_hash. Otherwise, just return the value
259
- # @param [Object] value Any valid value
260
- # @return [Hash] Returns the value in the form of hash
261
- def _to_hash(value)
262
- if value.is_a?(Array)
263
- value.compact.map { |v| _to_hash(v) }
264
- elsif value.is_a?(Hash)
265
- {}.tap do |hash|
266
- value.each { |k, v| hash[k] = _to_hash(v) }
267
- end
268
- elsif value.respond_to? :to_hash
269
- value.to_hash
270
- else
271
- value
272
- end
273
- end
274
- end
275
- end