paubox 1.1.0 → 1.2.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 +7 -0
- data/lib/paubox/client.rb +71 -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: 5ba4ee3af31174ce6a77fb403a770afe36a35bbdb36b04358d613d8e7762bbf0
|
|
4
|
+
data.tar.gz: c89efb57681fa92d3957f27df88a95b54f121b1c13cd6f6b25fb69751482d9bf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 64f70fb89c5a13f75fcdc376742389a8fb27dec34f1a25f8f480c357fb8680b70d35429d3622de55daa626aa62b61a19e17ed945adc7e3eced25c36e73d63234
|
|
7
|
+
data.tar.gz: 6aa4d4a5ef992be5cc041a7f09a9ceb7ecaa412f085028ce1d26ebfe8411c099e688d79906efff72ebae74d4cfd412b006b276673ec550fcd2d6b966dbef6917
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.2.0](https://github.com/Paubox/paubox-ruby/compare/v1.1.0...v1.2.0) (2026-09-16)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add receiving (inbound email) endpoints ([#29](https://github.com/Paubox/paubox-ruby/issues/29)) ([aeda949](https://github.com/Paubox/paubox-ruby/commit/aeda9497215ce6d701af7eb37ec9ac895910e1b2))
|
|
11
|
+
|
|
5
12
|
## [1.1.0](https://github.com/Paubox/paubox-ruby/compare/v1.0.0...v1.1.0) (2026-09-09)
|
|
6
13
|
|
|
7
14
|
|
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,76 @@ 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
|
+
|
|
94
165
|
def send_request(method: :get, payload: {}, path: '')
|
|
95
166
|
url = request_endpoint(path)
|
|
96
167
|
|
data/lib/paubox/version.rb
CHANGED