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
@@ -14,19 +14,19 @@ require 'date'
14
14
 
15
15
  module SibApiV3Sdk
16
16
 
17
- class GetContactCampaignStatsMessagesSent
17
+ class GetExtendedContactDetailsStatisticsClicked
18
18
  # ID of the campaign which generated the event
19
19
  attr_accessor :campaign_id
20
20
 
21
- # Date of the event
22
- attr_accessor :event_time
21
+ # Listing of the clicked links for the campaign
22
+ attr_accessor :links
23
23
 
24
24
 
25
25
  # Attribute mapping from ruby-style variable name to JSON key.
26
26
  def self.attribute_map
27
27
  {
28
28
  :'campaign_id' => :'campaignId',
29
- :'event_time' => :'eventTime'
29
+ :'links' => :'links'
30
30
  }
31
31
  end
32
32
 
@@ -34,7 +34,7 @@ module SibApiV3Sdk
34
34
  def self.swagger_types
35
35
  {
36
36
  :'campaign_id' => :'Integer',
37
- :'event_time' => :'DateTime'
37
+ :'links' => :'Array<GetExtendedContactDetailsStatisticsLinks>'
38
38
  }
39
39
  end
40
40
 
@@ -50,8 +50,10 @@ module SibApiV3Sdk
50
50
  self.campaign_id = attributes[:'campaignId']
51
51
  end
52
52
 
53
- if attributes.has_key?(:'eventTime')
54
- self.event_time = attributes[:'eventTime']
53
+ if attributes.has_key?(:'links')
54
+ if (value = attributes[:'links']).is_a?(Array)
55
+ self.links = value
56
+ end
55
57
  end
56
58
 
57
59
  end
@@ -64,8 +66,8 @@ module SibApiV3Sdk
64
66
  invalid_properties.push("invalid value for 'campaign_id', campaign_id cannot be nil.")
65
67
  end
66
68
 
67
- if @event_time.nil?
68
- invalid_properties.push("invalid value for 'event_time', event_time cannot be nil.")
69
+ if @links.nil?
70
+ invalid_properties.push("invalid value for 'links', links cannot be nil.")
69
71
  end
70
72
 
71
73
  return invalid_properties
@@ -75,7 +77,7 @@ module SibApiV3Sdk
75
77
  # @return true if the model is valid
76
78
  def valid?
77
79
  return false if @campaign_id.nil?
78
- return false if @event_time.nil?
80
+ return false if @links.nil?
79
81
  return true
80
82
  end
81
83
 
@@ -85,7 +87,7 @@ module SibApiV3Sdk
85
87
  return true if self.equal?(o)
86
88
  self.class == o.class &&
87
89
  campaign_id == o.campaign_id &&
88
- event_time == o.event_time
90
+ links == o.links
89
91
  end
90
92
 
91
93
  # @see the `==` method
@@ -97,7 +99,7 @@ module SibApiV3Sdk
97
99
  # Calculates hash code according to all attributes.
98
100
  # @return [Fixnum] Hash code
99
101
  def hash
100
- [campaign_id, event_time].hash
102
+ [campaign_id, links].hash
101
103
  end
102
104
 
103
105
  # Builds the object from hash
@@ -14,7 +14,7 @@ require 'date'
14
14
 
15
15
  module SibApiV3Sdk
16
16
 
17
- class GetContactCampaignStatsLinks
17
+ class GetExtendedContactDetailsStatisticsLinks
18
18
  # Number of clicks on this link for the campaign
19
19
  attr_accessor :count
20
20
 
@@ -42,7 +42,7 @@ module SibApiV3Sdk
42
42
  def self.swagger_types
43
43
  {
44
44
  :'count' => :'Integer',
45
- :'event_time' => :'DateTime',
45
+ :'event_time' => :'String',
46
46
  :'ip' => :'String',
47
47
  :'url' => :'String'
48
48
  }
@@ -86,6 +86,10 @@ module SibApiV3Sdk
86
86
  invalid_properties.push("invalid value for 'event_time', event_time cannot be nil.")
87
87
  end
88
88
 
89
+ if @event_time !~ Regexp.new(/^([1-9]\d{3}-\d{2}-\d{2} [0-2]\d:[0-5]\d:[0-5]\d)?$/)
90
+ invalid_properties.push("invalid value for 'event_time', must conform to the pattern /^([1-9]\d{3}-\d{2}-\d{2} [0-2]\d:[0-5]\d:[0-5]\d)?$/.")
91
+ end
92
+
89
93
  if @ip.nil?
90
94
  invalid_properties.push("invalid value for 'ip', ip cannot be nil.")
91
95
  end
@@ -102,11 +106,26 @@ module SibApiV3Sdk
102
106
  def valid?
103
107
  return false if @count.nil?
104
108
  return false if @event_time.nil?
109
+ return false if @event_time !~ Regexp.new(/^([1-9]\d{3}-\d{2}-\d{2} [0-2]\d:[0-5]\d:[0-5]\d)?$/)
105
110
  return false if @ip.nil?
106
111
  return false if @url.nil?
107
112
  return true
108
113
  end
109
114
 
115
+ # Custom attribute writer method with validation
116
+ # @param [Object] event_time Value to be assigned
117
+ def event_time=(event_time)
118
+ if event_time.nil?
119
+ fail ArgumentError, "event_time cannot be nil"
120
+ end
121
+
122
+ if event_time !~ Regexp.new(/^([1-9]\d{3}-\d{2}-\d{2} [0-2]\d:[0-5]\d:[0-5]\d)?$/)
123
+ fail ArgumentError, "invalid value for 'event_time', must conform to the pattern /^([1-9]\d{3}-\d{2}-\d{2} [0-2]\d:[0-5]\d:[0-5]\d)?$/."
124
+ end
125
+
126
+ @event_time = event_time
127
+ end
128
+
110
129
  # Checks equality by comparing each attribute.
111
130
  # @param [Object] Object to be compared
112
131
  def ==(o)
@@ -0,0 +1,228 @@
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
+
17
+ class GetExtendedContactDetailsStatisticsMessagesSent
18
+ # ID of the campaign which generated the event
19
+ attr_accessor :campaign_id
20
+
21
+ # Date of the event
22
+ attr_accessor :event_time
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'campaign_id' => :'campaignId',
29
+ :'event_time' => :'eventTime'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'campaign_id' => :'Integer',
37
+ :'event_time' => :'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?(:'campaignId')
50
+ self.campaign_id = attributes[:'campaignId']
51
+ end
52
+
53
+ if attributes.has_key?(:'eventTime')
54
+ self.event_time = attributes[:'eventTime']
55
+ end
56
+
57
+ end
58
+
59
+ # Show invalid properties with the reasons. Usually used together with valid?
60
+ # @return Array for valid properies with the reasons
61
+ def list_invalid_properties
62
+ invalid_properties = Array.new
63
+ if @campaign_id.nil?
64
+ invalid_properties.push("invalid value for 'campaign_id', campaign_id cannot be nil.")
65
+ end
66
+
67
+ if @event_time.nil?
68
+ invalid_properties.push("invalid value for 'event_time', event_time cannot be nil.")
69
+ end
70
+
71
+ if @event_time !~ Regexp.new(/^([1-9]\d{3}-\d{2}-\d{2} [0-2]\d:[0-5]\d:[0-5]\d)?$/)
72
+ invalid_properties.push("invalid value for 'event_time', must conform to the pattern /^([1-9]\d{3}-\d{2}-\d{2} [0-2]\d:[0-5]\d:[0-5]\d)?$/.")
73
+ end
74
+
75
+ return invalid_properties
76
+ end
77
+
78
+ # Check to see if the all the properties in the model are valid
79
+ # @return true if the model is valid
80
+ def valid?
81
+ return false if @campaign_id.nil?
82
+ return false if @event_time.nil?
83
+ return false if @event_time !~ Regexp.new(/^([1-9]\d{3}-\d{2}-\d{2} [0-2]\d:[0-5]\d:[0-5]\d)?$/)
84
+ return true
85
+ end
86
+
87
+ # Custom attribute writer method with validation
88
+ # @param [Object] event_time Value to be assigned
89
+ def event_time=(event_time)
90
+ if event_time.nil?
91
+ fail ArgumentError, "event_time cannot be nil"
92
+ end
93
+
94
+ if event_time !~ Regexp.new(/^([1-9]\d{3}-\d{2}-\d{2} [0-2]\d:[0-5]\d:[0-5]\d)?$/)
95
+ fail ArgumentError, "invalid value for 'event_time', must conform to the pattern /^([1-9]\d{3}-\d{2}-\d{2} [0-2]\d:[0-5]\d:[0-5]\d)?$/."
96
+ end
97
+
98
+ @event_time = event_time
99
+ end
100
+
101
+ # Checks equality by comparing each attribute.
102
+ # @param [Object] Object to be compared
103
+ def ==(o)
104
+ return true if self.equal?(o)
105
+ self.class == o.class &&
106
+ campaign_id == o.campaign_id &&
107
+ event_time == o.event_time
108
+ end
109
+
110
+ # @see the `==` method
111
+ # @param [Object] Object to be compared
112
+ def eql?(o)
113
+ self == o
114
+ end
115
+
116
+ # Calculates hash code according to all attributes.
117
+ # @return [Fixnum] Hash code
118
+ def hash
119
+ [campaign_id, event_time].hash
120
+ end
121
+
122
+ # Builds the object from hash
123
+ # @param [Hash] attributes Model attributes in the form of hash
124
+ # @return [Object] Returns the model itself
125
+ def build_from_hash(attributes)
126
+ return nil unless attributes.is_a?(Hash)
127
+ self.class.swagger_types.each_pair do |key, type|
128
+ if type =~ /\AArray<(.*)>/i
129
+ # check to ensure the input is an array given that the the attribute
130
+ # is documented as an array but the input is not
131
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
132
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
133
+ end
134
+ elsif !attributes[self.class.attribute_map[key]].nil?
135
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
136
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
137
+ end
138
+
139
+ self
140
+ end
141
+
142
+ # Deserializes the data based on type
143
+ # @param string type Data type
144
+ # @param string value Value to be deserialized
145
+ # @return [Object] Deserialized data
146
+ def _deserialize(type, value)
147
+ case type.to_sym
148
+ when :DateTime
149
+ DateTime.parse(value)
150
+ when :Date
151
+ Date.parse(value)
152
+ when :String
153
+ value.to_s
154
+ when :Integer
155
+ value.to_i
156
+ when :Float
157
+ value.to_f
158
+ when :BOOLEAN
159
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
160
+ true
161
+ else
162
+ false
163
+ end
164
+ when :Object
165
+ # generic object (usually a Hash), return directly
166
+ value
167
+ when /\AArray<(?<inner_type>.+)>\z/
168
+ inner_type = Regexp.last_match[:inner_type]
169
+ value.map { |v| _deserialize(inner_type, v) }
170
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
171
+ k_type = Regexp.last_match[:k_type]
172
+ v_type = Regexp.last_match[:v_type]
173
+ {}.tap do |hash|
174
+ value.each do |k, v|
175
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
176
+ end
177
+ end
178
+ else # model
179
+ temp_model = SibApiV3Sdk.const_get(type).new
180
+ temp_model.build_from_hash(value)
181
+ end
182
+ end
183
+
184
+ # Returns the string representation of the object
185
+ # @return [String] String presentation of the object
186
+ def to_s
187
+ to_hash.to_s
188
+ end
189
+
190
+ # to_body is an alias to to_hash (backward compatibility)
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_body
193
+ to_hash
194
+ end
195
+
196
+ # Returns the object in the form of hash
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_hash
199
+ hash = {}
200
+ self.class.attribute_map.each_pair do |attr, param|
201
+ value = self.send(attr)
202
+ next if value.nil?
203
+ hash[param] = _to_hash(value)
204
+ end
205
+ hash
206
+ end
207
+
208
+ # Outputs non-array value in the form of hash
209
+ # For object, use to_hash. Otherwise, just return the value
210
+ # @param [Object] value Any valid value
211
+ # @return [Hash] Returns the value in the form of hash
212
+ def _to_hash(value)
213
+ if value.is_a?(Array)
214
+ value.compact.map{ |v| _to_hash(v) }
215
+ elsif value.is_a?(Hash)
216
+ {}.tap do |hash|
217
+ value.each { |k, v| hash[k] = _to_hash(v) }
218
+ end
219
+ elsif value.respond_to? :to_hash
220
+ value.to_hash
221
+ else
222
+ value
223
+ end
224
+ end
225
+
226
+ end
227
+
228
+ end
@@ -0,0 +1,258 @@
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
+
17
+ class GetExtendedContactDetailsStatisticsOpened
18
+ # ID of the campaign which generated the event
19
+ attr_accessor :campaign_id
20
+
21
+ # Number of openings for the campaign
22
+ attr_accessor :count
23
+
24
+ # Date of the event
25
+ attr_accessor :event_time
26
+
27
+ # IP from which the user has opened the email
28
+ attr_accessor :ip
29
+
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'campaign_id' => :'campaignId',
35
+ :'count' => :'count',
36
+ :'event_time' => :'eventTime',
37
+ :'ip' => :'ip'
38
+ }
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.swagger_types
43
+ {
44
+ :'campaign_id' => :'Integer',
45
+ :'count' => :'Integer',
46
+ :'event_time' => :'String',
47
+ :'ip' => :'String'
48
+ }
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ return unless attributes.is_a?(Hash)
55
+
56
+ # convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
58
+
59
+ if attributes.has_key?(:'campaignId')
60
+ self.campaign_id = attributes[:'campaignId']
61
+ end
62
+
63
+ if attributes.has_key?(:'count')
64
+ self.count = attributes[:'count']
65
+ end
66
+
67
+ if attributes.has_key?(:'eventTime')
68
+ self.event_time = attributes[:'eventTime']
69
+ end
70
+
71
+ if attributes.has_key?(:'ip')
72
+ self.ip = attributes[:'ip']
73
+ end
74
+
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properies with the reasons
79
+ def list_invalid_properties
80
+ invalid_properties = Array.new
81
+ if @campaign_id.nil?
82
+ invalid_properties.push("invalid value for 'campaign_id', campaign_id cannot be nil.")
83
+ end
84
+
85
+ if @count.nil?
86
+ invalid_properties.push("invalid value for 'count', count cannot be nil.")
87
+ end
88
+
89
+ if @event_time.nil?
90
+ invalid_properties.push("invalid value for 'event_time', event_time cannot be nil.")
91
+ end
92
+
93
+ if @event_time !~ Regexp.new(/^([1-9]\d{3}-\d{2}-\d{2} [0-2]\d:[0-5]\d:[0-5]\d)?$/)
94
+ invalid_properties.push("invalid value for 'event_time', must conform to the pattern /^([1-9]\d{3}-\d{2}-\d{2} [0-2]\d:[0-5]\d:[0-5]\d)?$/.")
95
+ end
96
+
97
+ if @ip.nil?
98
+ invalid_properties.push("invalid value for 'ip', ip cannot be nil.")
99
+ end
100
+
101
+ return invalid_properties
102
+ end
103
+
104
+ # Check to see if the all the properties in the model are valid
105
+ # @return true if the model is valid
106
+ def valid?
107
+ return false if @campaign_id.nil?
108
+ return false if @count.nil?
109
+ return false if @event_time.nil?
110
+ return false if @event_time !~ Regexp.new(/^([1-9]\d{3}-\d{2}-\d{2} [0-2]\d:[0-5]\d:[0-5]\d)?$/)
111
+ return false if @ip.nil?
112
+ return true
113
+ end
114
+
115
+ # Custom attribute writer method with validation
116
+ # @param [Object] event_time Value to be assigned
117
+ def event_time=(event_time)
118
+ if event_time.nil?
119
+ fail ArgumentError, "event_time cannot be nil"
120
+ end
121
+
122
+ if event_time !~ Regexp.new(/^([1-9]\d{3}-\d{2}-\d{2} [0-2]\d:[0-5]\d:[0-5]\d)?$/)
123
+ fail ArgumentError, "invalid value for 'event_time', must conform to the pattern /^([1-9]\d{3}-\d{2}-\d{2} [0-2]\d:[0-5]\d:[0-5]\d)?$/."
124
+ end
125
+
126
+ @event_time = event_time
127
+ end
128
+
129
+ # Checks equality by comparing each attribute.
130
+ # @param [Object] Object to be compared
131
+ def ==(o)
132
+ return true if self.equal?(o)
133
+ self.class == o.class &&
134
+ campaign_id == o.campaign_id &&
135
+ count == o.count &&
136
+ event_time == o.event_time &&
137
+ ip == o.ip
138
+ end
139
+
140
+ # @see the `==` method
141
+ # @param [Object] Object to be compared
142
+ def eql?(o)
143
+ self == o
144
+ end
145
+
146
+ # Calculates hash code according to all attributes.
147
+ # @return [Fixnum] Hash code
148
+ def hash
149
+ [campaign_id, count, event_time, ip].hash
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def build_from_hash(attributes)
156
+ return nil unless attributes.is_a?(Hash)
157
+ self.class.swagger_types.each_pair do |key, type|
158
+ if type =~ /\AArray<(.*)>/i
159
+ # check to ensure the input is an array given that the the attribute
160
+ # is documented as an array but the input is not
161
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
162
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
163
+ end
164
+ elsif !attributes[self.class.attribute_map[key]].nil?
165
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
166
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
167
+ end
168
+
169
+ self
170
+ end
171
+
172
+ # Deserializes the data based on type
173
+ # @param string type Data type
174
+ # @param string value Value to be deserialized
175
+ # @return [Object] Deserialized data
176
+ def _deserialize(type, value)
177
+ case type.to_sym
178
+ when :DateTime
179
+ DateTime.parse(value)
180
+ when :Date
181
+ Date.parse(value)
182
+ when :String
183
+ value.to_s
184
+ when :Integer
185
+ value.to_i
186
+ when :Float
187
+ value.to_f
188
+ when :BOOLEAN
189
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
190
+ true
191
+ else
192
+ false
193
+ end
194
+ when :Object
195
+ # generic object (usually a Hash), return directly
196
+ value
197
+ when /\AArray<(?<inner_type>.+)>\z/
198
+ inner_type = Regexp.last_match[:inner_type]
199
+ value.map { |v| _deserialize(inner_type, v) }
200
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
201
+ k_type = Regexp.last_match[:k_type]
202
+ v_type = Regexp.last_match[:v_type]
203
+ {}.tap do |hash|
204
+ value.each do |k, v|
205
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
206
+ end
207
+ end
208
+ else # model
209
+ temp_model = SibApiV3Sdk.const_get(type).new
210
+ temp_model.build_from_hash(value)
211
+ end
212
+ end
213
+
214
+ # Returns the string representation of the object
215
+ # @return [String] String presentation of the object
216
+ def to_s
217
+ to_hash.to_s
218
+ end
219
+
220
+ # to_body is an alias to to_hash (backward compatibility)
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_body
223
+ to_hash
224
+ end
225
+
226
+ # Returns the object in the form of hash
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_hash
229
+ hash = {}
230
+ self.class.attribute_map.each_pair do |attr, param|
231
+ value = self.send(attr)
232
+ next if value.nil?
233
+ hash[param] = _to_hash(value)
234
+ end
235
+ hash
236
+ end
237
+
238
+ # Outputs non-array value in the form of hash
239
+ # For object, use to_hash. Otherwise, just return the value
240
+ # @param [Object] value Any valid value
241
+ # @return [Hash] Returns the value in the form of hash
242
+ def _to_hash(value)
243
+ if value.is_a?(Array)
244
+ value.compact.map{ |v| _to_hash(v) }
245
+ elsif value.is_a?(Hash)
246
+ {}.tap do |hash|
247
+ value.each { |k, v| hash[k] = _to_hash(v) }
248
+ end
249
+ elsif value.respond_to? :to_hash
250
+ value.to_hash
251
+ else
252
+ value
253
+ end
254
+ end
255
+
256
+ end
257
+
258
+ end