paubox 1.1.0 → 1.3.0
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.
- checksums.yaml +4 -4
- data/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +14 -0
- data/lib/paubox/client.rb +103 -0
- data/lib/paubox/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 03c144256b933b90453a794a96dd10a17979ebd6672c4718c09105a440c5ec9e
|
|
4
|
+
data.tar.gz: 3b85993acff1094aea7ff20c415857e38e51ebde9329584bc5ab48ccb31dffb5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c9453c28e1e1357ba079e274b46a0b7ec12414272e809658bf58e05abfaeedbcb68409f580089a72b95c24b9570214a1cabf2ee25fd4c740d0a30ba2424c66e5
|
|
7
|
+
data.tar.gz: 9ffef90ede4234b5b867670e3ba709512130b5af1aabb498567c1b333ada21d127cb4f1ce6b147e773443064af6e14621cb8ad4405a716c504df63f9e8eec2f1
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.3.0](https://github.com/Paubox/paubox-ruby/compare/v1.2.0...v1.3.0) (2026-09-17)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* webhook endpoint CRUD support ([#31](https://github.com/Paubox/paubox-ruby/issues/31)) ([1d78b47](https://github.com/Paubox/paubox-ruby/commit/1d78b4743658d81461ae2b6154ccf13209e6b329))
|
|
11
|
+
|
|
12
|
+
## [1.2.0](https://github.com/Paubox/paubox-ruby/compare/v1.1.0...v1.2.0) (2026-09-16)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* add receiving (inbound email) endpoints ([#29](https://github.com/Paubox/paubox-ruby/issues/29)) ([aeda949](https://github.com/Paubox/paubox-ruby/commit/aeda9497215ce6d701af7eb37ec9ac895910e1b2))
|
|
18
|
+
|
|
5
19
|
## [1.1.0](https://github.com/Paubox/paubox-ruby/compare/v1.0.0...v1.1.0) (2026-09-09)
|
|
6
20
|
|
|
7
21
|
|
data/lib/paubox/client.rb
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
module Paubox
|
|
4
4
|
# Client sends API requests to Paubox API
|
|
5
5
|
class Client
|
|
6
|
+
require 'cgi'
|
|
6
7
|
require 'rest-client'
|
|
7
8
|
require 'ostruct'
|
|
8
9
|
attr_reader :api_key, :api_host, :api_protocol, :api_version
|
|
@@ -91,6 +92,108 @@ module Paubox
|
|
|
91
92
|
JSON.parse(response.body)
|
|
92
93
|
end
|
|
93
94
|
|
|
95
|
+
def list_receiving_domains
|
|
96
|
+
url = request_endpoint('receiving/domains')
|
|
97
|
+
response = RestClient.get(url, auth_header)
|
|
98
|
+
JSON.parse(response.body)
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def create_receiving_domain(slug: nil)
|
|
102
|
+
url = request_endpoint('receiving/domains')
|
|
103
|
+
payload = { slug: slug }.compact.to_json
|
|
104
|
+
response = RestClient.post(url, payload, auth_header)
|
|
105
|
+
JSON.parse(response.body)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def get_receiving_domain(id)
|
|
109
|
+
url = request_endpoint("receiving/domains/#{id}")
|
|
110
|
+
response = RestClient.get(url, auth_header)
|
|
111
|
+
JSON.parse(response.body)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def delete_receiving_domain(id)
|
|
115
|
+
url = request_endpoint("receiving/domains/#{id}")
|
|
116
|
+
response = RestClient.delete(url, auth_header)
|
|
117
|
+
JSON.parse(response.body)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def list_receiving_mailboxes(domain_id)
|
|
121
|
+
url = request_endpoint("receiving/domains/#{domain_id}/mailboxes")
|
|
122
|
+
response = RestClient.get(url, auth_header)
|
|
123
|
+
JSON.parse(response.body)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def create_receiving_mailbox(domain_id, name:, password:, quota_bytes: nil)
|
|
127
|
+
url = request_endpoint("receiving/domains/#{domain_id}/mailboxes")
|
|
128
|
+
payload = { name: name, password: password, quota_bytes: quota_bytes }.compact.to_json
|
|
129
|
+
response = RestClient.post(url, payload, auth_header)
|
|
130
|
+
JSON.parse(response.body)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def get_receiving_mailbox(domain_id, mailbox_id)
|
|
134
|
+
url = request_endpoint("receiving/domains/#{domain_id}/mailboxes/#{mailbox_id}")
|
|
135
|
+
response = RestClient.get(url, auth_header)
|
|
136
|
+
JSON.parse(response.body)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def delete_receiving_mailbox(domain_id, mailbox_id)
|
|
140
|
+
url = request_endpoint("receiving/domains/#{domain_id}/mailboxes/#{mailbox_id}")
|
|
141
|
+
response = RestClient.delete(url, auth_header)
|
|
142
|
+
JSON.parse(response.body)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
def list_received_emails(limit: nil, after: nil, before: nil)
|
|
146
|
+
params = { limit: limit, after: after, before: before }.compact
|
|
147
|
+
query = params.map { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
|
|
148
|
+
url = request_endpoint('receiving')
|
|
149
|
+
url = "#{url}?#{query}" unless query.empty?
|
|
150
|
+
response = RestClient.get(url, auth_header)
|
|
151
|
+
JSON.parse(response.body)
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def get_received_email(email_id)
|
|
155
|
+
url = request_endpoint("receiving/#{email_id}")
|
|
156
|
+
response = RestClient.get(url, auth_header)
|
|
157
|
+
JSON.parse(response.body)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def get_received_email_attachment(email_id, blob_id)
|
|
161
|
+
url = request_endpoint("receiving/#{email_id}/attachments/#{blob_id}")
|
|
162
|
+
RestClient.get(url, auth_header)
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
def list_webhook_endpoints
|
|
166
|
+
url = request_endpoint('webhook_endpoints')
|
|
167
|
+
response = RestClient.get(url, auth_header)
|
|
168
|
+
JSON.parse(response.body)
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
def create_webhook_endpoint(target_url:, events:, signing_key: nil, api_key: nil, active: true)
|
|
172
|
+
url = request_endpoint('webhook_endpoints')
|
|
173
|
+
payload = { target_url: target_url, events: events, active: active,
|
|
174
|
+
signing_key: signing_key, api_key: api_key }.compact.to_json
|
|
175
|
+
response = RestClient.post(url, payload, auth_header)
|
|
176
|
+
JSON.parse(response.body)
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
def get_webhook_endpoint(id)
|
|
180
|
+
url = request_endpoint("webhook_endpoints/#{id}")
|
|
181
|
+
response = RestClient.get(url, auth_header)
|
|
182
|
+
JSON.parse(response.body)
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def update_webhook_endpoint(id, **params)
|
|
186
|
+
url = request_endpoint("webhook_endpoints/#{id}")
|
|
187
|
+
response = RestClient.patch(url, params.to_json, auth_header)
|
|
188
|
+
JSON.parse(response.body)
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
def delete_webhook_endpoint(id)
|
|
192
|
+
url = request_endpoint("webhook_endpoints/#{id}")
|
|
193
|
+
response = RestClient.delete(url, auth_header)
|
|
194
|
+
JSON.parse(response.body)
|
|
195
|
+
end
|
|
196
|
+
|
|
94
197
|
def send_request(method: :get, payload: {}, path: '')
|
|
95
198
|
url = request_endpoint(path)
|
|
96
199
|
|
data/lib/paubox/version.rb
CHANGED