brevo 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (263) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +56 -4
  3. data/docs/Body.md +2 -3
  4. data/docs/Body1.md +2 -3
  5. data/docs/Body10.md +10 -4
  6. data/docs/Body11.md +6 -1
  7. data/docs/Body12.md +1 -4
  8. data/docs/Body13.md +11 -0
  9. data/docs/Body14.md +8 -0
  10. data/docs/Body15.md +11 -0
  11. data/docs/Body2.md +1 -4
  12. data/docs/Body3.md +3 -2
  13. data/docs/Body4.md +3 -2
  14. data/docs/Body5.md +4 -4
  15. data/docs/Body6.md +2 -11
  16. data/docs/Body7.md +2 -10
  17. data/docs/Body8.md +4 -6
  18. data/docs/Body9.md +11 -1
  19. data/docs/CompaniesApi.md +8 -8
  20. data/docs/ContactsApi.md +14 -4
  21. data/docs/ConversationsApi.md +10 -10
  22. data/docs/ConversionSourceMetrics.md +12 -0
  23. data/docs/ConversionSourceProduct.md +15 -0
  24. data/docs/CorporateGroupDetailsResponse.md +10 -0
  25. data/docs/CorporateGroupDetailsResponseGroup.md +10 -0
  26. data/docs/CorporateGroupDetailsResponseSubaccounts.md +10 -0
  27. data/docs/CorporateGroupDetailsResponseUsers.md +10 -0
  28. data/docs/CouponsApi.md +12 -9
  29. data/docs/CreateContact.md +1 -1
  30. data/docs/CreateCouponCollection.md +5 -2
  31. data/docs/CreateDomainModel.md +1 -0
  32. data/docs/CreateDomainModelDnsRecords.md +1 -0
  33. data/docs/CreateWebhook.md +3 -0
  34. data/docs/CreateWhatsAppTemplate.md +1 -0
  35. data/docs/DealsApi.md +10 -10
  36. data/docs/EcommerceApi.md +261 -2
  37. data/docs/EmailCampaignsApi.md +1 -3
  38. data/docs/Event.md +12 -0
  39. data/docs/EventIdentifiers.md +12 -0
  40. data/docs/EventsApi.md +67 -0
  41. data/docs/ExportWebhooksHistory.md +2 -1
  42. data/docs/ExternalFeedsApi.md +2 -2
  43. data/docs/GetContactDetails.md +1 -1
  44. data/docs/GetCorporateInvitedUsersList.md +8 -0
  45. data/docs/GetCorporateInvitedUsersListFeatureAccess.md +11 -0
  46. data/docs/GetCorporateInvitedUsersListGroups.md +9 -0
  47. data/docs/GetCorporateInvitedUsersListUsers.md +12 -0
  48. data/docs/GetCorporateUserPermission.md +11 -0
  49. data/docs/GetCorporateUserPermissionFeatureAccess.md +11 -0
  50. data/docs/GetCorporateUserPermissionGroups.md +9 -0
  51. data/docs/GetCouponCollection.md +9 -6
  52. data/docs/GetExtendedContactDetails.md +1 -1
  53. data/docs/GetOrders.md +9 -0
  54. data/docs/GetWebhook.md +3 -0
  55. data/docs/GetWebhookAuth.md +9 -0
  56. data/docs/GetWebhookHeaders.md +9 -0
  57. data/docs/InlineResponse200.md +1 -1
  58. data/docs/InlineResponse2001.md +2 -3
  59. data/docs/InlineResponse2002.md +8 -0
  60. data/docs/InlineResponse2003.md +10 -0
  61. data/docs/InlineResponse201.md +1 -1
  62. data/docs/InlineResponse2011.md +1 -1
  63. data/docs/InlineResponse2012.md +1 -1
  64. data/docs/InlineResponse2013.md +1 -1
  65. data/docs/InlineResponse2014.md +1 -1
  66. data/docs/InlineResponse2015.md +8 -0
  67. data/docs/InviteAdminUser.md +11 -0
  68. data/docs/InviteAdminUserPrivileges.md +9 -0
  69. data/docs/Inviteuser.md +10 -0
  70. data/docs/InviteuserPrivileges.md +9 -0
  71. data/docs/MasterAccountApi.md +828 -117
  72. data/docs/MasterDetailsResponsePlanInfoFeatures.md +2 -0
  73. data/docs/OrderBatch.md +1 -0
  74. data/docs/PutRevokeUserPermission.md +8 -0
  75. data/docs/Putresendcancelinvitation.md +8 -0
  76. data/docs/RequestContactImport.md +1 -0
  77. data/docs/SendSmtpEmail.md +18 -19
  78. data/docs/SendSmtpEmailMessageVersions.md +2 -0
  79. data/docs/SendWhatsappMessage.md +1 -0
  80. data/docs/SsoTokenRequestCorporate.md +8 -0
  81. data/docs/SubAccountAppsToggleRequest.md +1 -1
  82. data/docs/SubAccountUpdatePlanRequestFeatures.md +2 -2
  83. data/docs/TasksApi.md +8 -8
  84. data/docs/TransactionalEmailsApi.md +7 -7
  85. data/docs/TransactionalWhatsAppApi.md +2 -2
  86. data/docs/UpdateContact.md +1 -1
  87. data/docs/UpdateCouponCollection.md +4 -1
  88. data/docs/UpdateWebhook.md +3 -0
  89. data/docs/UserApi.md +239 -0
  90. data/docs/WebhooksApi.md +4 -4
  91. data/docs/WhatsAppCampaignsApi.md +3 -1
  92. data/lib/brevo/api/companies_api.rb +3 -3
  93. data/lib/brevo/api/contacts_api.rb +14 -2
  94. data/lib/brevo/api/conversations_api.rb +2 -2
  95. data/lib/brevo/api/coupons_api.rb +15 -16
  96. data/lib/brevo/api/deals_api.rb +5 -5
  97. data/lib/brevo/api/ecommerce_api.rb +250 -0
  98. data/lib/brevo/api/email_campaigns_api.rb +0 -3
  99. data/lib/brevo/api/events_api.rb +86 -0
  100. data/lib/brevo/api/external_feeds_api.rb +3 -3
  101. data/lib/brevo/api/master_account_api.rb +652 -4
  102. data/lib/brevo/api/tasks_api.rb +5 -5
  103. data/lib/brevo/api/transactional_emails_api.rb +11 -11
  104. data/lib/brevo/api/transactional_whats_app_api.rb +3 -3
  105. data/lib/brevo/api/user_api.rb +222 -0
  106. data/lib/brevo/api/webhooks_api.rb +4 -4
  107. data/lib/brevo/api/whats_app_campaigns_api.rb +6 -0
  108. data/lib/brevo/models/body.rb +20 -28
  109. data/lib/brevo/models/body_1.rb +22 -25
  110. data/lib/brevo/models/body_10.rb +95 -39
  111. data/lib/brevo/models/body_11.rb +60 -5
  112. data/lib/brevo/models/body_12.rb +13 -38
  113. data/lib/brevo/models/body_13.rb +225 -0
  114. data/lib/brevo/models/body_14.rb +190 -0
  115. data/lib/brevo/models/body_15.rb +215 -0
  116. data/lib/brevo/models/body_2.rb +14 -45
  117. data/lib/brevo/models/body_3.rb +16 -6
  118. data/lib/brevo/models/body_4.rb +16 -6
  119. data/lib/brevo/models/body_5.rb +19 -19
  120. data/lib/brevo/models/body_6.rb +9 -129
  121. data/lib/brevo/models/body_7.rb +9 -95
  122. data/lib/brevo/models/body_8.rb +37 -59
  123. data/lib/brevo/models/body_9.rb +141 -11
  124. data/lib/brevo/models/conversion_source_metrics.rb +279 -0
  125. data/lib/brevo/models/conversion_source_product.rb +252 -0
  126. data/lib/brevo/models/corporate_group_details_response.rb +206 -0
  127. data/lib/brevo/models/corporate_group_details_response_group.rb +205 -0
  128. data/lib/brevo/models/corporate_group_details_response_subaccounts.rb +205 -0
  129. data/lib/brevo/models/corporate_group_details_response_users.rb +205 -0
  130. data/lib/brevo/models/create_contact.rb +1 -1
  131. data/lib/brevo/models/create_coupon_collection.rb +37 -7
  132. data/lib/brevo/models/create_domain_model.rb +11 -1
  133. data/lib/brevo/models/create_domain_model_dns_records.rb +13 -4
  134. data/lib/brevo/models/create_webhook.rb +35 -4
  135. data/lib/brevo/models/create_whats_app_template.rb +28 -6
  136. data/lib/brevo/models/event.rb +234 -0
  137. data/lib/brevo/models/event_identifiers.rb +236 -0
  138. data/lib/brevo/models/export_webhooks_history.rb +31 -4
  139. data/lib/brevo/models/get_contact_details.rb +0 -5
  140. data/lib/brevo/models/get_corporate_invited_users_list.rb +187 -0
  141. data/lib/brevo/models/get_corporate_invited_users_list_feature_access.rb +224 -0
  142. data/lib/brevo/models/get_corporate_invited_users_list_groups.rb +196 -0
  143. data/lib/brevo/models/get_corporate_invited_users_list_users.rb +248 -0
  144. data/lib/brevo/models/get_corporate_user_permission.rb +236 -0
  145. data/lib/brevo/models/get_corporate_user_permission_feature_access.rb +224 -0
  146. data/lib/brevo/models/get_corporate_user_permission_groups.rb +196 -0
  147. data/lib/brevo/models/get_coupon_collection.rb +40 -10
  148. data/lib/brevo/models/get_extended_contact_details.rb +0 -5
  149. data/lib/brevo/models/get_orders.rb +196 -0
  150. data/lib/brevo/models/get_webhook.rb +35 -4
  151. data/lib/brevo/models/get_webhook_auth.rb +196 -0
  152. data/lib/brevo/models/get_webhook_headers.rb +195 -0
  153. data/lib/brevo/models/inline_response_200.rb +7 -14
  154. data/lib/brevo/models/inline_response_200_1.rb +9 -34
  155. data/lib/brevo/models/inline_response_200_2.rb +191 -0
  156. data/lib/brevo/models/inline_response_200_3.rb +215 -0
  157. data/lib/brevo/models/inline_response_201.rb +0 -7
  158. data/lib/brevo/models/inline_response_201_1.rb +2 -2
  159. data/lib/brevo/models/inline_response_201_2.rb +2 -1
  160. data/lib/brevo/models/inline_response_201_3.rb +11 -11
  161. data/lib/brevo/models/inline_response_201_4.rb +11 -11
  162. data/lib/brevo/models/inline_response_201_5.rb +190 -0
  163. data/lib/brevo/models/invite_admin_user.rb +233 -0
  164. data/lib/brevo/models/invite_admin_user_privileges.rb +232 -0
  165. data/lib/brevo/models/inviteuser.rb +221 -0
  166. data/lib/brevo/models/inviteuser_privileges.rb +232 -0
  167. data/lib/brevo/models/master_details_response_plan_info_features.rb +21 -1
  168. data/lib/brevo/models/order_batch.rb +16 -4
  169. data/lib/brevo/models/put_revoke_user_permission.rb +191 -0
  170. data/lib/brevo/models/putresendcancelinvitation.rb +191 -0
  171. data/lib/brevo/models/request_contact_import.rb +13 -1
  172. data/lib/brevo/models/send_smtp_email_message_versions.rb +24 -4
  173. data/lib/brevo/models/send_whatsapp_message.rb +11 -1
  174. data/lib/brevo/models/sso_token_request_corporate.rb +190 -0
  175. data/lib/brevo/models/sub_account_apps_toggle_request.rb +1 -1
  176. data/lib/brevo/models/sub_account_details_response_plan_info_features_inbox.rb +1 -1
  177. data/lib/brevo/models/sub_account_details_response_plan_info_features_landing_page.rb +1 -1
  178. data/lib/brevo/models/sub_account_update_plan_request_features.rb +2 -2
  179. data/lib/brevo/models/update_contact.rb +1 -1
  180. data/lib/brevo/models/update_coupon_collection.rb +34 -9
  181. data/lib/brevo/models/update_webhook.rb +35 -4
  182. data/lib/brevo/version.rb +1 -1
  183. data/lib/brevo.rb +32 -0
  184. data/spec/api/companies_api_spec.rb +1 -1
  185. data/spec/api/contacts_api_spec.rb +5 -1
  186. data/spec/api/conversations_api_spec.rb +1 -1
  187. data/spec/api/coupons_api_spec.rb +4 -3
  188. data/spec/api/deals_api_spec.rb +2 -2
  189. data/spec/api/ecommerce_api_spec.rb +57 -0
  190. data/spec/api/email_campaigns_api_spec.rb +0 -1
  191. data/spec/api/events_api_spec.rb +47 -0
  192. data/spec/api/external_feeds_api_spec.rb +1 -1
  193. data/spec/api/master_account_api_spec.rb +145 -1
  194. data/spec/api/tasks_api_spec.rb +2 -2
  195. data/spec/api/transactional_emails_api_spec.rb +3 -3
  196. data/spec/api/transactional_whats_app_api_spec.rb +1 -1
  197. data/spec/api/user_api_spec.rb +47 -0
  198. data/spec/api/webhooks_api_spec.rb +2 -2
  199. data/spec/api/whats_app_campaigns_api_spec.rb +1 -0
  200. data/spec/models/body_10_spec.rb +40 -4
  201. data/spec/models/body_11_spec.rb +30 -0
  202. data/spec/models/body_12_spec.rb +1 -19
  203. data/spec/models/body_13_spec.rb +59 -0
  204. data/spec/models/body_14_spec.rb +41 -0
  205. data/spec/models/body_15_spec.rb +59 -0
  206. data/spec/models/body_1_spec.rb +2 -8
  207. data/spec/models/body_2_spec.rb +1 -19
  208. data/spec/models/body_3_spec.rb +6 -0
  209. data/spec/models/body_4_spec.rb +6 -0
  210. data/spec/models/body_5_spec.rb +2 -2
  211. data/spec/models/body_6_spec.rb +1 -55
  212. data/spec/models/body_7_spec.rb +1 -49
  213. data/spec/models/body_8_spec.rb +4 -16
  214. data/spec/models/body_9_spec.rb +61 -1
  215. data/spec/models/body_spec.rb +2 -8
  216. data/spec/models/conversion_source_metrics_spec.rb +69 -0
  217. data/spec/models/conversion_source_product_spec.rb +83 -0
  218. data/spec/models/corporate_group_details_response_group_spec.rb +53 -0
  219. data/spec/models/corporate_group_details_response_spec.rb +53 -0
  220. data/spec/models/corporate_group_details_response_subaccounts_spec.rb +53 -0
  221. data/spec/models/corporate_group_details_response_users_spec.rb +53 -0
  222. data/spec/models/create_coupon_collection_spec.rb +18 -0
  223. data/spec/models/create_domain_model_dns_records_spec.rb +6 -0
  224. data/spec/models/create_domain_model_spec.rb +6 -0
  225. data/spec/models/create_webhook_spec.rb +18 -0
  226. data/spec/models/create_whats_app_template_spec.rb +11 -1
  227. data/spec/models/event_identifiers_spec.rb +65 -0
  228. data/spec/models/event_spec.rb +65 -0
  229. data/spec/models/export_webhooks_history_spec.rb +11 -1
  230. data/spec/models/get_corporate_invited_users_list_feature_access_spec.rb +59 -0
  231. data/spec/models/get_corporate_invited_users_list_groups_spec.rb +47 -0
  232. data/spec/models/get_corporate_invited_users_list_spec.rb +41 -0
  233. data/spec/models/get_corporate_invited_users_list_users_spec.rb +65 -0
  234. data/spec/models/get_corporate_user_permission_feature_access_spec.rb +59 -0
  235. data/spec/models/get_corporate_user_permission_groups_spec.rb +47 -0
  236. data/spec/models/get_corporate_user_permission_spec.rb +59 -0
  237. data/spec/models/get_coupon_collection_spec.rb +18 -0
  238. data/spec/models/get_orders_spec.rb +47 -0
  239. data/spec/models/get_webhook_auth_spec.rb +47 -0
  240. data/spec/models/get_webhook_headers_spec.rb +47 -0
  241. data/spec/models/get_webhook_spec.rb +18 -0
  242. data/spec/models/inline_response_200_1_spec.rb +1 -7
  243. data/spec/models/inline_response_200_2_spec.rb +41 -0
  244. data/spec/models/inline_response_200_3_spec.rb +53 -0
  245. data/spec/models/inline_response_200_spec.rb +1 -1
  246. data/spec/models/inline_response_201_3_spec.rb +1 -1
  247. data/spec/models/inline_response_201_4_spec.rb +1 -1
  248. data/spec/models/inline_response_201_5_spec.rb +41 -0
  249. data/spec/models/invite_admin_user_privileges_spec.rb +55 -0
  250. data/spec/models/invite_admin_user_spec.rb +59 -0
  251. data/spec/models/inviteuser_privileges_spec.rb +55 -0
  252. data/spec/models/inviteuser_spec.rb +53 -0
  253. data/spec/models/master_details_response_plan_info_features_spec.rb +12 -0
  254. data/spec/models/order_batch_spec.rb +6 -0
  255. data/spec/models/put_revoke_user_permission_spec.rb +41 -0
  256. data/spec/models/putresendcancelinvitation_spec.rb +41 -0
  257. data/spec/models/request_contact_import_spec.rb +6 -0
  258. data/spec/models/send_smtp_email_message_versions_spec.rb +12 -0
  259. data/spec/models/send_whatsapp_message_spec.rb +6 -0
  260. data/spec/models/sso_token_request_corporate_spec.rb +41 -0
  261. data/spec/models/update_coupon_collection_spec.rb +18 -0
  262. data/spec/models/update_webhook_spec.rb +18 -0
  263. metadata +152 -24
@@ -32,6 +32,9 @@ module Brevo
32
32
  # Text content of the header in the template. **Maximum allowed characters are 45** **Use this field to add text content in template header and if mediaUrl is empty**
33
33
  attr_accessor :header_text
34
34
 
35
+ # source of the template
36
+ attr_accessor :source
37
+
35
38
  class EnumAttributeValidator
36
39
  attr_reader :datatype
37
40
  attr_reader :allowable_values
@@ -62,7 +65,8 @@ module Brevo
62
65
  :'category' => :'category',
63
66
  :'media_url' => :'mediaUrl',
64
67
  :'body_text' => :'bodyText',
65
- :'header_text' => :'headerText'
68
+ :'header_text' => :'headerText',
69
+ :'source' => :'source'
66
70
  }
67
71
  end
68
72
 
@@ -74,7 +78,8 @@ module Brevo
74
78
  :'category' => :'String',
75
79
  :'media_url' => :'String',
76
80
  :'body_text' => :'String',
77
- :'header_text' => :'String'
81
+ :'header_text' => :'String',
82
+ :'source' => :'String'
78
83
  }
79
84
  end
80
85
 
@@ -109,6 +114,10 @@ module Brevo
109
114
  if attributes.has_key?(:'headerText')
110
115
  self.header_text = attributes[:'headerText']
111
116
  end
117
+
118
+ if attributes.has_key?(:'source')
119
+ self.source = attributes[:'source']
120
+ end
112
121
  end
113
122
 
114
123
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -140,22 +149,34 @@ module Brevo
140
149
  return false if @name.nil?
141
150
  return false if @language.nil?
142
151
  return false if @category.nil?
143
- category_validator = EnumAttributeValidator.new('String', ['MARKETING', 'TRANSACTIONAL'])
152
+ category_validator = EnumAttributeValidator.new('String', ['MARKETING', 'UTILITY'])
144
153
  return false unless category_validator.valid?(@category)
145
154
  return false if @body_text.nil?
155
+ source_validator = EnumAttributeValidator.new('String', ['Automation', 'Conversations'])
156
+ return false unless source_validator.valid?(@source)
146
157
  true
147
158
  end
148
159
 
149
160
  # Custom attribute writer method checking allowed values (enum).
150
161
  # @param [Object] category Object to be assigned
151
162
  def category=(category)
152
- validator = EnumAttributeValidator.new('String', ['MARKETING', 'TRANSACTIONAL'])
163
+ validator = EnumAttributeValidator.new('String', ['MARKETING', 'UTILITY'])
153
164
  unless validator.valid?(category)
154
165
  fail ArgumentError, 'invalid value for "category", must be one of #{validator.allowable_values}.'
155
166
  end
156
167
  @category = category
157
168
  end
158
169
 
170
+ # Custom attribute writer method checking allowed values (enum).
171
+ # @param [Object] source Object to be assigned
172
+ def source=(source)
173
+ validator = EnumAttributeValidator.new('String', ['Automation', 'Conversations'])
174
+ unless validator.valid?(source)
175
+ fail ArgumentError, 'invalid value for "source", must be one of #{validator.allowable_values}.'
176
+ end
177
+ @source = source
178
+ end
179
+
159
180
  # Checks equality by comparing each attribute.
160
181
  # @param [Object] Object to be compared
161
182
  def ==(o)
@@ -166,7 +187,8 @@ module Brevo
166
187
  category == o.category &&
167
188
  media_url == o.media_url &&
168
189
  body_text == o.body_text &&
169
- header_text == o.header_text
190
+ header_text == o.header_text &&
191
+ source == o.source
170
192
  end
171
193
 
172
194
  # @see the `==` method
@@ -178,7 +200,7 @@ module Brevo
178
200
  # Calculates hash code according to all attributes.
179
201
  # @return [Fixnum] Hash code
180
202
  def hash
181
- [name, language, category, media_url, body_text, header_text].hash
203
+ [name, language, category, media_url, body_text, header_text, source].hash
182
204
  end
183
205
 
184
206
  # Builds the object from hash
@@ -0,0 +1,234 @@
1
+ =begin
2
+ #Brevo API
3
+
4
+ #Brevo 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/brevo **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 | | 406 | Error. Not Acceptable |
5
+
6
+ OpenAPI spec version: 3.0.0
7
+ Contact: contact@brevo.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.19
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Brevo
16
+ class Event
17
+ # The name of the event that occurred. This is how you will find your event in Brevo. Limited to 255 characters, alphanumerical characters and - _ only.
18
+ attr_accessor :event_name
19
+
20
+ # Timestamp of when the event occurred (e.g. \"2024-01-24T17:39:57+01:00\"). If no value is passed, the timestamp of the event creation is used.
21
+ attr_accessor :event_date
22
+
23
+ attr_accessor :identifiers
24
+
25
+ # Properties defining the state of the contact associated to this event. Useful to update contact attributes defined in your contacts database while passing the event. For example: **\"FIRSTNAME\": \"Jane\" , \"AGE\": 37**
26
+ attr_accessor :contact_properties
27
+
28
+ # Properties of the event. Top level properties and nested properties can be used to better segment contacts and personalise workflow conditions. The following field type are supported: string, number, boolean (true/false), date (Timestamp e.g. \"2024-01-24T17:39:57+01:00\"). Keys are limited to 255 characters, alphanumerical characters and - _ only. Size is limited to 50Kb.
29
+ attr_accessor :event_properties
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'event_name' => :'event_name',
35
+ :'event_date' => :'event_date',
36
+ :'identifiers' => :'identifiers',
37
+ :'contact_properties' => :'contact_properties',
38
+ :'event_properties' => :'event_properties'
39
+ }
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.swagger_types
44
+ {
45
+ :'event_name' => :'String',
46
+ :'event_date' => :'String',
47
+ :'identifiers' => :'EventIdentifiers',
48
+ :'contact_properties' => :'Object',
49
+ :'event_properties' => :'Object'
50
+ }
51
+ end
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ def initialize(attributes = {})
56
+ return unless attributes.is_a?(Hash)
57
+
58
+ # convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
60
+
61
+ if attributes.has_key?(:'event_name')
62
+ self.event_name = attributes[:'event_name']
63
+ end
64
+
65
+ if attributes.has_key?(:'event_date')
66
+ self.event_date = attributes[:'event_date']
67
+ end
68
+
69
+ if attributes.has_key?(:'identifiers')
70
+ self.identifiers = attributes[:'identifiers']
71
+ end
72
+
73
+ if attributes.has_key?(:'contact_properties')
74
+ self.contact_properties = attributes[:'contact_properties']
75
+ end
76
+
77
+ if attributes.has_key?(:'event_properties')
78
+ self.event_properties = attributes[:'event_properties']
79
+ end
80
+ end
81
+
82
+ # Show invalid properties with the reasons. Usually used together with valid?
83
+ # @return Array for valid properties with the reasons
84
+ def list_invalid_properties
85
+ invalid_properties = Array.new
86
+ if @event_name.nil?
87
+ invalid_properties.push('invalid value for "event_name", event_name cannot be nil.')
88
+ end
89
+
90
+ if @identifiers.nil?
91
+ invalid_properties.push('invalid value for "identifiers", identifiers cannot be nil.')
92
+ end
93
+
94
+ invalid_properties
95
+ end
96
+
97
+ # Check to see if the all the properties in the model are valid
98
+ # @return true if the model is valid
99
+ def valid?
100
+ return false if @event_name.nil?
101
+ return false if @identifiers.nil?
102
+ true
103
+ end
104
+
105
+ # Checks equality by comparing each attribute.
106
+ # @param [Object] Object to be compared
107
+ def ==(o)
108
+ return true if self.equal?(o)
109
+ self.class == o.class &&
110
+ event_name == o.event_name &&
111
+ event_date == o.event_date &&
112
+ identifiers == o.identifiers &&
113
+ contact_properties == o.contact_properties &&
114
+ event_properties == o.event_properties
115
+ end
116
+
117
+ # @see the `==` method
118
+ # @param [Object] Object to be compared
119
+ def eql?(o)
120
+ self == o
121
+ end
122
+
123
+ # Calculates hash code according to all attributes.
124
+ # @return [Fixnum] Hash code
125
+ def hash
126
+ [event_name, event_date, identifiers, contact_properties, event_properties].hash
127
+ end
128
+
129
+ # Builds the object from hash
130
+ # @param [Hash] attributes Model attributes in the form of hash
131
+ # @return [Object] Returns the model itself
132
+ def build_from_hash(attributes)
133
+ return nil unless attributes.is_a?(Hash)
134
+ self.class.swagger_types.each_pair do |key, type|
135
+ if type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
139
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
140
+ end
141
+ elsif !attributes[self.class.attribute_map[key]].nil?
142
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
143
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
144
+ end
145
+
146
+ self
147
+ end
148
+
149
+ # Deserializes the data based on type
150
+ # @param string type Data type
151
+ # @param string value Value to be deserialized
152
+ # @return [Object] Deserialized data
153
+ def _deserialize(type, value)
154
+ case type.to_sym
155
+ when :DateTime
156
+ DateTime.parse(value)
157
+ when :Date
158
+ Date.parse(value)
159
+ when :String
160
+ value.to_s
161
+ when :Integer
162
+ value.to_i
163
+ when :Float
164
+ value.to_f
165
+ when :BOOLEAN
166
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
+ true
168
+ else
169
+ false
170
+ end
171
+ when :Object
172
+ # generic object (usually a Hash), return directly
173
+ value
174
+ when /\AArray<(?<inner_type>.+)>\z/
175
+ inner_type = Regexp.last_match[:inner_type]
176
+ value.map { |v| _deserialize(inner_type, v) }
177
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
178
+ k_type = Regexp.last_match[:k_type]
179
+ v_type = Regexp.last_match[:v_type]
180
+ {}.tap do |hash|
181
+ value.each do |k, v|
182
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
+ end
184
+ end
185
+ else # model
186
+ temp_model = Brevo.const_get(type).new
187
+ temp_model.build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ next if value.nil?
210
+ hash[param] = _to_hash(value)
211
+ end
212
+ hash
213
+ end
214
+
215
+ # Outputs non-array value in the form of hash
216
+ # For object, use to_hash. Otherwise, just return the value
217
+ # @param [Object] value Any valid value
218
+ # @return [Hash] Returns the value in the form of hash
219
+ def _to_hash(value)
220
+ if value.is_a?(Array)
221
+ value.compact.map { |v| _to_hash(v) }
222
+ elsif value.is_a?(Hash)
223
+ {}.tap do |hash|
224
+ value.each { |k, v| hash[k] = _to_hash(v) }
225
+ end
226
+ elsif value.respond_to? :to_hash
227
+ value.to_hash
228
+ else
229
+ value
230
+ end
231
+ end
232
+
233
+ end
234
+ end
@@ -0,0 +1,236 @@
1
+ =begin
2
+ #Brevo API
3
+
4
+ #Brevo 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/brevo **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 | | 406 | Error. Not Acceptable |
5
+
6
+ OpenAPI spec version: 3.0.0
7
+ Contact: contact@brevo.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.19
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Brevo
16
+ # Identifies the contact associated with the event.
17
+ class EventIdentifiers
18
+ # Email Id associated with the event
19
+ attr_accessor :email_id
20
+
21
+ # SMS associated with the event
22
+ attr_accessor :sms
23
+
24
+ # whatsapp associated with the event
25
+ attr_accessor :whatsapp
26
+
27
+ # landline_number associated with the event
28
+ attr_accessor :landline_number
29
+
30
+ # ext_id associated with the event
31
+ attr_accessor :ext_id
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'email_id' => :'email_id',
37
+ :'sms' => :'sms',
38
+ :'whatsapp' => :'whatsapp',
39
+ :'landline_number' => :'landline_number',
40
+ :'ext_id' => :'ext_id'
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.swagger_types
46
+ {
47
+ :'email_id' => :'String',
48
+ :'sms' => :'String',
49
+ :'whatsapp' => :'String',
50
+ :'landline_number' => :'String',
51
+ :'ext_id' => :'String'
52
+ }
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ return unless attributes.is_a?(Hash)
59
+
60
+ # convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
62
+
63
+ if attributes.has_key?(:'email_id')
64
+ self.email_id = attributes[:'email_id']
65
+ else
66
+ self.email_id = 'jane.doe@example.com'
67
+ end
68
+
69
+ if attributes.has_key?(:'sms')
70
+ self.sms = attributes[:'sms']
71
+ else
72
+ self.sms = '+91xxxxxxxxxx'
73
+ end
74
+
75
+ if attributes.has_key?(:'whatsapp')
76
+ self.whatsapp = attributes[:'whatsapp']
77
+ else
78
+ self.whatsapp = '+91xxxxxxxxxx'
79
+ end
80
+
81
+ if attributes.has_key?(:'landline_number')
82
+ self.landline_number = attributes[:'landline_number']
83
+ else
84
+ self.landline_number = '+91xxxxxxxxxx'
85
+ end
86
+
87
+ if attributes.has_key?(:'ext_id')
88
+ self.ext_id = attributes[:'ext_id']
89
+ else
90
+ self.ext_id = 'abc123'
91
+ end
92
+ end
93
+
94
+ # Show invalid properties with the reasons. Usually used together with valid?
95
+ # @return Array for valid properties with the reasons
96
+ def list_invalid_properties
97
+ invalid_properties = Array.new
98
+ invalid_properties
99
+ end
100
+
101
+ # Check to see if the all the properties in the model are valid
102
+ # @return true if the model is valid
103
+ def valid?
104
+ true
105
+ end
106
+
107
+ # Checks equality by comparing each attribute.
108
+ # @param [Object] Object to be compared
109
+ def ==(o)
110
+ return true if self.equal?(o)
111
+ self.class == o.class &&
112
+ email_id == o.email_id &&
113
+ sms == o.sms &&
114
+ whatsapp == o.whatsapp &&
115
+ landline_number == o.landline_number &&
116
+ ext_id == o.ext_id
117
+ end
118
+
119
+ # @see the `==` method
120
+ # @param [Object] Object to be compared
121
+ def eql?(o)
122
+ self == o
123
+ end
124
+
125
+ # Calculates hash code according to all attributes.
126
+ # @return [Fixnum] Hash code
127
+ def hash
128
+ [email_id, sms, whatsapp, landline_number, ext_id].hash
129
+ end
130
+
131
+ # Builds the object from hash
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ # @return [Object] Returns the model itself
134
+ def build_from_hash(attributes)
135
+ return nil unless attributes.is_a?(Hash)
136
+ self.class.swagger_types.each_pair do |key, type|
137
+ if type =~ /\AArray<(.*)>/i
138
+ # check to ensure the input is an array given that the attribute
139
+ # is documented as an array but the input is not
140
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
141
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
142
+ end
143
+ elsif !attributes[self.class.attribute_map[key]].nil?
144
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
145
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
146
+ end
147
+
148
+ self
149
+ end
150
+
151
+ # Deserializes the data based on type
152
+ # @param string type Data type
153
+ # @param string value Value to be deserialized
154
+ # @return [Object] Deserialized data
155
+ def _deserialize(type, value)
156
+ case type.to_sym
157
+ when :DateTime
158
+ DateTime.parse(value)
159
+ when :Date
160
+ Date.parse(value)
161
+ when :String
162
+ value.to_s
163
+ when :Integer
164
+ value.to_i
165
+ when :Float
166
+ value.to_f
167
+ when :BOOLEAN
168
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
169
+ true
170
+ else
171
+ false
172
+ end
173
+ when :Object
174
+ # generic object (usually a Hash), return directly
175
+ value
176
+ when /\AArray<(?<inner_type>.+)>\z/
177
+ inner_type = Regexp.last_match[:inner_type]
178
+ value.map { |v| _deserialize(inner_type, v) }
179
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
180
+ k_type = Regexp.last_match[:k_type]
181
+ v_type = Regexp.last_match[:v_type]
182
+ {}.tap do |hash|
183
+ value.each do |k, v|
184
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
185
+ end
186
+ end
187
+ else # model
188
+ temp_model = Brevo.const_get(type).new
189
+ temp_model.build_from_hash(value)
190
+ end
191
+ end
192
+
193
+ # Returns the string representation of the object
194
+ # @return [String] String presentation of the object
195
+ def to_s
196
+ to_hash.to_s
197
+ end
198
+
199
+ # to_body is an alias to to_hash (backward compatibility)
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_body
202
+ to_hash
203
+ end
204
+
205
+ # Returns the object in the form of hash
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_hash
208
+ hash = {}
209
+ self.class.attribute_map.each_pair do |attr, param|
210
+ value = self.send(attr)
211
+ next if value.nil?
212
+ hash[param] = _to_hash(value)
213
+ end
214
+ hash
215
+ end
216
+
217
+ # Outputs non-array value in the form of hash
218
+ # For object, use to_hash. Otherwise, just return the value
219
+ # @param [Object] value Any valid value
220
+ # @return [Hash] Returns the value in the form of hash
221
+ def _to_hash(value)
222
+ if value.is_a?(Array)
223
+ value.compact.map { |v| _to_hash(v) }
224
+ elsif value.is_a?(Hash)
225
+ {}.tap do |hash|
226
+ value.each { |k, v| hash[k] = _to_hash(v) }
227
+ end
228
+ elsif value.respond_to? :to_hash
229
+ value.to_hash
230
+ else
231
+ value
232
+ end
233
+ end
234
+
235
+ end
236
+ end
@@ -26,6 +26,9 @@ module Brevo
26
26
  # Sorting order of records (asc or desc)
27
27
  attr_accessor :sort
28
28
 
29
+ # Filter the history based on webhook type
30
+ attr_accessor :type
31
+
29
32
  # Filter the history for a specific event type
30
33
  attr_accessor :event
31
34
 
@@ -38,7 +41,7 @@ module Brevo
38
41
  # Filter the history for a specific email
39
42
  attr_accessor :email
40
43
 
41
- # Filter the history for a specific message id
44
+ # Filter the history for a specific message id. Applicable only for transactional webhooks.
42
45
  attr_accessor :message_id
43
46
 
44
47
  class EnumAttributeValidator
@@ -70,6 +73,7 @@ module Brevo
70
73
  :'start_date' => :'startDate',
71
74
  :'end_date' => :'endDate',
72
75
  :'sort' => :'sort',
76
+ :'type' => :'type',
73
77
  :'event' => :'event',
74
78
  :'notify_url' => :'notifyURL',
75
79
  :'webhook_id' => :'webhookId',
@@ -85,6 +89,7 @@ module Brevo
85
89
  :'start_date' => :'String',
86
90
  :'end_date' => :'String',
87
91
  :'sort' => :'String',
92
+ :'type' => :'String',
88
93
  :'event' => :'String',
89
94
  :'notify_url' => :'String',
90
95
  :'webhook_id' => :'Integer',
@@ -117,6 +122,10 @@ module Brevo
117
122
  self.sort = attributes[:'sort']
118
123
  end
119
124
 
125
+ if attributes.has_key?(:'type')
126
+ self.type = attributes[:'type']
127
+ end
128
+
120
129
  if attributes.has_key?(:'event')
121
130
  self.event = attributes[:'event']
122
131
  end
@@ -142,6 +151,10 @@ module Brevo
142
151
  # @return Array for valid properties with the reasons
143
152
  def list_invalid_properties
144
153
  invalid_properties = Array.new
154
+ if @type.nil?
155
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
156
+ end
157
+
145
158
  if @event.nil?
146
159
  invalid_properties.push('invalid value for "event", event cannot be nil.')
147
160
  end
@@ -156,17 +169,30 @@ module Brevo
156
169
  # Check to see if the all the properties in the model are valid
157
170
  # @return true if the model is valid
158
171
  def valid?
172
+ return false if @type.nil?
173
+ type_validator = EnumAttributeValidator.new('String', ['transactional', 'marketing'])
174
+ return false unless type_validator.valid?(@type)
159
175
  return false if @event.nil?
160
- event_validator = EnumAttributeValidator.new('String', ['invalid_parameter', 'missing_parameter', 'hardBounce', 'softBounce', 'delivered"', 'spam', 'request', 'opened', 'click', 'invalid', 'deferred', 'blocked', 'unsubscribed', 'error', 'uniqueOpened', 'loadedByProxy', 'allEvents'])
176
+ event_validator = EnumAttributeValidator.new('String', ['invalid_parameter', 'missing_parameter', 'hardBounce', 'softBounce', 'delivered', 'spam', 'request', 'opened', 'click', 'invalid', 'deferred', 'blocked', 'unsubscribed', 'error', 'uniqueOpened', 'loadedByProxy', 'allEvents'])
161
177
  return false unless event_validator.valid?(@event)
162
178
  return false if @notify_url.nil?
163
179
  true
164
180
  end
165
181
 
182
+ # Custom attribute writer method checking allowed values (enum).
183
+ # @param [Object] type Object to be assigned
184
+ def type=(type)
185
+ validator = EnumAttributeValidator.new('String', ['transactional', 'marketing'])
186
+ unless validator.valid?(type)
187
+ fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
188
+ end
189
+ @type = type
190
+ end
191
+
166
192
  # Custom attribute writer method checking allowed values (enum).
167
193
  # @param [Object] event Object to be assigned
168
194
  def event=(event)
169
- validator = EnumAttributeValidator.new('String', ['invalid_parameter', 'missing_parameter', 'hardBounce', 'softBounce', 'delivered"', 'spam', 'request', 'opened', 'click', 'invalid', 'deferred', 'blocked', 'unsubscribed', 'error', 'uniqueOpened', 'loadedByProxy', 'allEvents'])
195
+ validator = EnumAttributeValidator.new('String', ['invalid_parameter', 'missing_parameter', 'hardBounce', 'softBounce', 'delivered', 'spam', 'request', 'opened', 'click', 'invalid', 'deferred', 'blocked', 'unsubscribed', 'error', 'uniqueOpened', 'loadedByProxy', 'allEvents'])
170
196
  unless validator.valid?(event)
171
197
  fail ArgumentError, 'invalid value for "event", must be one of #{validator.allowable_values}.'
172
198
  end
@@ -182,6 +208,7 @@ module Brevo
182
208
  start_date == o.start_date &&
183
209
  end_date == o.end_date &&
184
210
  sort == o.sort &&
211
+ type == o.type &&
185
212
  event == o.event &&
186
213
  notify_url == o.notify_url &&
187
214
  webhook_id == o.webhook_id &&
@@ -198,7 +225,7 @@ module Brevo
198
225
  # Calculates hash code according to all attributes.
199
226
  # @return [Fixnum] Hash code
200
227
  def hash
201
- [days, start_date, end_date, sort, event, notify_url, webhook_id, email, message_id].hash
228
+ [days, start_date, end_date, sort, type, event, notify_url, webhook_id, email, message_id].hash
202
229
  end
203
230
 
204
231
  # Builds the object from hash
@@ -122,10 +122,6 @@ module Brevo
122
122
  # @return Array for valid properties with the reasons
123
123
  def list_invalid_properties
124
124
  invalid_properties = Array.new
125
- if @email.nil?
126
- invalid_properties.push('invalid value for "email", email cannot be nil.')
127
- end
128
-
129
125
  if @id.nil?
130
126
  invalid_properties.push('invalid value for "id", id cannot be nil.')
131
127
  end
@@ -160,7 +156,6 @@ module Brevo
160
156
  # Check to see if the all the properties in the model are valid
161
157
  # @return true if the model is valid
162
158
  def valid?
163
- return false if @email.nil?
164
159
  return false if @id.nil?
165
160
  return false if @email_blacklisted.nil?
166
161
  return false if @sms_blacklisted.nil?