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,95 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module System
6
+ module Model
7
+ # SystemInfoResponse
8
+ class SystemInfoResponse
9
+ # "success" string
10
+ # Allowed values: `success`.
11
+ # @return [String, nil]
12
+ attr_accessor :status
13
+
14
+ # Unique user identifier.
15
+ # @return [Integer, nil]
16
+ attr_accessor :user_id
17
+
18
+ # Email of the user.
19
+ # @return [String, nil]
20
+ attr_accessor :email
21
+
22
+ # Unqiue project identifier, ASCII string up to 36 characters long. Present only if the API key used
23
+ # for request is the project API key.
24
+ # @return [String, nil]
25
+ attr_accessor :project_id
26
+
27
+ # Project name, unique for user account. Present only if the API key used for request is the project
28
+ # API key.
29
+ # @return [String, nil]
30
+ attr_accessor :project_name
31
+
32
+ # Object with email counter properties. Present only if the API key used for request is the user API
33
+ # key.
34
+ # @return [ProjectAccountingObject, nil]
35
+ attr_accessor :project_accounting
36
+
37
+ # Object with accounting period properties. Present only if the API key used for request is the user
38
+ # API key.
39
+ # @return [SystemInfoResponseAccounting, nil]
40
+ attr_accessor :accounting
41
+
42
+ def initialize(
43
+ status: nil,
44
+ user_id: nil,
45
+ email: nil,
46
+ project_id: nil,
47
+ project_name: nil,
48
+ project_accounting: nil,
49
+ accounting: nil
50
+ )
51
+ @status = status
52
+ @user_id = user_id
53
+ @email = email
54
+ @project_id = project_id
55
+ @project_name = project_name
56
+ @project_accounting = project_accounting
57
+ @accounting = accounting
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
+ status: data['status'],
66
+ user_id: data['user_id'],
67
+ email: data['email'],
68
+ project_id: data['project_id'],
69
+ project_name: data['project_name'],
70
+ project_accounting: ::UniOne::Client::Decode.model(::UniOne::Api::System::Model::ProjectAccountingObject, data['project_accounting']),
71
+ accounting: ::UniOne::Client::Decode.model(::UniOne::Api::System::Model::SystemInfoResponseAccounting, data['accounting'])
72
+ )
73
+ end
74
+
75
+ # JSON-ready hash, nil fields are omitted.
76
+ def to_h
77
+ {
78
+ 'status' => @status,
79
+ 'user_id' => @user_id,
80
+ 'email' => @email,
81
+ 'project_id' => @project_id,
82
+ 'project_name' => @project_name,
83
+ 'project_accounting' => @project_accounting.nil? ? nil : @project_accounting.to_h,
84
+ 'accounting' => @accounting.nil? ? nil : @accounting.to_h,
85
+ }.compact
86
+ end
87
+
88
+ def to_json(*args)
89
+ to_h.to_json(*args)
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module System
6
+ module Model
7
+ # Object with accounting period properties. Present only if the API key used for request is the user
8
+ # API key.
9
+ class SystemInfoResponseAccounting
10
+ # Date and time of accounting period start in UTC in "YYYY-MM-DD hh:mm:ss" format.
11
+ # @return [String, nil]
12
+ attr_accessor :period_start
13
+
14
+ # Date and time of accounting period end in UTC in "YYYY-MM-DD hh:mm:ss" format.
15
+ # @return [String, nil]
16
+ attr_accessor :period_end
17
+
18
+ # Number of emails included into accounting period.
19
+ # @return [Integer, nil]
20
+ attr_accessor :emails_included
21
+
22
+ # Number of emails sent during accounting period. Can be bigger than emails_included in case of
23
+ # overage.
24
+ # @return [Integer, nil]
25
+ attr_accessor :emails_sent
26
+
27
+ def initialize(
28
+ period_start: nil,
29
+ period_end: nil,
30
+ emails_included: nil,
31
+ emails_sent: nil
32
+ )
33
+ @period_start = period_start
34
+ @period_end = period_end
35
+ @emails_included = emails_included
36
+ @emails_sent = emails_sent
37
+ end
38
+
39
+ # Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
40
+ # gives nil (data that is not a Hash gives an empty object).
41
+ def self.from_h(data)
42
+ data = {} unless data.is_a?(Hash)
43
+ new(
44
+ period_start: data['period_start'],
45
+ period_end: data['period_end'],
46
+ emails_included: data['emails_included'],
47
+ emails_sent: data['emails_sent']
48
+ )
49
+ end
50
+
51
+ # JSON-ready hash, nil fields are omitted.
52
+ def to_h
53
+ {
54
+ 'period_start' => @period_start,
55
+ 'period_end' => @period_end,
56
+ 'emails_included' => @emails_included,
57
+ 'emails_sent' => @emails_sent,
58
+ }.compact
59
+ end
60
+
61
+ def to_json(*args)
62
+ to_h.to_json(*args)
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module System
6
+ module Model
7
+ # SystemPingResponse
8
+ class SystemPingResponse
9
+ # "success" string
10
+ # Allowed values: `success`.
11
+ # @return [String, nil]
12
+ attr_accessor :status
13
+
14
+ # Unique user identifier.
15
+ # @return [Integer, nil]
16
+ attr_accessor :user_id
17
+
18
+ def initialize(
19
+ status: nil,
20
+ user_id: nil
21
+ )
22
+ @status = status
23
+ @user_id = user_id
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
+ user_id: data['user_id']
33
+ )
34
+ end
35
+
36
+ # JSON-ready hash, nil fields are omitted.
37
+ def to_h
38
+ {
39
+ 'status' => @status,
40
+ 'user_id' => @user_id,
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,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+
5
+ module UniOne
6
+ module Api
7
+ module System
8
+ # System operations.
9
+ class SystemApi
10
+ # @param client [::UniOne::Client::ApiClient]
11
+ def initialize(client)
12
+ @client = client
13
+ end
14
+
15
+ # Checks API key validity and returns user ID.
16
+ #
17
+ # Documentation: https://docs.unione.io/en/web-api-ref#system-ping
18
+ # @return [::UniOne::Api::System::Model::SystemPingResponse]
19
+ # @raise [::UniOne::Client::ApiError]
20
+ def ping
21
+ ::UniOne::Api::System::Model::SystemPingResponse.from_h(@client.call('/system/ping.json'))
22
+ end
23
+
24
+ # Gets user or project info by API key.
25
+ #
26
+ # Documentation: https://docs.unione.io/en/web-api-ref#system-info
27
+ # @return [::UniOne::Api::System::Model::SystemInfoResponse]
28
+ # @raise [::UniOne::Client::ApiError]
29
+ def info
30
+ ::UniOne::Api::System::Model::SystemInfoResponse.from_h(@client.call('/system/info.json'))
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module Tag
6
+ module Model
7
+ # TagDeleteRequest
8
+ class TagDeleteRequest
9
+ # Unique tag id.
10
+ # @return [Integer, nil]
11
+ attr_accessor :tag_id
12
+
13
+ def initialize(
14
+ tag_id:
15
+ )
16
+ @tag_id = tag_id
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
+ tag_id: data['tag_id']
25
+ )
26
+ end
27
+
28
+ # JSON-ready hash, nil fields are omitted.
29
+ def to_h
30
+ {
31
+ 'tag_id' => @tag_id,
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 Tag
6
+ module Model
7
+ # TagListResponse
8
+ class TagListResponse
9
+ # "success" string
10
+ # Allowed values: `success`.
11
+ # @return [String, nil]
12
+ attr_accessor :status
13
+
14
+ # An array of objects containing data for user-defined tags.
15
+ # @return [Array<TagsResponseObject>, nil]
16
+ attr_accessor :tags
17
+
18
+ def initialize(
19
+ status: nil,
20
+ tags: nil
21
+ )
22
+ @status = status
23
+ @tags = tags
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
+ tags: ::UniOne::Client::Decode.list(data['tags']) { |item0| ::UniOne::Client::Decode.model(::UniOne::Api::Tag::Model::TagsResponseObject, item0) }
33
+ )
34
+ end
35
+
36
+ # JSON-ready hash, nil fields are omitted.
37
+ def to_h
38
+ {
39
+ 'status' => @status,
40
+ 'tags' => @tags.nil? ? nil : @tags.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,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module Tag
6
+ module Model
7
+ # An object with the properties of the user tags.
8
+ class TagsResponseObject
9
+ # Unique tag id.
10
+ # @return [Integer, nil]
11
+ attr_accessor :tag_id
12
+
13
+ # Tag name.
14
+ # @return [String, nil]
15
+ attr_accessor :tag
16
+
17
+ def initialize(
18
+ tag_id: nil,
19
+ tag: nil
20
+ )
21
+ @tag_id = tag_id
22
+ @tag = tag
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
+ tag_id: data['tag_id'],
31
+ tag: data['tag']
32
+ )
33
+ end
34
+
35
+ # JSON-ready hash, nil fields are omitted.
36
+ def to_h
37
+ {
38
+ 'tag_id' => @tag_id,
39
+ 'tag' => @tag,
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
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+
5
+ module UniOne
6
+ module Api
7
+ module Tag
8
+ # This family of methods is used to manage user-defined tags. Tags are used to categorize letters
9
+ # based on your own criteria, e. g. to create a distinction between marketing and transactional
10
+ # letters or group together all notifications for a particular order type. UniOne allows you to assign
11
+ # tags to all outgoing emails, and the tags you’ve set may then be used to filter and analyze delivery
12
+ # statistics.
13
+ class TagApi
14
+ # @param client [::UniOne::Client::ApiClient]
15
+ def initialize(client)
16
+ @client = client
17
+ end
18
+
19
+ # This method returns the full list of user-defined tags. Does not receive any parameters.
20
+ #
21
+ # Documentation: https://docs.unione.io/en/web-api-ref#tag-list
22
+ # @return [::UniOne::Api::Tag::Model::TagListResponse]
23
+ # @raise [::UniOne::Client::ApiError]
24
+ def list
25
+ ::UniOne::Api::Tag::Model::TagListResponse.from_h(@client.call('/tag/list.json'))
26
+ end
27
+
28
+ # Removes tag.
29
+ #
30
+ # Documentation: https://docs.unione.io/en/web-api-ref#tag-delete
31
+ # @param request [::UniOne::Api::Tag::Model::TagDeleteRequest, Hash]
32
+ # @return [::UniOne::Common::Model::SuccessResponse]
33
+ # @raise [::UniOne::Client::ApiError]
34
+ def delete(request)
35
+ ::UniOne::Common::Model::SuccessResponse.from_h(@client.call('/tag/delete.json', request.is_a?(Hash) ? request : request.to_h))
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module Template
6
+ module Model
7
+ # Editor type, "html" or "visual". Default is "html". You can create a template with "visual" editor
8
+ # type only in web interface.
9
+ module EditorType
10
+ HTML = 'html'
11
+ VISUAL = 'visual'
12
+
13
+ # All values
14
+ ALL = [HTML, VISUAL].freeze
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module Template
6
+ module Model
7
+ # TemplateDeleteRequest
8
+ class TemplateDeleteRequest
9
+ # Template id.
10
+ # @return [String, nil]
11
+ attr_accessor :id
12
+
13
+ def initialize(
14
+ id:
15
+ )
16
+ @id = id
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
+ id: data['id']
25
+ )
26
+ end
27
+
28
+ # JSON-ready hash, nil fields are omitted.
29
+ def to_h
30
+ {
31
+ 'id' => @id,
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,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module Template
6
+ module Model
7
+ # TemplateGetRequest
8
+ class TemplateGetRequest
9
+ # Template id.
10
+ # @return [String, nil]
11
+ attr_accessor :id
12
+
13
+ def initialize(
14
+ id:
15
+ )
16
+ @id = id
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
+ id: data['id']
25
+ )
26
+ end
27
+
28
+ # JSON-ready hash, nil fields are omitted.
29
+ def to_h
30
+ {
31
+ 'id' => @id,
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 Template
6
+ module Model
7
+ # TemplateGetResponse
8
+ class TemplateGetResponse
9
+ # "success" string
10
+ # Allowed values: `success`.
11
+ # @return [String, nil]
12
+ attr_accessor :status
13
+
14
+ # Object with all the template properties.
15
+ # @return [TemplateObject, nil]
16
+ attr_accessor :template
17
+
18
+ def initialize(
19
+ status: nil,
20
+ template: nil
21
+ )
22
+ @status = status
23
+ @template = template
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
+ template: ::UniOne::Client::Decode.model(::UniOne::Api::Template::Model::TemplateObject, data['template'])
33
+ )
34
+ end
35
+
36
+ # JSON-ready hash, nil fields are omitted.
37
+ def to_h
38
+ {
39
+ 'status' => @status,
40
+ 'template' => @template.nil? ? nil : @template.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