unione 1.1.3

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 (146) hide show
  1. checksums.yaml +7 -0
  2. data/AGENTS.md +99 -0
  3. data/LICENSE +21 -0
  4. data/README.md +270 -0
  5. data/docs/ConfirmedEmail.md +109 -0
  6. data/docs/Domain.md +257 -0
  7. data/docs/Email.md +126 -0
  8. data/docs/EmailValidation.md +54 -0
  9. data/docs/EventDump.md +157 -0
  10. data/docs/Obsolete.md +119 -0
  11. data/docs/Project.md +174 -0
  12. data/docs/Suppression.md +163 -0
  13. data/docs/System.md +73 -0
  14. data/docs/Tag.md +73 -0
  15. data/docs/Template.md +164 -0
  16. data/docs/Webhook.md +182 -0
  17. data/lib/unione/api/confirmed_email/confirmed_email_api.rb +47 -0
  18. data/lib/unione/api/confirmed_email/model/confirmed_email.rb +49 -0
  19. data/lib/unione/api/confirmed_email/model/confirmed_email_create_response.rb +50 -0
  20. data/lib/unione/api/confirmed_email/model/confirmed_email_delete_response.rb +50 -0
  21. data/lib/unione/api/confirmed_email/model/confirmed_email_list_response.rb +50 -0
  22. data/lib/unione/api/confirmed_email/model/confirmed_email_request.rb +42 -0
  23. data/lib/unione/api/domain/domain_api.rb +129 -0
  24. data/lib/unione/api/domain/model/dkim_status.rb +18 -0
  25. data/lib/unione/api/domain/model/domain_delete_request.rb +42 -0
  26. data/lib/unione/api/domain/model/domain_delete_response.rb +51 -0
  27. data/lib/unione/api/domain/model/domain_get_dns_records_request.rb +42 -0
  28. data/lib/unione/api/domain/model/domain_get_dns_records_response.rb +76 -0
  29. data/lib/unione/api/domain/model/domain_get_sandbox_domain_response.rb +51 -0
  30. data/lib/unione/api/domain/model/domain_list_request.rb +60 -0
  31. data/lib/unione/api/domain/model/domain_list_response.rb +51 -0
  32. data/lib/unione/api/domain/model/domain_list_response_domains_item.rb +58 -0
  33. data/lib/unione/api/domain/model/domain_list_response_domains_item_dkim.rb +52 -0
  34. data/lib/unione/api/domain/model/domain_list_response_domains_item_verification_record.rb +50 -0
  35. data/lib/unione/api/domain/model/domain_validate_dkim_request.rb +42 -0
  36. data/lib/unione/api/domain/model/domain_validate_dkim_response.rb +51 -0
  37. data/lib/unione/api/domain/model/domain_validate_verification_record_request.rb +42 -0
  38. data/lib/unione/api/domain/model/domain_validate_verification_record_response.rb +51 -0
  39. data/lib/unione/api/email/email_api.rb +56 -0
  40. data/lib/unione/api/email/model/email_send_request.rb +42 -0
  41. data/lib/unione/api/email/model/email_send_response.rb +83 -0
  42. data/lib/unione/api/email/model/email_subscribe_request.rb +58 -0
  43. data/lib/unione/api/email/model/message_object.rb +291 -0
  44. data/lib/unione/api/email/model/message_object_options.rb +70 -0
  45. data/lib/unione/api/email/model/message_object_recipients_item.rb +77 -0
  46. data/lib/unione/api/email_validation/email_validation_api.rb +34 -0
  47. data/lib/unione/api/email_validation/model/email_validation_single_request.rb +42 -0
  48. data/lib/unione/api/email_validation/model/email_validation_single_response.rb +140 -0
  49. data/lib/unione/api/event_dump/event_dump_api.rb +67 -0
  50. data/lib/unione/api/event_dump/model/event_dump_create_request.rb +119 -0
  51. data/lib/unione/api/event_dump/model/event_dump_create_response.rb +52 -0
  52. data/lib/unione/api/event_dump/model/event_dump_delete_request.rb +43 -0
  53. data/lib/unione/api/event_dump/model/event_dump_files_object.rb +51 -0
  54. data/lib/unione/api/event_dump/model/event_dump_get_request.rb +43 -0
  55. data/lib/unione/api/event_dump/model/event_dump_get_response.rb +51 -0
  56. data/lib/unione/api/event_dump/model/event_dump_list_response.rb +52 -0
  57. data/lib/unione/api/event_dump/model/event_dump_object.rb +66 -0
  58. data/lib/unione/api/event_dump/model/filter_object.rb +139 -0
  59. data/lib/unione/api/obsolete/model/obsolete_unsubscribed_check_request.rb +42 -0
  60. data/lib/unione/api/obsolete/model/obsolete_unsubscribed_check_response.rb +59 -0
  61. data/lib/unione/api/obsolete/model/obsolete_unsubscribed_list_request.rb +43 -0
  62. data/lib/unione/api/obsolete/model/obsolete_unsubscribed_list_response.rb +51 -0
  63. data/lib/unione/api/obsolete/model/obsolete_unsubscribed_list_response_unsubscribed_item.rb +50 -0
  64. data/lib/unione/api/obsolete/model/obsolete_unsubscribed_set_message.rb +25 -0
  65. data/lib/unione/api/obsolete/model/obsolete_unsubscribed_set_request.rb +42 -0
  66. data/lib/unione/api/obsolete/model/obsolete_unsubscribed_set_response.rb +64 -0
  67. data/lib/unione/api/obsolete/obsolete_api.rb +57 -0
  68. data/lib/unione/api/project/model/project_create_request.rb +42 -0
  69. data/lib/unione/api/project/model/project_create_response.rb +60 -0
  70. data/lib/unione/api/project/model/project_delete_request.rb +52 -0
  71. data/lib/unione/api/project/model/project_list_object.rb +146 -0
  72. data/lib/unione/api/project/model/project_list_request.rb +50 -0
  73. data/lib/unione/api/project/model/project_list_response.rb +51 -0
  74. data/lib/unione/api/project/model/project_object.rb +94 -0
  75. data/lib/unione/api/project/model/project_update_object.rb +130 -0
  76. data/lib/unione/api/project/model/project_update_request.rb +60 -0
  77. data/lib/unione/api/project/model/project_update_response.rb +52 -0
  78. data/lib/unione/api/project/project_api.rb +71 -0
  79. data/lib/unione/api/suppression/model/suppression_delete_request.rb +42 -0
  80. data/lib/unione/api/suppression/model/suppression_get_object.rb +91 -0
  81. data/lib/unione/api/suppression/model/suppression_get_request.rb +52 -0
  82. data/lib/unione/api/suppression/model/suppression_get_response.rb +59 -0
  83. data/lib/unione/api/suppression/model/suppression_list_object.rb +91 -0
  84. data/lib/unione/api/suppression/model/suppression_list_request.rb +94 -0
  85. data/lib/unione/api/suppression/model/suppression_list_response.rb +61 -0
  86. data/lib/unione/api/suppression/model/suppression_set_request.rb +69 -0
  87. data/lib/unione/api/suppression/suppression_api.rb +63 -0
  88. data/lib/unione/api/system/model/project_accounting_object.rb +62 -0
  89. data/lib/unione/api/system/model/system_info_response.rb +95 -0
  90. data/lib/unione/api/system/model/system_info_response_accounting.rb +68 -0
  91. data/lib/unione/api/system/model/system_ping_response.rb +51 -0
  92. data/lib/unione/api/system/system_api.rb +35 -0
  93. data/lib/unione/api/tag/model/tag_delete_request.rb +42 -0
  94. data/lib/unione/api/tag/model/tag_list_response.rb +51 -0
  95. data/lib/unione/api/tag/model/tags_response_object.rb +50 -0
  96. data/lib/unione/api/tag/tag_api.rb +40 -0
  97. data/lib/unione/api/template/model/editor_type.rb +19 -0
  98. data/lib/unione/api/template/model/template_delete_request.rb +42 -0
  99. data/lib/unione/api/template/model/template_get_request.rb +42 -0
  100. data/lib/unione/api/template/model/template_get_response.rb +51 -0
  101. data/lib/unione/api/template/model/template_list_object.rb +232 -0
  102. data/lib/unione/api/template/model/template_list_request.rb +52 -0
  103. data/lib/unione/api/template/model/template_list_response.rb +51 -0
  104. data/lib/unione/api/template/model/template_object.rb +201 -0
  105. data/lib/unione/api/template/model/template_set_request.rb +42 -0
  106. data/lib/unione/api/template/model/template_set_response.rb +51 -0
  107. data/lib/unione/api/template/template_api.rb +66 -0
  108. data/lib/unione/api/webhook/model/block_type.rb +20 -0
  109. data/lib/unione/api/webhook/model/device_type.rb +22 -0
  110. data/lib/unione/api/webhook/model/domain_status.rb +19 -0
  111. data/lib/unione/api/webhook/model/event_name.rb +19 -0
  112. data/lib/unione/api/webhook/model/traffic_type.rb +24 -0
  113. data/lib/unione/api/webhook/model/webhook_callback.rb +52 -0
  114. data/lib/unione/api/webhook/model/webhook_callback_events_by_user_item.rb +66 -0
  115. data/lib/unione/api/webhook/model/webhook_callback_events_by_user_item_events_item.rb +52 -0
  116. data/lib/unione/api/webhook/model/webhook_callback_events_by_user_item_events_item_event_data.rb +167 -0
  117. data/lib/unione/api/webhook/model/webhook_callback_events_by_user_item_events_item_event_data_delivery_info.rb +192 -0
  118. data/lib/unione/api/webhook/model/webhook_delete_request.rb +42 -0
  119. data/lib/unione/api/webhook/model/webhook_event_format.rb +18 -0
  120. data/lib/unione/api/webhook/model/webhook_events_object.rb +52 -0
  121. data/lib/unione/api/webhook/model/webhook_get_request.rb +42 -0
  122. data/lib/unione/api/webhook/model/webhook_get_response.rb +51 -0
  123. data/lib/unione/api/webhook/model/webhook_list_request.rb +51 -0
  124. data/lib/unione/api/webhook/model/webhook_list_response.rb +51 -0
  125. data/lib/unione/api/webhook/model/webhook_object.rb +123 -0
  126. data/lib/unione/api/webhook/model/webhook_set_request.rb +109 -0
  127. data/lib/unione/api/webhook/model/webhook_set_response.rb +51 -0
  128. data/lib/unione/api/webhook/model/webhook_status.rb +21 -0
  129. data/lib/unione/api/webhook/webhook_api.rb +89 -0
  130. data/lib/unione/client/api_client.rb +93 -0
  131. data/lib/unione/client/api_error.rb +22 -0
  132. data/lib/unione/client/configuration.rb +49 -0
  133. data/lib/unione/client/decode.rb +33 -0
  134. data/lib/unione/common/model/attachments_array_item.rb +59 -0
  135. data/lib/unione/common/model/body_object.rb +57 -0
  136. data/lib/unione/common/model/email_counter_mode.rb +21 -0
  137. data/lib/unione/common/model/email_status.rb +23 -0
  138. data/lib/unione/common/model/headers_object.rb +72 -0
  139. data/lib/unione/common/model/inline_attachments_array_item.rb +59 -0
  140. data/lib/unione/common/model/success_response.rb +41 -0
  141. data/lib/unione/common/model/template_engine.rb +19 -0
  142. data/lib/unione/common/model/verification_record_status.rb +16 -0
  143. data/lib/unione/uni_one_client.rb +127 -0
  144. data/lib/unione/version.rb +5 -0
  145. data/lib/unione.rb +130 -0
  146. metadata +187 -0
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module Suppression
6
+ module Model
7
+ # SuppressionDeleteRequest
8
+ class SuppressionDeleteRequest
9
+ # An email to delete from suppression list.
10
+ # @return [String, nil]
11
+ attr_accessor :email
12
+
13
+ def initialize(
14
+ email:
15
+ )
16
+ @email = email
17
+ end
18
+
19
+ # Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
20
+ # gives nil (data that is not a Hash gives an empty object).
21
+ def self.from_h(data)
22
+ data = {} unless data.is_a?(Hash)
23
+ new(
24
+ email: data['email']
25
+ )
26
+ end
27
+
28
+ # JSON-ready hash, nil fields are omitted.
29
+ def to_h
30
+ {
31
+ 'email' => @email,
32
+ }.compact
33
+ end
34
+
35
+ def to_json(*args)
36
+ to_h.to_json(*args)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,91 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module Suppression
6
+ module Model
7
+ # Object with suppression details.
8
+ class SuppressionGetObject
9
+ # Unqiue project identifier, ASCII string up to 36 characters long.
10
+ # @return [String, nil]
11
+ attr_accessor :project_id
12
+
13
+ # Cause of email being suppressed. One of:
14
+ #
15
+ # - __unsubscribed__ - email is unsubscribed;
16
+ # - __temporary_unavailable__ - the email address is unavailable. This means that over the next three days sending to this address will return an error. Email may be temporarily unavailable due to several reasons, e.g.:
17
+ #
18
+ # - a previous email has been rejected by the recipient's server for spam;
19
+ # - the recipient's mailbox is full or is not used;
20
+ # - recipient's domain does not accept mail;
21
+ # - sending server was rejected due to blacklisting;
22
+ #
23
+ # - __permanent_unavailable__ - the email address is permanently unavailable due to multiple hard bounces;
24
+ # - __complained__ - the recipient reported spam in the previous emails;
25
+ # - __blocked__ - sending to the email is prohibited by administration of UniOne.
26
+ # We may add some new causes in the future.
27
+ # @return [String, nil]
28
+ attr_accessor :cause
29
+
30
+ # Source of email being suppressed. One of:
31
+ #
32
+ # - __user__ - suppressed by user with [suppression/set](https://docs.unione.io/en/web-api-ref#suppression-set);
33
+ # - __system__ - sending to the email is prohibited by system, for example due to multiple hard bounces;
34
+ # - __subscriber__ - the recipient reported spam or unsubscribed in the previous emails.
35
+ # @return [String, nil]
36
+ attr_accessor :source
37
+
38
+ # Is it possible to delete this suppression by calling suppression/delete method.
39
+ # @return [Boolean, nil]
40
+ attr_accessor :is_deletable
41
+
42
+ # When suppression was created, in UTC timezone in "YYYY-MM-DD hh:mm:ss" format.
43
+ # @return [String, nil]
44
+ attr_accessor :created
45
+
46
+ def initialize(
47
+ project_id: nil,
48
+ cause: nil,
49
+ source: nil,
50
+ is_deletable: nil,
51
+ created: nil
52
+ )
53
+ @project_id = project_id
54
+ @cause = cause
55
+ @source = source
56
+ @is_deletable = is_deletable
57
+ @created = created
58
+ end
59
+
60
+ # Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
61
+ # gives nil (data that is not a Hash gives an empty object).
62
+ def self.from_h(data)
63
+ data = {} unless data.is_a?(Hash)
64
+ new(
65
+ project_id: data['project_id'],
66
+ cause: data['cause'],
67
+ source: data['source'],
68
+ is_deletable: data['is_deletable'],
69
+ created: data['created']
70
+ )
71
+ end
72
+
73
+ # JSON-ready hash, nil fields are omitted.
74
+ def to_h
75
+ {
76
+ 'project_id' => @project_id,
77
+ 'cause' => @cause,
78
+ 'source' => @source,
79
+ 'is_deletable' => @is_deletable,
80
+ 'created' => @created,
81
+ }.compact
82
+ end
83
+
84
+ def to_json(*args)
85
+ to_h.to_json(*args)
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module Suppression
6
+ module Model
7
+ # SuppressionGetRequest
8
+ class SuppressionGetRequest
9
+ # Email to get suppression details for.
10
+ # @return [String, nil]
11
+ attr_accessor :email
12
+
13
+ # If a user has projects functionality enabled, he/she can pass all_projects=true to search in all
14
+ # projects' data.
15
+ # Default: `False`.
16
+ # @return [Boolean, nil]
17
+ attr_accessor :all_projects
18
+
19
+ def initialize(
20
+ email:,
21
+ all_projects: nil
22
+ )
23
+ @email = email
24
+ @all_projects = all_projects
25
+ end
26
+
27
+ # Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
28
+ # gives nil (data that is not a Hash gives an empty object).
29
+ def self.from_h(data)
30
+ data = {} unless data.is_a?(Hash)
31
+ new(
32
+ email: data['email'],
33
+ all_projects: data['all_projects']
34
+ )
35
+ end
36
+
37
+ # JSON-ready hash, nil fields are omitted.
38
+ def to_h
39
+ {
40
+ 'email' => @email,
41
+ 'all_projects' => @all_projects,
42
+ }.compact
43
+ end
44
+
45
+ def to_json(*args)
46
+ to_h.to_json(*args)
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module Suppression
6
+ module Model
7
+ # SuppressionGetResponse
8
+ class SuppressionGetResponse
9
+ # "success" string
10
+ # Allowed values: `success`.
11
+ # @return [String, nil]
12
+ attr_accessor :status
13
+
14
+ # The email for which suppression details were requested.
15
+ # @return [String, nil]
16
+ attr_accessor :email
17
+
18
+ # Array of suppression objects.
19
+ # @return [Array<SuppressionGetObject>, nil]
20
+ attr_accessor :suppressions
21
+
22
+ def initialize(
23
+ status: nil,
24
+ email: nil,
25
+ suppressions: nil
26
+ )
27
+ @status = status
28
+ @email = email
29
+ @suppressions = suppressions
30
+ end
31
+
32
+ # Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
33
+ # gives nil (data that is not a Hash gives an empty object).
34
+ def self.from_h(data)
35
+ data = {} unless data.is_a?(Hash)
36
+ new(
37
+ status: data['status'],
38
+ email: data['email'],
39
+ suppressions: ::UniOne::Client::Decode.list(data['suppressions']) { |item0| ::UniOne::Client::Decode.model(::UniOne::Api::Suppression::Model::SuppressionGetObject, item0) }
40
+ )
41
+ end
42
+
43
+ # JSON-ready hash, nil fields are omitted.
44
+ def to_h
45
+ {
46
+ 'status' => @status,
47
+ 'email' => @email,
48
+ 'suppressions' => @suppressions.nil? ? nil : @suppressions.map { |item0| item0.to_h },
49
+ }.compact
50
+ end
51
+
52
+ def to_json(*args)
53
+ to_h.to_json(*args)
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,91 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module Suppression
6
+ module Model
7
+ # Object with suppression details.
8
+ class SuppressionListObject
9
+ # Email to get suppression details for.
10
+ # @return [String, nil]
11
+ attr_accessor :email
12
+
13
+ # Cause of email being suppressed. One of:
14
+ #
15
+ # - __unsubscribed__ - email is unsubscribed;
16
+ # - __temporary_unavailable__ - the email address is unavailable. This means that over the next three days sending to this address will return an error. Email may be temporarily unavailable due to several reasons, e.g.:
17
+ #
18
+ # - a previous email has been rejected by the recipient's server for spam;
19
+ # - the recipient's mailbox is full or is not used;
20
+ # - recipient's domain does not accept mail;
21
+ # - sending server was rejected due to blacklisting;
22
+ #
23
+ # - __permanent_unavailable__ - the email address is permanently unavailable due to multiple hard bounces;
24
+ # - __complained__ - the recipient reported spam in the previous emails;
25
+ # - __blocked__ - sending to the email is prohibited by administration of UniOne.
26
+ # We may add some new causes in the future.
27
+ # @return [String, nil]
28
+ attr_accessor :cause
29
+
30
+ # Source of email being suppressed. One of:
31
+ #
32
+ # - __user__ - suppressed by user with [suppression/set](https://docs.unione.io/en/web-api-ref#suppression-set);
33
+ # - __system__ - sending to the email is prohibited by system, for example due to multiple hard bounces;
34
+ # - __subscriber__ - the recipient reported spam or unsubscribed in the previous emails.
35
+ # @return [String, nil]
36
+ attr_accessor :source
37
+
38
+ # Is it possible to delete this suppression by calling suppression/delete method.
39
+ # @return [Boolean, nil]
40
+ attr_accessor :is_deletable
41
+
42
+ # When suppression was created, in UTC timezone in "YYYY-MM-DD hh:mm:ss" format.
43
+ # @return [String, nil]
44
+ attr_accessor :created
45
+
46
+ def initialize(
47
+ email: nil,
48
+ cause: nil,
49
+ source: nil,
50
+ is_deletable: nil,
51
+ created: nil
52
+ )
53
+ @email = email
54
+ @cause = cause
55
+ @source = source
56
+ @is_deletable = is_deletable
57
+ @created = created
58
+ end
59
+
60
+ # Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
61
+ # gives nil (data that is not a Hash gives an empty object).
62
+ def self.from_h(data)
63
+ data = {} unless data.is_a?(Hash)
64
+ new(
65
+ email: data['email'],
66
+ cause: data['cause'],
67
+ source: data['source'],
68
+ is_deletable: data['is_deletable'],
69
+ created: data['created']
70
+ )
71
+ end
72
+
73
+ # JSON-ready hash, nil fields are omitted.
74
+ def to_h
75
+ {
76
+ 'email' => @email,
77
+ 'cause' => @cause,
78
+ 'source' => @source,
79
+ 'is_deletable' => @is_deletable,
80
+ 'created' => @created,
81
+ }.compact
82
+ end
83
+
84
+ def to_json(*args)
85
+ to_h.to_json(*args)
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,94 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module Suppression
6
+ module Model
7
+ # SuppressionListRequest
8
+ class SuppressionListRequest
9
+ # Cause of email being suppressed. One of:
10
+ #
11
+ # - __unsubscribed__ - email is unsubscribed;
12
+ # - __temporary_unavailable__ - the email address is unavailable. This means that over the next three days sending to this address will return an error. Email may be temporarily unavailable due to several reasons, e.g.:
13
+ #
14
+ # - a previous email has been rejected by the recipient's server for spam;
15
+ # - the recipient's mailbox is full or is not used;
16
+ # - recipient's domain does not accept mail;
17
+ # - sending server was rejected due to blacklisting;
18
+ #
19
+ # - __permanent_unavailable__ - the email address is permanently unavailable due to multiple hard bounces;
20
+ # - __complained__ - the recipient reported spam in the previous emails;
21
+ # - __blocked__ - sending to the email is prohibited by administration of UniOne.
22
+ # We may add some new causes in the future.
23
+ # @return [String, nil]
24
+ attr_accessor :cause
25
+
26
+ # Source of email being suppressed. One of:
27
+ #
28
+ # - __user__ - suppressed by user with [suppression/set](https://docs.unione.io/en/web-api-ref#suppression-set);
29
+ # - __system__ - sending to the email is prohibited by system, for example due to multiple hard bounces;
30
+ # - __subscriber__ - the recipient reported spam or unsubscribed in the previous emails.
31
+ # @return [String, nil]
32
+ attr_accessor :source
33
+
34
+ # Date in the format YYYY-MM-DD hh:mm:ss to get suppression list from the "start_time" to the present
35
+ # day. Ignored if "cursor" is not empty.
36
+ # @return [String, nil]
37
+ attr_accessor :start_time
38
+
39
+ # The parameter indicates from which position the selection is to be started. Must be empty or omitted
40
+ # for the first data chunk. In order to get subsequent chunks, you must set the "cursor" parameter in
41
+ # your request, using the value received in response to the previous request.
42
+ # @return [String, nil]
43
+ attr_accessor :cursor
44
+
45
+ # Limits the number of records to be returned at one time, default is 50.
46
+ # @return [Integer, nil]
47
+ attr_accessor :limit
48
+
49
+ def initialize(
50
+ cause: nil,
51
+ source: nil,
52
+ start_time: nil,
53
+ cursor: nil,
54
+ limit: nil
55
+ )
56
+ @cause = cause
57
+ @source = source
58
+ @start_time = start_time
59
+ @cursor = cursor
60
+ @limit = limit
61
+ end
62
+
63
+ # Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
64
+ # gives nil (data that is not a Hash gives an empty object).
65
+ def self.from_h(data)
66
+ data = {} unless data.is_a?(Hash)
67
+ new(
68
+ cause: data['cause'],
69
+ source: data['source'],
70
+ start_time: data['start_time'],
71
+ cursor: data['cursor'],
72
+ limit: data['limit']
73
+ )
74
+ end
75
+
76
+ # JSON-ready hash, nil fields are omitted.
77
+ def to_h
78
+ {
79
+ 'cause' => @cause,
80
+ 'source' => @source,
81
+ 'start_time' => @start_time,
82
+ 'cursor' => @cursor,
83
+ 'limit' => @limit,
84
+ }.compact
85
+ end
86
+
87
+ def to_json(*args)
88
+ to_h.to_json(*args)
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module Suppression
6
+ module Model
7
+ # SuppressionListResponse
8
+ class SuppressionListResponse
9
+ # "success" string
10
+ # Allowed values: `success`.
11
+ # @return [String, nil]
12
+ attr_accessor :status
13
+
14
+ # Array of suppression objects.
15
+ # @return [Array<SuppressionListObject>, nil]
16
+ attr_accessor :suppressions
17
+
18
+ # The parameter indicates from which position the selection is to be started. Must be empty or omitted
19
+ # for the first data chunk. In order to get subsequent chunks, you must set the "cursor" parameter in
20
+ # your request, using the value received in response to the previous request.
21
+ # @return [String, nil]
22
+ attr_accessor :cursor
23
+
24
+ def initialize(
25
+ status: nil,
26
+ suppressions: nil,
27
+ cursor: nil
28
+ )
29
+ @status = status
30
+ @suppressions = suppressions
31
+ @cursor = cursor
32
+ end
33
+
34
+ # Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
35
+ # gives nil (data that is not a Hash gives an empty object).
36
+ def self.from_h(data)
37
+ data = {} unless data.is_a?(Hash)
38
+ new(
39
+ status: data['status'],
40
+ suppressions: ::UniOne::Client::Decode.list(data['suppressions']) { |item0| ::UniOne::Client::Decode.model(::UniOne::Api::Suppression::Model::SuppressionListObject, item0) },
41
+ cursor: data['cursor']
42
+ )
43
+ end
44
+
45
+ # JSON-ready hash, nil fields are omitted.
46
+ def to_h
47
+ {
48
+ 'status' => @status,
49
+ 'suppressions' => @suppressions.nil? ? nil : @suppressions.map { |item0| item0.to_h },
50
+ 'cursor' => @cursor,
51
+ }.compact
52
+ end
53
+
54
+ def to_json(*args)
55
+ to_h.to_json(*args)
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module Suppression
6
+ module Model
7
+ # SuppressionSetRequest
8
+ class SuppressionSetRequest
9
+ # Email to add in suppression list.
10
+ # @return [String, nil]
11
+ attr_accessor :email
12
+
13
+ # Cause of email being suppressed. One of:
14
+ #
15
+ # - __unsubscribed__ - email is unsubscribed;
16
+ # - __temporary_unavailable__ - the email address is unavailable. This means that over the next three days sending to this address will return an error. Email may be temporarily unavailable due to several reasons, e.g.:
17
+ #
18
+ # - a previous email has been rejected by the recipient's server for spam;
19
+ # - the recipient's mailbox is full or is not used;
20
+ # - recipient's domain does not accept mail;
21
+ # - sending server was rejected due to blacklisting;
22
+ #
23
+ # - __permanent_unavailable__ - the email address is permanently unavailable due to multiple hard bounces;
24
+ # - __complained__ - the recipient reported spam in the previous emails;
25
+ # @return [String, nil]
26
+ attr_accessor :cause
27
+
28
+ # When suppression was created, in UTC timezone in "YYYY-MM-DD hh:mm:ss" format.
29
+ # @return [String, nil]
30
+ attr_accessor :created
31
+
32
+ def initialize(
33
+ email:,
34
+ cause:,
35
+ created: nil
36
+ )
37
+ @email = email
38
+ @cause = cause
39
+ @created = created
40
+ end
41
+
42
+ # Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
43
+ # gives nil (data that is not a Hash gives an empty object).
44
+ def self.from_h(data)
45
+ data = {} unless data.is_a?(Hash)
46
+ new(
47
+ email: data['email'],
48
+ cause: data['cause'],
49
+ created: data['created']
50
+ )
51
+ end
52
+
53
+ # JSON-ready hash, nil fields are omitted.
54
+ def to_h
55
+ {
56
+ 'email' => @email,
57
+ 'cause' => @cause,
58
+ 'created' => @created,
59
+ }.compact
60
+ end
61
+
62
+ def to_json(*args)
63
+ to_h.to_json(*args)
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+
5
+ module UniOne
6
+ module Api
7
+ module Suppression
8
+ # Methods for managing suppression lists. An email can be added to suppression list because of
9
+ # unsubscription, bounce or complain.
10
+ class SuppressionApi
11
+ # @param client [::UniOne::Client::ApiClient]
12
+ def initialize(client)
13
+ @client = client
14
+ end
15
+
16
+ # Adds an email address to the suppression list. You can always remove this address from the
17
+ # suppression list later using the
18
+ # [suppression/delete](https://docs.unione.io/en/web-api-ref#suppression-delete) method.
19
+ #
20
+ # Documentation: https://docs.unione.io/en/web-api-ref#suppression-set
21
+ # @param request [::UniOne::Api::Suppression::Model::SuppressionSetRequest, Hash]
22
+ # @return [::UniOne::Common::Model::SuccessResponse]
23
+ # @raise [::UniOne::Client::ApiError]
24
+ def set(request)
25
+ ::UniOne::Common::Model::SuccessResponse.from_h(@client.call('/suppression/set.json', request.is_a?(Hash) ? request : request.to_h))
26
+ end
27
+
28
+ # Gets a reason and date of email suppression.
29
+ #
30
+ # Documentation: https://docs.unione.io/en/web-api-ref#suppression-get
31
+ # @param request [::UniOne::Api::Suppression::Model::SuppressionGetRequest, Hash]
32
+ # @return [::UniOne::Api::Suppression::Model::SuppressionGetResponse]
33
+ # @raise [::UniOne::Client::ApiError]
34
+ def get(request)
35
+ ::UniOne::Api::Suppression::Model::SuppressionGetResponse.from_h(@client.call('/suppression/get.json', request.is_a?(Hash) ? request : request.to_h))
36
+ end
37
+
38
+ # Returns a suppression list since provided date.
39
+ #
40
+ # Documentation: https://docs.unione.io/en/web-api-ref#suppression-list
41
+ # @param request [::UniOne::Api::Suppression::Model::SuppressionListRequest, Hash]
42
+ # @return [::UniOne::Api::Suppression::Model::SuppressionListResponse]
43
+ # @raise [::UniOne::Client::ApiError]
44
+ def list(request)
45
+ ::UniOne::Api::Suppression::Model::SuppressionListResponse.from_h(@client.call('/suppression/list.json', request.is_a?(Hash) ? request : request.to_h))
46
+ end
47
+
48
+ # Deletes an email from suppression list (only records with is_deletable=true). If there are no
49
+ # entries of this email in the suppression list, API error 3003 is returned. If such entries exist but
50
+ # no one can be deleted, API error 3004 is returned. If daily limit of deletes exceeded, API error 906
51
+ # is returned.
52
+ #
53
+ # Documentation: https://docs.unione.io/en/web-api-ref#suppression-delete
54
+ # @param request [::UniOne::Api::Suppression::Model::SuppressionDeleteRequest, Hash]
55
+ # @return [::UniOne::Common::Model::SuccessResponse]
56
+ # @raise [::UniOne::Client::ApiError]
57
+ def delete(request)
58
+ ::UniOne::Common::Model::SuccessResponse.from_h(@client.call('/suppression/delete.json', request.is_a?(Hash) ? request : request.to_h))
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module System
6
+ module Model
7
+ # Object with email counter properties. Present only if the API key used for request is the user API
8
+ # key.
9
+ class ProjectAccountingObject
10
+ # Project's email counter value. It increases on every email sent.
11
+ # @return [Integer, nil]
12
+ attr_accessor :email_counter
13
+
14
+ # Allows you to limit the number of emails sent by the project. The sending stops when the limit is
15
+ # reached. Any non-negative 64-bit integer is acceptable. 0 means no limit.
16
+ # @return [Integer, nil]
17
+ attr_accessor :email_counter_limit
18
+
19
+ # 'default' - the counter resets to zero automatically at the beginning of each accounting period.
20
+ # 'permanent' - the counter never resets automatically.
21
+ # Default: `default`.
22
+ # @return [EmailCounterMode, nil]
23
+ attr_accessor :email_counter_mode
24
+
25
+ def initialize(
26
+ email_counter: nil,
27
+ email_counter_limit: nil,
28
+ email_counter_mode: nil
29
+ )
30
+ @email_counter = email_counter
31
+ @email_counter_limit = email_counter_limit
32
+ @email_counter_mode = email_counter_mode
33
+ end
34
+
35
+ # Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
36
+ # gives nil (data that is not a Hash gives an empty object).
37
+ def self.from_h(data)
38
+ data = {} unless data.is_a?(Hash)
39
+ new(
40
+ email_counter: data['email_counter'],
41
+ email_counter_limit: data['email_counter_limit'],
42
+ email_counter_mode: data['email_counter_mode']
43
+ )
44
+ end
45
+
46
+ # JSON-ready hash, nil fields are omitted.
47
+ def to_h
48
+ {
49
+ 'email_counter' => @email_counter,
50
+ 'email_counter_limit' => @email_counter_limit,
51
+ 'email_counter_mode' => @email_counter_mode,
52
+ }.compact
53
+ end
54
+
55
+ def to_json(*args)
56
+ to_h.to_json(*args)
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end