sib-api-v3-sdk 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -9
  3. data/docs/GetAccountPlan.md +1 -1
  4. data/docs/GetCampaignStats.md +1 -1
  5. data/docs/GetContactCampaignStats.md +4 -4
  6. data/docs/GetContactCampaignStatsClicked.md +1 -1
  7. data/docs/GetContactCampaignStatsOpened.md +1 -1
  8. data/docs/GetContactCampaignStatsUnsubscriptions.md +2 -2
  9. data/docs/GetEmailCampaign.md +1 -1
  10. data/docs/GetEmailEventReportEvents.md +2 -0
  11. data/docs/GetExtendedCampaignOverview.md +1 -1
  12. data/docs/GetExtendedContactDetails.md +1 -0
  13. data/docs/GetExtendedContactDetailsStatistics.md +15 -0
  14. data/docs/GetExtendedContactDetailsStatisticsClicked.md +9 -0
  15. data/docs/{GetContactCampaignStatsLinks.md → GetExtendedContactDetailsStatisticsLinks.md} +2 -2
  16. data/docs/{GetContactCampaignStatsMessagesSent.md → GetExtendedContactDetailsStatisticsMessagesSent.md} +2 -2
  17. data/docs/GetExtendedContactDetailsStatisticsOpened.md +11 -0
  18. data/docs/GetExtendedContactDetailsStatisticsUnsubscriptions.md +9 -0
  19. data/docs/{GetContactCampaignStatsUnsubscriptionsAdminUnsubscription.md → GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription.md} +2 -2
  20. data/docs/{GetContactCampaignStatsUnsubscriptionsUserUnsubscription.md → GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.md} +2 -2
  21. data/docs/GetExtendedList.md +1 -1
  22. data/docs/GetLists.md +1 -1
  23. data/docs/GetWebhook.md +2 -2
  24. data/lib/sib-api-v3-sdk.rb +8 -6
  25. data/lib/sib-api-v3-sdk/models/get_account_plan.rb +1 -1
  26. data/lib/sib-api-v3-sdk/models/get_campaign_stats.rb +0 -5
  27. data/lib/sib-api-v3-sdk/models/get_contact_campaign_stats.rb +4 -4
  28. data/lib/sib-api-v3-sdk/models/get_contact_campaign_stats_clicked.rb +1 -1
  29. data/lib/sib-api-v3-sdk/models/get_contact_campaign_stats_opened.rb +20 -1
  30. data/lib/sib-api-v3-sdk/models/get_contact_campaign_stats_unsubscriptions.rb +2 -2
  31. data/lib/sib-api-v3-sdk/models/get_email_campaign.rb +0 -5
  32. data/lib/sib-api-v3-sdk/models/get_email_event_report_events.rb +24 -4
  33. data/lib/sib-api-v3-sdk/models/get_extended_campaign_overview.rb +0 -5
  34. data/lib/sib-api-v3-sdk/models/get_extended_contact_details.rb +13 -4
  35. data/lib/sib-api-v3-sdk/models/get_extended_contact_details_statistics.rb +272 -0
  36. data/lib/sib-api-v3-sdk/models/{get_contact_campaign_stats_messages_sent.rb → get_extended_contact_details_statistics_clicked.rb} +14 -12
  37. data/lib/sib-api-v3-sdk/models/{get_contact_campaign_stats_links.rb → get_extended_contact_details_statistics_links.rb} +21 -2
  38. data/lib/sib-api-v3-sdk/models/get_extended_contact_details_statistics_messages_sent.rb +228 -0
  39. data/lib/sib-api-v3-sdk/models/get_extended_contact_details_statistics_opened.rb +258 -0
  40. data/lib/sib-api-v3-sdk/models/{get_lists_folder.rb → get_extended_contact_details_statistics_unsubscriptions.rb} +27 -23
  41. data/lib/sib-api-v3-sdk/models/{get_contact_campaign_stats_unsubscriptions_admin_unsubscription.rb → get_extended_contact_details_statistics_unsubscriptions_admin_unsubscription.rb} +21 -2
  42. data/lib/sib-api-v3-sdk/models/{get_contact_campaign_stats_unsubscriptions_user_unsubscription.rb → get_extended_contact_details_statistics_unsubscriptions_user_unsubscription.rb} +21 -2
  43. data/lib/sib-api-v3-sdk/models/get_extended_list.rb +6 -6
  44. data/lib/sib-api-v3-sdk/models/get_lists.rb +19 -19
  45. data/lib/sib-api-v3-sdk/models/get_webhook.rb +12 -12
  46. data/lib/sib-api-v3-sdk/version.rb +1 -1
  47. data/spec/models/get_email_event_report_events_spec.rb +12 -0
  48. data/spec/models/get_extended_contact_details_spec.rb +6 -0
  49. data/spec/models/{get_lists_folder_spec.rb → get_extended_contact_details_statistics_clicked_spec.rb} +8 -8
  50. data/spec/models/{get_contact_campaign_stats_links_spec.rb → get_extended_contact_details_statistics_links_spec.rb} +6 -6
  51. data/spec/models/{get_contact_campaign_stats_messages_sent_spec.rb → get_extended_contact_details_statistics_messages_sent_spec.rb} +6 -6
  52. data/spec/models/get_extended_contact_details_statistics_opened_spec.rb +60 -0
  53. data/spec/models/get_extended_contact_details_statistics_spec.rb +84 -0
  54. data/spec/models/{get_contact_campaign_stats_unsubscriptions_admin_unsubscription_spec.rb → get_extended_contact_details_statistics_unsubscriptions_admin_unsubscription_spec.rb} +6 -6
  55. data/spec/models/get_extended_contact_details_statistics_unsubscriptions_spec.rb +48 -0
  56. data/spec/models/{get_contact_campaign_stats_unsubscriptions_user_unsubscription_spec.rb → get_extended_contact_details_statistics_unsubscriptions_user_unsubscription_spec.rb} +6 -6
  57. data/spec/models/get_lists_spec.rb +2 -2
  58. metadata +34 -27
  59. data/docs/GetListsFolder.md +0 -9
  60. data/docs/GetListsLists.md +0 -8
  61. data/git_push.sh +0 -55
  62. data/lib/sib-api-v3-sdk/models/get_lists_lists.rb +0 -188
  63. data/spec/models/get_lists_lists_spec.rb +0 -42
@@ -33,8 +33,8 @@ module SibApiV3Sdk
33
33
  # Attribute type mapping.
34
34
  def self.swagger_types
35
35
  {
36
- :'user_unsubscription' => :'Array<GetContactCampaignStatsUnsubscriptionsUserUnsubscription>',
37
- :'admin_unsubscription' => :'Array<GetContactCampaignStatsUnsubscriptionsAdminUnsubscription>'
36
+ :'user_unsubscription' => :'Array<GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription>',
37
+ :'admin_unsubscription' => :'Array<GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription>'
38
38
  }
39
39
  end
40
40
 
@@ -290,10 +290,6 @@ module SibApiV3Sdk
290
290
  invalid_properties.push("invalid value for 'html_content', html_content cannot be nil.")
291
291
  end
292
292
 
293
- if @share_link.nil?
294
- invalid_properties.push("invalid value for 'share_link', share_link cannot be nil.")
295
- end
296
-
297
293
  if @tag.nil?
298
294
  invalid_properties.push("invalid value for 'tag', tag cannot be nil.")
299
295
  end
@@ -336,7 +332,6 @@ module SibApiV3Sdk
336
332
  return false if @reply_to.nil?
337
333
  return false if @to_field.nil?
338
334
  return false if @html_content.nil?
339
- return false if @share_link.nil?
340
335
  return false if @tag.nil?
341
336
  return false if @created_at.nil?
342
337
  return false if @created_at !~ Regexp.new(/^([1-9]\d{3}-\d{2}-\d{2} [0-2]\d:[0-5]\d:[0-5]\d)?$/)
@@ -21,6 +21,9 @@ module SibApiV3Sdk
21
21
  # Date on which the event has been generated
22
22
  attr_accessor :date
23
23
 
24
+ # Subject of the event
25
+ attr_accessor :subject
26
+
24
27
  # Message ID which generated the event
25
28
  attr_accessor :message_id
26
29
 
@@ -36,6 +39,9 @@ module SibApiV3Sdk
36
39
  # IP from which the user has opened the email or clicked on the link (only availble if the event is opened or clicks)
37
40
  attr_accessor :ip
38
41
 
42
+ # The link which is sent to the user (only availble if the event is requests or opened or clicks)
43
+ attr_accessor :link
44
+
39
45
  class EnumAttributeValidator
40
46
  attr_reader :datatype
41
47
  attr_reader :allowable_values
@@ -63,11 +69,13 @@ module SibApiV3Sdk
63
69
  {
64
70
  :'email' => :'email',
65
71
  :'date' => :'date',
72
+ :'subject' => :'subject',
66
73
  :'message_id' => :'messageId',
67
74
  :'event' => :'event',
68
75
  :'reason' => :'reason',
69
76
  :'tag' => :'tag',
70
- :'ip' => :'ip'
77
+ :'ip' => :'ip',
78
+ :'link' => :'link'
71
79
  }
72
80
  end
73
81
 
@@ -76,11 +84,13 @@ module SibApiV3Sdk
76
84
  {
77
85
  :'email' => :'String',
78
86
  :'date' => :'Date',
87
+ :'subject' => :'String',
79
88
  :'message_id' => :'String',
80
89
  :'event' => :'String',
81
90
  :'reason' => :'String',
82
91
  :'tag' => :'String',
83
- :'ip' => :'String'
92
+ :'ip' => :'String',
93
+ :'link' => :'String'
84
94
  }
85
95
  end
86
96
 
@@ -100,6 +110,10 @@ module SibApiV3Sdk
100
110
  self.date = attributes[:'date']
101
111
  end
102
112
 
113
+ if attributes.has_key?(:'subject')
114
+ self.subject = attributes[:'subject']
115
+ end
116
+
103
117
  if attributes.has_key?(:'messageId')
104
118
  self.message_id = attributes[:'messageId']
105
119
  end
@@ -120,6 +134,10 @@ module SibApiV3Sdk
120
134
  self.ip = attributes[:'ip']
121
135
  end
122
136
 
137
+ if attributes.has_key?(:'link')
138
+ self.link = attributes[:'link']
139
+ end
140
+
123
141
  end
124
142
 
125
143
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -184,11 +202,13 @@ module SibApiV3Sdk
184
202
  self.class == o.class &&
185
203
  email == o.email &&
186
204
  date == o.date &&
205
+ subject == o.subject &&
187
206
  message_id == o.message_id &&
188
207
  event == o.event &&
189
208
  reason == o.reason &&
190
209
  tag == o.tag &&
191
- ip == o.ip
210
+ ip == o.ip &&
211
+ link == o.link
192
212
  end
193
213
 
194
214
  # @see the `==` method
@@ -200,7 +220,7 @@ module SibApiV3Sdk
200
220
  # Calculates hash code according to all attributes.
201
221
  # @return [Fixnum] Hash code
202
222
  def hash
203
- [email, date, message_id, event, reason, tag, ip].hash
223
+ [email, date, subject, message_id, event, reason, tag, ip, link].hash
204
224
  end
205
225
 
206
226
  # Builds the object from hash
@@ -290,10 +290,6 @@ module SibApiV3Sdk
290
290
  invalid_properties.push("invalid value for 'html_content', html_content cannot be nil.")
291
291
  end
292
292
 
293
- if @share_link.nil?
294
- invalid_properties.push("invalid value for 'share_link', share_link cannot be nil.")
295
- end
296
-
297
293
  if @tag.nil?
298
294
  invalid_properties.push("invalid value for 'tag', tag cannot be nil.")
299
295
  end
@@ -336,7 +332,6 @@ module SibApiV3Sdk
336
332
  return false if @reply_to.nil?
337
333
  return false if @to_field.nil?
338
334
  return false if @html_content.nil?
339
- return false if @share_link.nil?
340
335
  return false if @tag.nil?
341
336
  return false if @created_at.nil?
342
337
  return false if @created_at !~ Regexp.new(/^([1-9]\d{3}-\d{2}-\d{2} [0-2]\d:[0-5]\d:[0-5]\d)?$/)
@@ -36,6 +36,8 @@ module SibApiV3Sdk
36
36
 
37
37
  attr_accessor :attributes
38
38
 
39
+ attr_accessor :statistics
40
+
39
41
 
40
42
  # Attribute mapping from ruby-style variable name to JSON key.
41
43
  def self.attribute_map
@@ -47,7 +49,8 @@ module SibApiV3Sdk
47
49
  :'modified_at' => :'modifiedAt',
48
50
  :'list_ids' => :'listIds',
49
51
  :'list_unsubscribed' => :'listUnsubscribed',
50
- :'attributes' => :'attributes'
52
+ :'attributes' => :'attributes',
53
+ :'statistics' => :'statistics'
51
54
  }
52
55
  end
53
56
 
@@ -61,7 +64,8 @@ module SibApiV3Sdk
61
64
  :'modified_at' => :'String',
62
65
  :'list_ids' => :'Array<Integer>',
63
66
  :'list_unsubscribed' => :'Array<Integer>',
64
- :'attributes' => :'Hash<String, String>'
67
+ :'attributes' => :'Hash<String, String>',
68
+ :'statistics' => :'GetExtendedContactDetailsStatistics'
65
69
  }
66
70
  end
67
71
 
@@ -111,6 +115,10 @@ module SibApiV3Sdk
111
115
  end
112
116
  end
113
117
 
118
+ if attributes.has_key?(:'statistics')
119
+ self.statistics = attributes[:'statistics']
120
+ end
121
+
114
122
  end
115
123
 
116
124
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -192,7 +200,8 @@ module SibApiV3Sdk
192
200
  modified_at == o.modified_at &&
193
201
  list_ids == o.list_ids &&
194
202
  list_unsubscribed == o.list_unsubscribed &&
195
- attributes == o.attributes
203
+ attributes == o.attributes &&
204
+ statistics == o.statistics
196
205
  end
197
206
 
198
207
  # @see the `==` method
@@ -204,7 +213,7 @@ module SibApiV3Sdk
204
213
  # Calculates hash code according to all attributes.
205
214
  # @return [Fixnum] Hash code
206
215
  def hash
207
- [email, id, email_blacklisted, sms_blacklisted, modified_at, list_ids, list_unsubscribed, attributes].hash
216
+ [email, id, email_blacklisted, sms_blacklisted, modified_at, list_ids, list_unsubscribed, attributes, statistics].hash
208
217
  end
209
218
 
210
219
  # Builds the object from hash
@@ -0,0 +1,272 @@
1
+ =begin
2
+ #SendinBlue API
3
+
4
+ #SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
5
+
6
+ OpenAPI spec version: 3.0.0
7
+ Contact: contact@sendinblue.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module SibApiV3Sdk
16
+ # Campaign statistics of the contact
17
+ class GetExtendedContactDetailsStatistics
18
+ # Listing of the sent campaign for the contact
19
+ attr_accessor :messages_sent
20
+
21
+ # Listing of the hardbounes generated by the contact
22
+ attr_accessor :hard_bounces
23
+
24
+ # Listing of the softbounes generated by the contact
25
+ attr_accessor :soft_bounces
26
+
27
+ # Listing of the complaints generated by the contact
28
+ attr_accessor :complaints
29
+
30
+ attr_accessor :unsubscriptions
31
+
32
+ # Listing of the openings generated by the contact
33
+ attr_accessor :opened
34
+
35
+ # Listing of the clicks generated by the contact
36
+ attr_accessor :clicked
37
+
38
+ # Listing of the transactional attributes for the contact
39
+ attr_accessor :transac_attributes
40
+
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'messages_sent' => :'messagesSent',
46
+ :'hard_bounces' => :'hardBounces',
47
+ :'soft_bounces' => :'softBounces',
48
+ :'complaints' => :'complaints',
49
+ :'unsubscriptions' => :'unsubscriptions',
50
+ :'opened' => :'opened',
51
+ :'clicked' => :'clicked',
52
+ :'transac_attributes' => :'transacAttributes'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.swagger_types
58
+ {
59
+ :'messages_sent' => :'Array<GetExtendedContactDetailsStatisticsMessagesSent>',
60
+ :'hard_bounces' => :'Array<GetExtendedContactDetailsStatisticsMessagesSent>',
61
+ :'soft_bounces' => :'Array<GetExtendedContactDetailsStatisticsMessagesSent>',
62
+ :'complaints' => :'Array<GetExtendedContactDetailsStatisticsMessagesSent>',
63
+ :'unsubscriptions' => :'GetExtendedContactDetailsStatisticsUnsubscriptions',
64
+ :'opened' => :'Array<GetExtendedContactDetailsStatisticsOpened>',
65
+ :'clicked' => :'Array<GetExtendedContactDetailsStatisticsClicked>',
66
+ :'transac_attributes' => :'Array<Object>'
67
+ }
68
+ end
69
+
70
+ # Initializes the object
71
+ # @param [Hash] attributes Model attributes in the form of hash
72
+ def initialize(attributes = {})
73
+ return unless attributes.is_a?(Hash)
74
+
75
+ # convert string to symbol for hash key
76
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
77
+
78
+ if attributes.has_key?(:'messagesSent')
79
+ if (value = attributes[:'messagesSent']).is_a?(Array)
80
+ self.messages_sent = value
81
+ end
82
+ end
83
+
84
+ if attributes.has_key?(:'hardBounces')
85
+ if (value = attributes[:'hardBounces']).is_a?(Array)
86
+ self.hard_bounces = value
87
+ end
88
+ end
89
+
90
+ if attributes.has_key?(:'softBounces')
91
+ if (value = attributes[:'softBounces']).is_a?(Array)
92
+ self.soft_bounces = value
93
+ end
94
+ end
95
+
96
+ if attributes.has_key?(:'complaints')
97
+ if (value = attributes[:'complaints']).is_a?(Array)
98
+ self.complaints = value
99
+ end
100
+ end
101
+
102
+ if attributes.has_key?(:'unsubscriptions')
103
+ self.unsubscriptions = attributes[:'unsubscriptions']
104
+ end
105
+
106
+ if attributes.has_key?(:'opened')
107
+ if (value = attributes[:'opened']).is_a?(Array)
108
+ self.opened = value
109
+ end
110
+ end
111
+
112
+ if attributes.has_key?(:'clicked')
113
+ if (value = attributes[:'clicked']).is_a?(Array)
114
+ self.clicked = value
115
+ end
116
+ end
117
+
118
+ if attributes.has_key?(:'transacAttributes')
119
+ if (value = attributes[:'transacAttributes']).is_a?(Array)
120
+ self.transac_attributes = value
121
+ end
122
+ end
123
+
124
+ end
125
+
126
+ # Show invalid properties with the reasons. Usually used together with valid?
127
+ # @return Array for valid properies with the reasons
128
+ def list_invalid_properties
129
+ invalid_properties = Array.new
130
+ return invalid_properties
131
+ end
132
+
133
+ # Check to see if the all the properties in the model are valid
134
+ # @return true if the model is valid
135
+ def valid?
136
+ return true
137
+ end
138
+
139
+ # Checks equality by comparing each attribute.
140
+ # @param [Object] Object to be compared
141
+ def ==(o)
142
+ return true if self.equal?(o)
143
+ self.class == o.class &&
144
+ messages_sent == o.messages_sent &&
145
+ hard_bounces == o.hard_bounces &&
146
+ soft_bounces == o.soft_bounces &&
147
+ complaints == o.complaints &&
148
+ unsubscriptions == o.unsubscriptions &&
149
+ opened == o.opened &&
150
+ clicked == o.clicked &&
151
+ transac_attributes == o.transac_attributes
152
+ end
153
+
154
+ # @see the `==` method
155
+ # @param [Object] Object to be compared
156
+ def eql?(o)
157
+ self == o
158
+ end
159
+
160
+ # Calculates hash code according to all attributes.
161
+ # @return [Fixnum] Hash code
162
+ def hash
163
+ [messages_sent, hard_bounces, soft_bounces, complaints, unsubscriptions, opened, clicked, transac_attributes].hash
164
+ end
165
+
166
+ # Builds the object from hash
167
+ # @param [Hash] attributes Model attributes in the form of hash
168
+ # @return [Object] Returns the model itself
169
+ def build_from_hash(attributes)
170
+ return nil unless attributes.is_a?(Hash)
171
+ self.class.swagger_types.each_pair do |key, type|
172
+ if type =~ /\AArray<(.*)>/i
173
+ # check to ensure the input is an array given that the the attribute
174
+ # is documented as an array but the input is not
175
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
176
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
177
+ end
178
+ elsif !attributes[self.class.attribute_map[key]].nil?
179
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
180
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
181
+ end
182
+
183
+ self
184
+ end
185
+
186
+ # Deserializes the data based on type
187
+ # @param string type Data type
188
+ # @param string value Value to be deserialized
189
+ # @return [Object] Deserialized data
190
+ def _deserialize(type, value)
191
+ case type.to_sym
192
+ when :DateTime
193
+ DateTime.parse(value)
194
+ when :Date
195
+ Date.parse(value)
196
+ when :String
197
+ value.to_s
198
+ when :Integer
199
+ value.to_i
200
+ when :Float
201
+ value.to_f
202
+ when :BOOLEAN
203
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
204
+ true
205
+ else
206
+ false
207
+ end
208
+ when :Object
209
+ # generic object (usually a Hash), return directly
210
+ value
211
+ when /\AArray<(?<inner_type>.+)>\z/
212
+ inner_type = Regexp.last_match[:inner_type]
213
+ value.map { |v| _deserialize(inner_type, v) }
214
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
215
+ k_type = Regexp.last_match[:k_type]
216
+ v_type = Regexp.last_match[:v_type]
217
+ {}.tap do |hash|
218
+ value.each do |k, v|
219
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
220
+ end
221
+ end
222
+ else # model
223
+ temp_model = SibApiV3Sdk.const_get(type).new
224
+ temp_model.build_from_hash(value)
225
+ end
226
+ end
227
+
228
+ # Returns the string representation of the object
229
+ # @return [String] String presentation of the object
230
+ def to_s
231
+ to_hash.to_s
232
+ end
233
+
234
+ # to_body is an alias to to_hash (backward compatibility)
235
+ # @return [Hash] Returns the object in the form of hash
236
+ def to_body
237
+ to_hash
238
+ end
239
+
240
+ # Returns the object in the form of hash
241
+ # @return [Hash] Returns the object in the form of hash
242
+ def to_hash
243
+ hash = {}
244
+ self.class.attribute_map.each_pair do |attr, param|
245
+ value = self.send(attr)
246
+ next if value.nil?
247
+ hash[param] = _to_hash(value)
248
+ end
249
+ hash
250
+ end
251
+
252
+ # Outputs non-array value in the form of hash
253
+ # For object, use to_hash. Otherwise, just return the value
254
+ # @param [Object] value Any valid value
255
+ # @return [Hash] Returns the value in the form of hash
256
+ def _to_hash(value)
257
+ if value.is_a?(Array)
258
+ value.compact.map{ |v| _to_hash(v) }
259
+ elsif value.is_a?(Hash)
260
+ {}.tap do |hash|
261
+ value.each { |k, v| hash[k] = _to_hash(v) }
262
+ end
263
+ elsif value.respond_to? :to_hash
264
+ value.to_hash
265
+ else
266
+ value
267
+ end
268
+ end
269
+
270
+ end
271
+
272
+ end