sib-api-v3-sdk 5.2.4 → 5.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -7
  3. data/docs/CreateContact.md +1 -1
  4. data/docs/CreateEmailCampaign.md +1 -1
  5. data/docs/CreateSmtpEmail.md +1 -1
  6. data/docs/GetAccountRelay.md +1 -1
  7. data/docs/GetAccountRelayData.md +1 -1
  8. data/docs/GetSmtpTemplates.md +1 -1
  9. data/docs/GetTransacEmailContent.md +14 -0
  10. data/docs/GetTransacEmailContentEvents.md +9 -0
  11. data/docs/GetTransacEmailsList.md +8 -0
  12. data/docs/GetTransacEmailsListTransactionalEmails.md +13 -0
  13. data/docs/SMTPApi.md +152 -25
  14. data/docs/UpdateChildAccountStatus.md +1 -1
  15. data/docs/UpdateContact.md +1 -1
  16. data/lib/sib-api-v3-sdk.rb +4 -0
  17. data/lib/sib-api-v3-sdk/api/smtp_api.rb +137 -18
  18. data/lib/sib-api-v3-sdk/models/create_contact.rb +1 -1
  19. data/lib/sib-api-v3-sdk/models/create_email_campaign.rb +1 -1
  20. data/lib/sib-api-v3-sdk/models/create_smtp_email.rb +1 -1
  21. data/lib/sib-api-v3-sdk/models/get_account_relay.rb +2 -2
  22. data/lib/sib-api-v3-sdk/models/get_account_relay_data.rb +2 -2
  23. data/lib/sib-api-v3-sdk/models/get_smtp_templates.rb +1 -1
  24. data/lib/sib-api-v3-sdk/models/get_transac_email_content.rb +281 -0
  25. data/lib/sib-api-v3-sdk/models/get_transac_email_content_events.rb +209 -0
  26. data/lib/sib-api-v3-sdk/models/get_transac_emails_list.rb +190 -0
  27. data/lib/sib-api-v3-sdk/models/get_transac_emails_list_transactional_emails.rb +264 -0
  28. data/lib/sib-api-v3-sdk/models/update_child_account_status.rb +1 -1
  29. data/lib/sib-api-v3-sdk/models/update_contact.rb +1 -1
  30. data/lib/sib-api-v3-sdk/version.rb +1 -1
  31. data/spec/api/smtp_api_spec.rb +37 -9
  32. data/spec/models/create_webhook_spec.rb +1 -1
  33. data/spec/models/get_transac_email_content_events_spec.rb +48 -0
  34. data/spec/models/get_transac_email_content_spec.rb +78 -0
  35. data/spec/models/get_transac_emails_list_spec.rb +42 -0
  36. data/spec/models/get_transac_emails_list_transactional_emails_spec.rb +72 -0
  37. data/spec/models/update_webhook_spec.rb +1 -1
  38. metadata +18 -2
@@ -3,7 +3,7 @@
3
3
  ## Properties
4
4
  Name | Type | Description | Notes
5
5
  ------------ | ------------- | ------------- | -------------
6
- **transactional_email** | **BOOLEAN** | Status of Transactional Email (SMTP) Platform activation for your account (true=enabled, false=disabled) | [optional]
6
+ **transactional_email** | **BOOLEAN** | Status of Transactional Email Platform activation for your account (true=enabled, false=disabled) | [optional]
7
7
  **transactional_sms** | **BOOLEAN** | Status of Transactional SMS Platform activation for your account (true=enabled, false=disabled) | [optional]
8
8
  **marketing_automation** | **BOOLEAN** | Status of Marketing Automation Platform activation for your account (true=enabled, false=disabled) | [optional]
9
9
 
@@ -8,6 +8,6 @@ Name | Type | Description | Notes
8
8
  **sms_blacklisted** | **BOOLEAN** | Set/unset this field to blacklist/allow the contact for SMS (smsBlacklisted = true) | [optional]
9
9
  **list_ids** | **Array<Integer>** | Ids of the lists to add the contact to | [optional]
10
10
  **unlink_list_ids** | **Array<Integer>** | Ids of the lists to remove the contact from | [optional]
11
- **smtp_blacklist_sender** | **Array<String>** | SMTP forbidden sender for contact. Use only for email Contact | [optional]
11
+ **smtp_blacklist_sender** | **Array<String>** | transactional email forbidden sender for contact. Use only for email Contact | [optional]
12
12
 
13
13
 
@@ -114,6 +114,10 @@ require 'sib-api-v3-sdk/models/get_smtp_templates'
114
114
  require 'sib-api-v3-sdk/models/get_sso_token'
115
115
  require 'sib-api-v3-sdk/models/get_stats_by_domain'
116
116
  require 'sib-api-v3-sdk/models/get_transac_aggregated_sms_report'
117
+ require 'sib-api-v3-sdk/models/get_transac_email_content'
118
+ require 'sib-api-v3-sdk/models/get_transac_email_content_events'
119
+ require 'sib-api-v3-sdk/models/get_transac_emails_list'
120
+ require 'sib-api-v3-sdk/models/get_transac_emails_list_transactional_emails'
117
121
  require 'sib-api-v3-sdk/models/get_transac_sms_report'
118
122
  require 'sib-api-v3-sdk/models/get_transac_sms_report_reports'
119
123
  require 'sib-api-v3-sdk/models/get_webhook'
@@ -20,9 +20,9 @@ module SibApiV3Sdk
20
20
  @api_client = api_client
21
21
  end
22
22
 
23
- # Create an smtp template
23
+ # Create a transactional email template
24
24
  #
25
- # @param smtp_template values to update in smtp template
25
+ # @param smtp_template values to update in transactional email template
26
26
  # @param [Hash] opts the optional parameters
27
27
  # @return [CreateModel]
28
28
  def create_smtp_template(smtp_template, opts = {})
@@ -30,9 +30,9 @@ module SibApiV3Sdk
30
30
  return data
31
31
  end
32
32
 
33
- # Create an smtp template
33
+ # Create a transactional email template
34
34
  #
35
- # @param smtp_template values to update in smtp template
35
+ # @param smtp_template values to update in transactional email template
36
36
  # @param [Hash] opts the optional parameters
37
37
  # @return [Array<(CreateModel, Fixnum, Hash)>] CreateModel data, response status code and response headers
38
38
  def create_smtp_template_with_http_info(smtp_template, opts = {})
@@ -125,7 +125,7 @@ module SibApiV3Sdk
125
125
  return data, status_code, headers
126
126
  end
127
127
 
128
- # Delete an inactive smtp template
128
+ # Delete an inactive transactional email template
129
129
  #
130
130
  # @param template_id id of the template
131
131
  # @param [Hash] opts the optional parameters
@@ -135,7 +135,7 @@ module SibApiV3Sdk
135
135
  return nil
136
136
  end
137
137
 
138
- # Delete an inactive smtp template
138
+ # Delete an inactive transactional email template
139
139
  #
140
140
  # @param template_id id of the template
141
141
  # @param [Hash] opts the optional parameters
@@ -179,7 +179,7 @@ module SibApiV3Sdk
179
179
  return data, status_code, headers
180
180
  end
181
181
 
182
- # Get your SMTP activity aggregated over a period of time
182
+ # Get your transactional email activity aggregated over a period of time
183
183
  #
184
184
  # @param [Hash] opts the optional parameters
185
185
  # @option opts [String] :start_date Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate
@@ -192,7 +192,7 @@ module SibApiV3Sdk
192
192
  return data
193
193
  end
194
194
 
195
- # Get your SMTP activity aggregated over a period of time
195
+ # Get your transactional email activity aggregated over a period of time
196
196
  #
197
197
  # @param [Hash] opts the optional parameters
198
198
  # @option opts [String] :start_date Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate
@@ -240,7 +240,7 @@ module SibApiV3Sdk
240
240
  return data, status_code, headers
241
241
  end
242
242
 
243
- # Get all your SMTP activity (unaggregated events)
243
+ # Get all your transactional email activity (unaggregated events)
244
244
  #
245
245
  # @param [Hash] opts the optional parameters
246
246
  # @option opts [Integer] :limit Number limitation for the result returned (default to 50)
@@ -259,7 +259,7 @@ module SibApiV3Sdk
259
259
  return data
260
260
  end
261
261
 
262
- # Get all your SMTP activity (unaggregated events)
262
+ # Get all your transactional email activity (unaggregated events)
263
263
  #
264
264
  # @param [Hash] opts the optional parameters
265
265
  # @option opts [Integer] :limit Number limitation for the result returned
@@ -326,7 +326,7 @@ module SibApiV3Sdk
326
326
  return data, status_code, headers
327
327
  end
328
328
 
329
- # Get your SMTP activity aggregated per day
329
+ # Get your transactional email activity aggregated per day
330
330
  #
331
331
  # @param [Hash] opts the optional parameters
332
332
  # @option opts [Integer] :limit Number of documents returned per page (default to 50)
@@ -341,7 +341,7 @@ module SibApiV3Sdk
341
341
  return data
342
342
  end
343
343
 
344
- # Get your SMTP activity aggregated per day
344
+ # Get your transactional email activity aggregated per day
345
345
  #
346
346
  # @param [Hash] opts the optional parameters
347
347
  # @option opts [Integer] :limit Number of documents returned per page
@@ -452,7 +452,7 @@ module SibApiV3Sdk
452
452
  return data, status_code, headers
453
453
  end
454
454
 
455
- # Get the list of SMTP templates
455
+ # Get the list of transactional email templates
456
456
  #
457
457
  # @param [Hash] opts the optional parameters
458
458
  # @option opts [BOOLEAN] :template_status Filter on the status of the template. Active &#x3D; true, inactive &#x3D; false
@@ -464,7 +464,7 @@ module SibApiV3Sdk
464
464
  return data
465
465
  end
466
466
 
467
- # Get the list of SMTP templates
467
+ # Get the list of transactional email templates
468
468
  #
469
469
  # @param [Hash] opts the optional parameters
470
470
  # @option opts [BOOLEAN] :template_status Filter on the status of the template. Active &#x3D; true, inactive &#x3D; false
@@ -514,6 +514,125 @@ module SibApiV3Sdk
514
514
  return data, status_code, headers
515
515
  end
516
516
 
517
+ # Get the personalized content of a sent transactional email
518
+ #
519
+ # @param uuid Unique id of the transactional email that has been sent to a particular contact
520
+ # @param [Hash] opts the optional parameters
521
+ # @return [GetTransacEmailContent]
522
+ def get_transac_email_content(uuid, opts = {})
523
+ data, _status_code, _headers = get_transac_email_content_with_http_info(uuid, opts)
524
+ return data
525
+ end
526
+
527
+ # Get the personalized content of a sent transactional email
528
+ #
529
+ # @param uuid Unique id of the transactional email that has been sent to a particular contact
530
+ # @param [Hash] opts the optional parameters
531
+ # @return [Array<(GetTransacEmailContent, Fixnum, Hash)>] GetTransacEmailContent data, response status code and response headers
532
+ def get_transac_email_content_with_http_info(uuid, opts = {})
533
+ if @api_client.config.debugging
534
+ @api_client.config.logger.debug "Calling API: SMTPApi.get_transac_email_content ..."
535
+ end
536
+ # verify the required parameter 'uuid' is set
537
+ if @api_client.config.client_side_validation && uuid.nil?
538
+ fail ArgumentError, "Missing the required parameter 'uuid' when calling SMTPApi.get_transac_email_content"
539
+ end
540
+ # resource path
541
+ local_var_path = "/smtp/emails/{uuid}".sub('{' + 'uuid' + '}', uuid.to_s)
542
+
543
+ # query parameters
544
+ query_params = {}
545
+
546
+ # header parameters
547
+ header_params = {}
548
+ # HTTP header 'Accept' (if needed)
549
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
550
+ # HTTP header 'Content-Type'
551
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
552
+
553
+ # form parameters
554
+ form_params = {}
555
+
556
+ # http body (model)
557
+ post_body = nil
558
+ auth_names = ['api-key', 'partner-key']
559
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
560
+ :header_params => header_params,
561
+ :query_params => query_params,
562
+ :form_params => form_params,
563
+ :body => post_body,
564
+ :auth_names => auth_names,
565
+ :return_type => 'GetTransacEmailContent')
566
+ if @api_client.config.debugging
567
+ @api_client.config.logger.debug "API called: SMTPApi#get_transac_email_content\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
568
+ end
569
+ return data, status_code, headers
570
+ end
571
+
572
+ # Get the list of transactional emails on the basis of allowed filters
573
+ # This endpoint will show the list of emails for past 30 days by default. To retrieve emails before that time, please pass startDate and endDate in query filters.
574
+ # @param [Hash] opts the optional parameters
575
+ # @option opts [String] :email Mandatory if templateId and messageId are not passed in query filters. Email address to which transactional email has been sent.
576
+ # @option opts [Integer] :template_id Mandatory if email and messageId are not passed in query filters. Id of the template that was used to compose transactional email.
577
+ # @option opts [String] :message_id Mandatory if templateId and email are not passed in query filters. Message ID of the transactional email sent.
578
+ # @option opts [String] :start_date Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Maximum time period that can be selected is one month.
579
+ # @option opts [Date] :end_date Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month.
580
+ # @return [GetTransacEmailsList]
581
+ def get_transac_emails_list(opts = {})
582
+ data, _status_code, _headers = get_transac_emails_list_with_http_info(opts)
583
+ return data
584
+ end
585
+
586
+ # Get the list of transactional emails on the basis of allowed filters
587
+ # This endpoint will show the list of emails for past 30 days by default. To retrieve emails before that time, please pass startDate and endDate in query filters.
588
+ # @param [Hash] opts the optional parameters
589
+ # @option opts [String] :email Mandatory if templateId and messageId are not passed in query filters. Email address to which transactional email has been sent.
590
+ # @option opts [Integer] :template_id Mandatory if email and messageId are not passed in query filters. Id of the template that was used to compose transactional email.
591
+ # @option opts [String] :message_id Mandatory if templateId and email are not passed in query filters. Message ID of the transactional email sent.
592
+ # @option opts [String] :start_date Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Maximum time period that can be selected is one month.
593
+ # @option opts [Date] :end_date Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month.
594
+ # @return [Array<(GetTransacEmailsList, Fixnum, Hash)>] GetTransacEmailsList data, response status code and response headers
595
+ def get_transac_emails_list_with_http_info(opts = {})
596
+ if @api_client.config.debugging
597
+ @api_client.config.logger.debug "Calling API: SMTPApi.get_transac_emails_list ..."
598
+ end
599
+ # resource path
600
+ local_var_path = "/smtp/emails"
601
+
602
+ # query parameters
603
+ query_params = {}
604
+ query_params[:'email'] = opts[:'email'] if !opts[:'email'].nil?
605
+ query_params[:'templateId'] = opts[:'template_id'] if !opts[:'template_id'].nil?
606
+ query_params[:'messageId'] = opts[:'message_id'] if !opts[:'message_id'].nil?
607
+ query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
608
+ query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
609
+
610
+ # header parameters
611
+ header_params = {}
612
+ # HTTP header 'Accept' (if needed)
613
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
614
+ # HTTP header 'Content-Type'
615
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
616
+
617
+ # form parameters
618
+ form_params = {}
619
+
620
+ # http body (model)
621
+ post_body = nil
622
+ auth_names = ['api-key', 'partner-key']
623
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
624
+ :header_params => header_params,
625
+ :query_params => query_params,
626
+ :form_params => form_params,
627
+ :body => post_body,
628
+ :auth_names => auth_names,
629
+ :return_type => 'GetTransacEmailsList')
630
+ if @api_client.config.debugging
631
+ @api_client.config.logger.debug "API called: SMTPApi#get_transac_emails_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
632
+ end
633
+ return data, status_code, headers
634
+ end
635
+
517
636
  # Send a template
518
637
  # This endpoint is deprecated. Prefer v3/smtp/email instead.
519
638
  # @param template_id Id of the template
@@ -690,10 +809,10 @@ module SibApiV3Sdk
690
809
  return data, status_code, headers
691
810
  end
692
811
 
693
- # Updates an smtp templates
812
+ # Updates a transactional email templates
694
813
  #
695
814
  # @param template_id id of the template
696
- # @param smtp_template values to update in smtp template
815
+ # @param smtp_template values to update in transactional email template
697
816
  # @param [Hash] opts the optional parameters
698
817
  # @return [nil]
699
818
  def update_smtp_template(template_id, smtp_template, opts = {})
@@ -701,10 +820,10 @@ module SibApiV3Sdk
701
820
  return nil
702
821
  end
703
822
 
704
- # Updates an smtp templates
823
+ # Updates a transactional email templates
705
824
  #
706
825
  # @param template_id id of the template
707
- # @param smtp_template values to update in smtp template
826
+ # @param smtp_template values to update in transactional email template
708
827
  # @param [Hash] opts the optional parameters
709
828
  # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
710
829
  def update_smtp_template_with_http_info(template_id, smtp_template, opts = {})
@@ -33,7 +33,7 @@ module SibApiV3Sdk
33
33
  # Facilitate to update the existing contact in the same request (updateEnabled = true)
34
34
  attr_accessor :update_enabled
35
35
 
36
- # SMTP forbidden sender for contact. Use only for email Contact ( only available if updateEnabled = true )
36
+ # transactional email forbidden sender for contact. Use only for email Contact ( only available if updateEnabled = true )
37
37
  attr_accessor :smtp_blacklist_sender
38
38
 
39
39
 
@@ -29,7 +29,7 @@ module SibApiV3Sdk
29
29
  # Mandatory if htmlContent and templateId are empty. Url to the message (HTML)
30
30
  attr_accessor :html_url
31
31
 
32
- # Mandatory if htmlContent and htmlUrl are empty. Id of the SMTP template with status 'active'. Used to copy only its content fetched from htmlContent/htmlUrl to an email campaign for RSS feature.
32
+ # Mandatory if htmlContent and htmlUrl are empty. Id of the transactional email template with status 'active'. Used to copy only its content fetched from htmlContent/htmlUrl to an email campaign for RSS feature.
33
33
  attr_accessor :template_id
34
34
 
35
35
  # Sending UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. If sendAtBestTime is set to true, your campaign will be sent according to the date passed (ignoring the time part).
@@ -15,7 +15,7 @@ require 'date'
15
15
  module SibApiV3Sdk
16
16
 
17
17
  class CreateSmtpEmail
18
- # Message ID of the SMTP Email sent
18
+ # Message ID of the transactional email sent
19
19
  attr_accessor :message_id
20
20
 
21
21
 
@@ -13,9 +13,9 @@ Swagger Codegen version: 2.3.1
13
13
  require 'date'
14
14
 
15
15
  module SibApiV3Sdk
16
- # Information about your SMTP account
16
+ # Information about your transactional email account
17
17
  class GetAccountRelay
18
- # Status of your SMTP Account (true=Enabled, false=Disabled)
18
+ # Status of your transactional email Account (true=Enabled, false=Disabled)
19
19
  attr_accessor :enabled
20
20
 
21
21
  attr_accessor :data
@@ -13,9 +13,9 @@ Swagger Codegen version: 2.3.1
13
13
  require 'date'
14
14
 
15
15
  module SibApiV3Sdk
16
- # Data regarding the SMTP account
16
+ # Data regarding the transactional email account
17
17
  class GetAccountRelayData
18
- # Email to use as login on SMTP
18
+ # Email to use as login on transactional platform
19
19
  attr_accessor :user_name
20
20
 
21
21
  # URL of the SMTP Relay
@@ -15,7 +15,7 @@ require 'date'
15
15
  module SibApiV3Sdk
16
16
 
17
17
  class GetSmtpTemplates
18
- # Count of smtp templates
18
+ # Count of transactional email templates
19
19
  attr_accessor :count
20
20
 
21
21
  attr_accessor :templates
@@ -0,0 +1,281 @@
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.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module SibApiV3Sdk
16
+
17
+ class GetTransacEmailContent
18
+ # Email address to which transactional email has been sent
19
+ attr_accessor :email
20
+
21
+ # Subject of the sent email
22
+ attr_accessor :subject
23
+
24
+ # Id of the template
25
+ attr_accessor :template_id
26
+
27
+ # Date on which transactional email was sent
28
+ attr_accessor :date
29
+
30
+ # Series of events which occurred on the transactional email
31
+ attr_accessor :events
32
+
33
+ # Actual content of the transactional email that has been sent
34
+ attr_accessor :body
35
+
36
+ # Count of the attachments that were sent in the email
37
+ attr_accessor :attachment_count
38
+
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'email' => :'email',
44
+ :'subject' => :'subject',
45
+ :'template_id' => :'templateId',
46
+ :'date' => :'date',
47
+ :'events' => :'events',
48
+ :'body' => :'body',
49
+ :'attachment_count' => :'attachmentCount'
50
+ }
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.swagger_types
55
+ {
56
+ :'email' => :'String',
57
+ :'subject' => :'String',
58
+ :'template_id' => :'Integer',
59
+ :'date' => :'DateTime',
60
+ :'events' => :'Array<GetTransacEmailContentEvents>',
61
+ :'body' => :'String',
62
+ :'attachment_count' => :'Integer'
63
+ }
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ return unless attributes.is_a?(Hash)
70
+
71
+ # convert string to symbol for hash key
72
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
73
+
74
+ if attributes.has_key?(:'email')
75
+ self.email = attributes[:'email']
76
+ end
77
+
78
+ if attributes.has_key?(:'subject')
79
+ self.subject = attributes[:'subject']
80
+ end
81
+
82
+ if attributes.has_key?(:'templateId')
83
+ self.template_id = attributes[:'templateId']
84
+ end
85
+
86
+ if attributes.has_key?(:'date')
87
+ self.date = attributes[:'date']
88
+ end
89
+
90
+ if attributes.has_key?(:'events')
91
+ if (value = attributes[:'events']).is_a?(Array)
92
+ self.events = value
93
+ end
94
+ end
95
+
96
+ if attributes.has_key?(:'body')
97
+ self.body = attributes[:'body']
98
+ end
99
+
100
+ if attributes.has_key?(:'attachmentCount')
101
+ self.attachment_count = attributes[:'attachmentCount']
102
+ end
103
+
104
+ end
105
+
106
+ # Show invalid properties with the reasons. Usually used together with valid?
107
+ # @return Array for valid properties with the reasons
108
+ def list_invalid_properties
109
+ invalid_properties = Array.new
110
+ if @email.nil?
111
+ invalid_properties.push("invalid value for 'email', email cannot be nil.")
112
+ end
113
+
114
+ if @subject.nil?
115
+ invalid_properties.push("invalid value for 'subject', subject cannot be nil.")
116
+ end
117
+
118
+ if @date.nil?
119
+ invalid_properties.push("invalid value for 'date', date cannot be nil.")
120
+ end
121
+
122
+ if @events.nil?
123
+ invalid_properties.push("invalid value for 'events', events cannot be nil.")
124
+ end
125
+
126
+ if @body.nil?
127
+ invalid_properties.push("invalid value for 'body', body cannot be nil.")
128
+ end
129
+
130
+ if @attachment_count.nil?
131
+ invalid_properties.push("invalid value for 'attachment_count', attachment_count cannot be nil.")
132
+ end
133
+
134
+ return invalid_properties
135
+ end
136
+
137
+ # Check to see if the all the properties in the model are valid
138
+ # @return true if the model is valid
139
+ def valid?
140
+ return false if @email.nil?
141
+ return false if @subject.nil?
142
+ return false if @date.nil?
143
+ return false if @events.nil?
144
+ return false if @body.nil?
145
+ return false if @attachment_count.nil?
146
+ return true
147
+ end
148
+
149
+ # Checks equality by comparing each attribute.
150
+ # @param [Object] Object to be compared
151
+ def ==(o)
152
+ return true if self.equal?(o)
153
+ self.class == o.class &&
154
+ email == o.email &&
155
+ subject == o.subject &&
156
+ template_id == o.template_id &&
157
+ date == o.date &&
158
+ events == o.events &&
159
+ body == o.body &&
160
+ attachment_count == o.attachment_count
161
+ end
162
+
163
+ # @see the `==` method
164
+ # @param [Object] Object to be compared
165
+ def eql?(o)
166
+ self == o
167
+ end
168
+
169
+ # Calculates hash code according to all attributes.
170
+ # @return [Fixnum] Hash code
171
+ def hash
172
+ [email, subject, template_id, date, events, body, attachment_count].hash
173
+ end
174
+
175
+ # Builds the object from hash
176
+ # @param [Hash] attributes Model attributes in the form of hash
177
+ # @return [Object] Returns the model itself
178
+ def build_from_hash(attributes)
179
+ return nil unless attributes.is_a?(Hash)
180
+ self.class.swagger_types.each_pair do |key, type|
181
+ if type =~ /\AArray<(.*)>/i
182
+ # check to ensure the input is an array given that the the attribute
183
+ # is documented as an array but the input is not
184
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
185
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
186
+ end
187
+ elsif !attributes[self.class.attribute_map[key]].nil?
188
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
189
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
190
+ end
191
+
192
+ self
193
+ end
194
+
195
+ # Deserializes the data based on type
196
+ # @param string type Data type
197
+ # @param string value Value to be deserialized
198
+ # @return [Object] Deserialized data
199
+ def _deserialize(type, value)
200
+ case type.to_sym
201
+ when :DateTime
202
+ DateTime.parse(value)
203
+ when :Date
204
+ Date.parse(value)
205
+ when :String
206
+ value.to_s
207
+ when :Integer
208
+ value.to_i
209
+ when :Float
210
+ value.to_f
211
+ when :BOOLEAN
212
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
213
+ true
214
+ else
215
+ false
216
+ end
217
+ when :Object
218
+ # generic object (usually a Hash), return directly
219
+ value
220
+ when /\AArray<(?<inner_type>.+)>\z/
221
+ inner_type = Regexp.last_match[:inner_type]
222
+ value.map { |v| _deserialize(inner_type, v) }
223
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
224
+ k_type = Regexp.last_match[:k_type]
225
+ v_type = Regexp.last_match[:v_type]
226
+ {}.tap do |hash|
227
+ value.each do |k, v|
228
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
229
+ end
230
+ end
231
+ else # model
232
+ temp_model = SibApiV3Sdk.const_get(type).new
233
+ temp_model.build_from_hash(value)
234
+ end
235
+ end
236
+
237
+ # Returns the string representation of the object
238
+ # @return [String] String presentation of the object
239
+ def to_s
240
+ to_hash.to_s
241
+ end
242
+
243
+ # to_body is an alias to to_hash (backward compatibility)
244
+ # @return [Hash] Returns the object in the form of hash
245
+ def to_body
246
+ to_hash
247
+ end
248
+
249
+ # Returns the object in the form of hash
250
+ # @return [Hash] Returns the object in the form of hash
251
+ def to_hash
252
+ hash = {}
253
+ self.class.attribute_map.each_pair do |attr, param|
254
+ value = self.send(attr)
255
+ next if value.nil?
256
+ hash[param] = _to_hash(value)
257
+ end
258
+ hash
259
+ end
260
+
261
+ # Outputs non-array value in the form of hash
262
+ # For object, use to_hash. Otherwise, just return the value
263
+ # @param [Object] value Any valid value
264
+ # @return [Hash] Returns the value in the form of hash
265
+ def _to_hash(value)
266
+ if value.is_a?(Array)
267
+ value.compact.map{ |v| _to_hash(v) }
268
+ elsif value.is_a?(Hash)
269
+ {}.tap do |hash|
270
+ value.each { |k, v| hash[k] = _to_hash(v) }
271
+ end
272
+ elsif value.respond_to? :to_hash
273
+ value.to_hash
274
+ else
275
+ value
276
+ end
277
+ end
278
+
279
+ end
280
+
281
+ end