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,129 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+
5
+ module UniOne
6
+ module Api
7
+ module Domain
8
+ # You can use these methods to setup sender domains and check their statuses. They might be useful in
9
+ # case you want to automate adding domains for your own clients.
10
+ #
11
+ # To add new sender domain thru API you should take following steps:
12
+ # - Get DNS records with [domain/get-dns-records](https://docs.unione.io/en/web-api-ref#domain-get-dns-records) method and add them to your DNS provider.
13
+ # - Every 5-10 minutes call [domain/list](https://docs.unione.io/en/web-api-ref#domain-list) method for your domain (or several domains) and check verification-record.status and dkim.status in the response. You can call it more often if you like, but please not more than once per minute.
14
+ # - If verification-record.status="unconfirmed" then you should call [domain/validate-verification-record](https://docs.unione.io/en/web-api-ref#domain-validate-verification-record) to trigger verification record validation.
15
+ # - If dkim.status="inactive" then start DKIM checking by calling [domain/validate-dkim](https://docs.unione.io/en/web-api-ref#domain-validate-dkim) (UniOne itself checks DKIM every 30 minutes also)
16
+ # - When you get verification-record.status="confirmed" and dkim.status="active" for the domain then you can stop checking it's status with domain/list and start using it as a sender domain.
17
+ class DomainApi
18
+ # @param client [::UniOne::Client::ApiClient]
19
+ def initialize(client)
20
+ @client = client
21
+ end
22
+
23
+ # Returns info on domain DNS setup for using with UniOne.
24
+ #
25
+ # In order to send emails you have to confirm that you own the domain that you are going to send
26
+ # emails from and setup DKIM signature for the domain. This method allows you to register your domain
27
+ # in UniOne and generate verification record and DKIM key, or return previously generated ones if
28
+ # domain is already registered.
29
+ # You should add then DNS records like this to all of the domains you want to confirm:
30
+ #
31
+ # `@ IN TXT "unione-validate-hash=483bb362ebdbeedd755cfb1d4d661"`
32
+ #
33
+ # `us._domainkey IN TXT "k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDo7"`
34
+ #
35
+ # `@ IN TXT "v=spf1 include:spf.unione.io ~all"`
36
+ #
37
+ # - First record value should contain "verification-record" field returned by get-dns-records method "as is".
38
+ # - Second record value should contain "dkim" field value after "p=". Mind the name of this record! "us._domainkey." prefix is important for DKIM selector of UniOne to work properly.
39
+ # - Third record contains optional, but very recommended SPF entry. Probably you already have one, then just add append include:spf.unione.io right after v=spf1.
40
+ #
41
+ # Syntax requirements of different DNS providers may differ:
42
+ # - sometimes it's necesarry to put full domain name instead of @ sign.
43
+ # - some providers require add TTL value (like 3600)
44
+ # - some providers don't require quotes for enclosing values
45
+ # Please check requirements of your provider and advice your users to do it.
46
+ #
47
+ # Documentation: https://docs.unione.io/en/web-api-ref#domain-get-dns-records
48
+ # @param request [::UniOne::Api::Domain::Model::DomainGetDnsRecordsRequest, Hash]
49
+ # @return [::UniOne::Api::Domain::Model::DomainGetDnsRecordsResponse]
50
+ # @raise [::UniOne::Client::ApiError]
51
+ def get_dns_records(request)
52
+ ::UniOne::Api::Domain::Model::DomainGetDnsRecordsResponse.from_h(@client.call('/domain/get-dns-records.json', request.is_a?(Hash) ? request : request.to_h))
53
+ end
54
+
55
+ # Triggers verification record validation for domain.
56
+ #
57
+ # If you get 200 OK then it means the validation process started succesfully, but it doesn't mean the
58
+ # verification record is valid. You should check later verification-record.status field returned by
59
+ # [domain/list](https://docs.unione.io/en/web-api-ref#domain-list) method to get the result. Please
60
+ # read more [here](https://docs.unione.io/en/web-api-ref#domain).
61
+ #
62
+ # Documentation: https://docs.unione.io/en/web-api-ref#domain-validate-verification-record
63
+ # @param request [::UniOne::Api::Domain::Model::DomainValidateVerificationRecordRequest, Hash]
64
+ # @return [::UniOne::Api::Domain::Model::DomainValidateVerificationRecordResponse]
65
+ # @raise [::UniOne::Client::ApiError]
66
+ def validate_verification_record(request)
67
+ ::UniOne::Api::Domain::Model::DomainValidateVerificationRecordResponse.from_h(@client.call('/domain/validate-verification-record.json', request.is_a?(Hash) ? request : request.to_h))
68
+ end
69
+
70
+ # Validates DKIM record for domain.
71
+ #
72
+ # If you get 200 OK then it means the validation process started succesfully, but it doesn't mean the
73
+ # DKIM record is valid. You should check later dkim.status field returned by
74
+ # [domain/list](https://docs.unione.io/en/web-api-ref#domain-list) method to get the result. Please
75
+ # read more [here](https://docs.unione.io/en/web-api-ref#domain).
76
+ #
77
+ # Documentation: https://docs.unione.io/en/web-api-ref#domain-validate-dkim
78
+ # @param request [::UniOne::Api::Domain::Model::DomainValidateDkimRequest, Hash]
79
+ # @return [::UniOne::Api::Domain::Model::DomainValidateDkimResponse]
80
+ # @raise [::UniOne::Client::ApiError]
81
+ def validate_dkim(request)
82
+ ::UniOne::Api::Domain::Model::DomainValidateDkimResponse.from_h(@client.call('/domain/validate-dkim.json', request.is_a?(Hash) ? request : request.to_h))
83
+ end
84
+
85
+ # Returns a list of all registered domains for user or project, together with statuses of last
86
+ # validations.
87
+ #
88
+ # Returns last status of ownership validation and DKIM validation for each domain. Read more
89
+ # [here](https://docs.unione.io/en/web-api-ref#domain).
90
+ #
91
+ # Documentation: https://docs.unione.io/en/web-api-ref#domain-list
92
+ # @param request [::UniOne::Api::Domain::Model::DomainListRequest, Hash]
93
+ # @return [::UniOne::Api::Domain::Model::DomainListResponse]
94
+ # @raise [::UniOne::Client::ApiError]
95
+ def list(request)
96
+ ::UniOne::Api::Domain::Model::DomainListResponse.from_h(@client.call('/domain/list.json', request.is_a?(Hash) ? request : request.to_h))
97
+ end
98
+
99
+ # Creates a sandbox domain for the account or returns the existing one.
100
+ #
101
+ # Returns an account sandbox domain that is ready for use in the `from_email` field of
102
+ # [email/send](https://docs.unione.io/en/web-api-ref#email-send). If the account has no sandbox
103
+ # domain, UniOne creates one and returns it. Repeated calls return the same domain.
104
+ #
105
+ # The method is available only with an account API key. Project API keys cannot create sandbox
106
+ # domains.
107
+ #
108
+ # Documentation: https://docs.unione.io/en/web-api-ref#domain-get-sandbox-domain
109
+ # @return [::UniOne::Api::Domain::Model::DomainGetSandboxDomainResponse]
110
+ # @raise [::UniOne::Client::ApiError]
111
+ def get_sandbox_domain
112
+ ::UniOne::Api::Domain::Model::DomainGetSandboxDomainResponse.from_h(@client.call('/domain/get-sandbox-domain.json'))
113
+ end
114
+
115
+ # Deletes a domain. Attention: you should use project's API key to delete a project's domain.
116
+ #
117
+ # Deletes a domain.
118
+ #
119
+ # Documentation: https://docs.unione.io/en/web-api-ref#domain-delete
120
+ # @param request [::UniOne::Api::Domain::Model::DomainDeleteRequest, Hash]
121
+ # @return [::UniOne::Api::Domain::Model::DomainDeleteResponse]
122
+ # @raise [::UniOne::Client::ApiError]
123
+ def delete(request)
124
+ ::UniOne::Api::Domain::Model::DomainDeleteResponse.from_h(@client.call('/domain/delete.json', request.is_a?(Hash) ? request : request.to_h))
125
+ end
126
+ end
127
+ end
128
+ end
129
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module Domain
6
+ module Model
7
+ # Only domains with "active" DKIM record are allowed as sender domains.
8
+ module DkimStatus
9
+ ACTIVE = 'active'
10
+ INACTIVE = 'inactive'
11
+
12
+ # All values
13
+ ALL = [ACTIVE, INACTIVE].freeze
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module Domain
6
+ module Model
7
+ # DomainDeleteRequest
8
+ class DomainDeleteRequest
9
+ # Domain name to delete.
10
+ # @return [String, nil]
11
+ attr_accessor :domain
12
+
13
+ def initialize(
14
+ domain:
15
+ )
16
+ @domain = domain
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
+ domain: data['domain']
25
+ )
26
+ end
27
+
28
+ # JSON-ready hash, nil fields are omitted.
29
+ def to_h
30
+ {
31
+ 'domain' => @domain,
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,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module Domain
6
+ module Model
7
+ # DomainDeleteResponse
8
+ class DomainDeleteResponse
9
+ # "success" string
10
+ # Allowed values: `success`.
11
+ # @return [String, nil]
12
+ attr_accessor :status
13
+
14
+ # Domain deleted
15
+ # @return [String, nil]
16
+ attr_accessor :message
17
+
18
+ def initialize(
19
+ status: nil,
20
+ message: nil
21
+ )
22
+ @status = status
23
+ @message = message
24
+ end
25
+
26
+ # Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
27
+ # gives nil (data that is not a Hash gives an empty object).
28
+ def self.from_h(data)
29
+ data = {} unless data.is_a?(Hash)
30
+ new(
31
+ status: data['status'],
32
+ message: data['message']
33
+ )
34
+ end
35
+
36
+ # JSON-ready hash, nil fields are omitted.
37
+ def to_h
38
+ {
39
+ 'status' => @status,
40
+ 'message' => @message,
41
+ }.compact
42
+ end
43
+
44
+ def to_json(*args)
45
+ to_h.to_json(*args)
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module Domain
6
+ module Model
7
+ # DomainGetDnsRecordsRequest
8
+ class DomainGetDnsRecordsRequest
9
+ # Domain to get DNS records for.
10
+ # @return [String, nil]
11
+ attr_accessor :domain
12
+
13
+ def initialize(
14
+ domain:
15
+ )
16
+ @domain = domain
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
+ domain: data['domain']
25
+ )
26
+ end
27
+
28
+ # JSON-ready hash, nil fields are omitted.
29
+ def to_h
30
+ {
31
+ 'domain' => @domain,
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,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module Domain
6
+ module Model
7
+ # DomainGetDnsRecordsResponse
8
+ class DomainGetDnsRecordsResponse
9
+ # "success" string
10
+ # Allowed values: `success`.
11
+ # @return [String, nil]
12
+ attr_accessor :status
13
+
14
+ # Domain to get DNS records for.
15
+ # @return [String, nil]
16
+ attr_accessor :domain
17
+
18
+ # Record to be added "as is" to verify ownership of this domain.
19
+ # @return [String, nil]
20
+ attr_accessor :verification_record
21
+
22
+ # DKIM signature for the domain. This property contains only the key part, you should prepend it with
23
+ # "v=DKIM1; k=rsa; p=" for the TXT record to be valid.
24
+ # @return [String, nil]
25
+ attr_accessor :dkim
26
+
27
+ # Target of the CNAME record for the "_dmarc" host of the domain.
28
+ # @return [String, nil]
29
+ attr_accessor :dmarc
30
+
31
+ def initialize(
32
+ status: nil,
33
+ domain: nil,
34
+ verification_record: nil,
35
+ dkim: nil,
36
+ dmarc: nil
37
+ )
38
+ @status = status
39
+ @domain = domain
40
+ @verification_record = verification_record
41
+ @dkim = dkim
42
+ @dmarc = dmarc
43
+ end
44
+
45
+ # Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
46
+ # gives nil (data that is not a Hash gives an empty object).
47
+ def self.from_h(data)
48
+ data = {} unless data.is_a?(Hash)
49
+ new(
50
+ status: data['status'],
51
+ domain: data['domain'],
52
+ verification_record: data['verification-record'],
53
+ dkim: data['dkim'],
54
+ dmarc: data['dmarc']
55
+ )
56
+ end
57
+
58
+ # JSON-ready hash, nil fields are omitted.
59
+ def to_h
60
+ {
61
+ 'status' => @status,
62
+ 'domain' => @domain,
63
+ 'verification-record' => @verification_record,
64
+ 'dkim' => @dkim,
65
+ 'dmarc' => @dmarc,
66
+ }.compact
67
+ end
68
+
69
+ def to_json(*args)
70
+ to_h.to_json(*args)
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module Domain
6
+ module Model
7
+ # DomainGetSandboxDomainResponse
8
+ class DomainGetSandboxDomainResponse
9
+ # "success" string
10
+ # Allowed values: `success`.
11
+ # @return [String, nil]
12
+ attr_accessor :status
13
+
14
+ # Sandbox domain name.
15
+ # @return [String, nil]
16
+ attr_accessor :domain
17
+
18
+ def initialize(
19
+ status: nil,
20
+ domain: nil
21
+ )
22
+ @status = status
23
+ @domain = domain
24
+ end
25
+
26
+ # Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
27
+ # gives nil (data that is not a Hash gives an empty object).
28
+ def self.from_h(data)
29
+ data = {} unless data.is_a?(Hash)
30
+ new(
31
+ status: data['status'],
32
+ domain: data['domain']
33
+ )
34
+ end
35
+
36
+ # JSON-ready hash, nil fields are omitted.
37
+ def to_h
38
+ {
39
+ 'status' => @status,
40
+ 'domain' => @domain,
41
+ }.compact
42
+ end
43
+
44
+ def to_json(*args)
45
+ to_h.to_json(*args)
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module Domain
6
+ module Model
7
+ # DomainListRequest
8
+ class DomainListRequest
9
+ # Optional domain name if you want to get the status of single domain only.
10
+ # @return [String, nil]
11
+ attr_accessor :domain
12
+
13
+ # Limits the number of domains returned. Default is 50.
14
+ # Default: `50`.
15
+ # @return [Integer, nil]
16
+ attr_accessor :limit
17
+
18
+ # Index of the first domain in the list, starting with 0.
19
+ # Default: `0`.
20
+ # @return [Integer, nil]
21
+ attr_accessor :offset
22
+
23
+ def initialize(
24
+ domain: nil,
25
+ limit: nil,
26
+ offset: nil
27
+ )
28
+ @domain = domain
29
+ @limit = limit
30
+ @offset = offset
31
+ end
32
+
33
+ # Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
34
+ # gives nil (data that is not a Hash gives an empty object).
35
+ def self.from_h(data)
36
+ data = {} unless data.is_a?(Hash)
37
+ new(
38
+ domain: data['domain'],
39
+ limit: data['limit'],
40
+ offset: data['offset']
41
+ )
42
+ end
43
+
44
+ # JSON-ready hash, nil fields are omitted.
45
+ def to_h
46
+ {
47
+ 'domain' => @domain,
48
+ 'limit' => @limit,
49
+ 'offset' => @offset,
50
+ }.compact
51
+ end
52
+
53
+ def to_json(*args)
54
+ to_h.to_json(*args)
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module Domain
6
+ module Model
7
+ # DomainListResponse
8
+ class DomainListResponse
9
+ # "success" string
10
+ # Allowed values: `success`.
11
+ # @return [String, nil]
12
+ attr_accessor :status
13
+
14
+ # Array of objects describing domains.
15
+ # @return [Array<DomainListResponseDomainsItem>, nil]
16
+ attr_accessor :domains
17
+
18
+ def initialize(
19
+ status: nil,
20
+ domains: nil
21
+ )
22
+ @status = status
23
+ @domains = domains
24
+ end
25
+
26
+ # Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
27
+ # gives nil (data that is not a Hash gives an empty object).
28
+ def self.from_h(data)
29
+ data = {} unless data.is_a?(Hash)
30
+ new(
31
+ status: data['status'],
32
+ domains: ::UniOne::Client::Decode.list(data['domains']) { |item0| ::UniOne::Client::Decode.model(::UniOne::Api::Domain::Model::DomainListResponseDomainsItem, item0) }
33
+ )
34
+ end
35
+
36
+ # JSON-ready hash, nil fields are omitted.
37
+ def to_h
38
+ {
39
+ 'status' => @status,
40
+ 'domains' => @domains.nil? ? nil : @domains.map { |item0| item0.to_h },
41
+ }.compact
42
+ end
43
+
44
+ def to_json(*args)
45
+ to_h.to_json(*args)
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module Domain
6
+ module Model
7
+ # DomainListResponseDomainsItem
8
+ class DomainListResponseDomainsItem
9
+ # Domain name.
10
+ # @return [String, nil]
11
+ attr_accessor :domain
12
+
13
+ # Object describing verification record value and status.
14
+ # @return [DomainListResponseDomainsItemVerificationRecord, nil]
15
+ attr_accessor :verification_record
16
+
17
+ # Object describing DKIM record value and status.
18
+ # @return [DomainListResponseDomainsItemDkim, nil]
19
+ attr_accessor :dkim
20
+
21
+ def initialize(
22
+ domain: nil,
23
+ verification_record: nil,
24
+ dkim: nil
25
+ )
26
+ @domain = domain
27
+ @verification_record = verification_record
28
+ @dkim = dkim
29
+ end
30
+
31
+ # Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
32
+ # gives nil (data that is not a Hash gives an empty object).
33
+ def self.from_h(data)
34
+ data = {} unless data.is_a?(Hash)
35
+ new(
36
+ domain: data['domain'],
37
+ verification_record: ::UniOne::Client::Decode.model(::UniOne::Api::Domain::Model::DomainListResponseDomainsItemVerificationRecord, data['verification-record']),
38
+ dkim: ::UniOne::Client::Decode.model(::UniOne::Api::Domain::Model::DomainListResponseDomainsItemDkim, data['dkim'])
39
+ )
40
+ end
41
+
42
+ # JSON-ready hash, nil fields are omitted.
43
+ def to_h
44
+ {
45
+ 'domain' => @domain,
46
+ 'verification-record' => @verification_record.nil? ? nil : @verification_record.to_h,
47
+ 'dkim' => @dkim.nil? ? nil : @dkim.to_h,
48
+ }.compact
49
+ end
50
+
51
+ def to_json(*args)
52
+ to_h.to_json(*args)
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module Domain
6
+ module Model
7
+ # Object describing DKIM record value and status.
8
+ class DomainListResponseDomainsItemDkim
9
+ # DKIM signature for the domain. This property contains only the key part, you should prepend it with
10
+ # "k=rsa, p=" part for the record to be valid (see
11
+ # [domain/get-dns-records](https://docs.unione.io/en/web-api-ref#domain-get-dns-records)).
12
+ # @return [String, nil]
13
+ attr_accessor :key
14
+
15
+ # Only domains with "active" DKIM record are allowed as sender domains.
16
+ # @return [DkimStatus, nil]
17
+ attr_accessor :status
18
+
19
+ def initialize(
20
+ key: nil,
21
+ status: nil
22
+ )
23
+ @key = key
24
+ @status = status
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
+ key: data['key'],
33
+ status: data['status']
34
+ )
35
+ end
36
+
37
+ # JSON-ready hash, nil fields are omitted.
38
+ def to_h
39
+ {
40
+ 'key' => @key,
41
+ 'status' => @status,
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,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module Domain
6
+ module Model
7
+ # Object describing verification record value and status.
8
+ class DomainListResponseDomainsItemVerificationRecord
9
+ # Record to be added "as is" to verify ownership of this domain.
10
+ # @return [String, nil]
11
+ attr_accessor :value
12
+
13
+ # Only domains with "confirmed" verification record are allowed as sender domains.
14
+ # @return [VerificationRecordStatus, nil]
15
+ attr_accessor :status
16
+
17
+ def initialize(
18
+ value: nil,
19
+ status: nil
20
+ )
21
+ @value = value
22
+ @status = status
23
+ end
24
+
25
+ # Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
26
+ # gives nil (data that is not a Hash gives an empty object).
27
+ def self.from_h(data)
28
+ data = {} unless data.is_a?(Hash)
29
+ new(
30
+ value: data['value'],
31
+ status: data['status']
32
+ )
33
+ end
34
+
35
+ # JSON-ready hash, nil fields are omitted.
36
+ def to_h
37
+ {
38
+ 'value' => @value,
39
+ 'status' => @status,
40
+ }.compact
41
+ end
42
+
43
+ def to_json(*args)
44
+ to_h.to_json(*args)
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end