paubox 0.3.0 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a259c46c870059aff289a90bc661f86de6954c33b88ae75613dee3c9f15c1418
4
- data.tar.gz: 4a5768c1ee7b711c91576ef7f43fc219150ed0c5f81512fe36269c09db825c8e
3
+ metadata.gz: 3733459b49f6166432d85899d4ea38e9d9f983c6f1ef42d17ed430fc7095beb9
4
+ data.tar.gz: f4c0bf54df9f438dd499d178ca67eadb2b4f7e0aa3516089da2faed70b6f02cb
5
5
  SHA512:
6
- metadata.gz: 4285803ec83dd1f57b4407a4c0e7e177e1d571dcf6075b04707377c0286f1d76693858e69d6c6784d21245c286474025eb3514ddcb9414f2001891e6bcede3a5
7
- data.tar.gz: 6e5b536a02e5df73675b255f6ed8080d3a5bf97a48f533bc2fb5f0e3189c8013cf7a373afffc957fe854335b07e074e1f2c858dbe50e2e64ab41ff7231c73aea
6
+ metadata.gz: 66acb7c648c2ede8380ecdaeb60c8cde92cd97ed66f17dce81bf8ef9e175c9d53f777fab4d1527ee3c8ceb35d65b3975a74fa5047af8add6af90380fc8b17f5b
7
+ data.tar.gz: 3eeb0122292eb25f34dc24e5e62ed696200c8efd45304cde5a92467dec5c03bc0c27d01ff369ece52b4c6091c36651e886d119049922f752cafb2cc4c1c4ce97
data/.gitignore CHANGED
@@ -1,14 +1,14 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- /.vscode/
11
-
12
- # rspec failure tracking
13
- .rspec_status
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /.vscode/
11
+
12
+ # rspec failure tracking
13
+ .rspec_status
14
14
  .gem
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
- --format documentation
2
- --color
1
+ --format documentation
2
+ --color
data/.travis.yml CHANGED
@@ -1,5 +1,5 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.3.1
5
- before_install: gem install bundler -v 1.14.6
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.14.6
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- # Specify your gem's dependencies in paubox_ruby.gemspec
6
- gemspec
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in paubox_ruby.gemspec
6
+ gemspec
data/LICENSE.txt CHANGED
@@ -1,13 +1,13 @@
1
- Copyright 2018 Paubox Inc.
2
-
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
-
7
- http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
1
+ Copyright 2018 Paubox Inc.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
13
  limitations under the License.
data/README.md CHANGED
@@ -1,230 +1,283 @@
1
- <img src="https://github.com/Paubox/paubox-csharp/raw/master/paubox_logo.png" alt="Paubox" width="150px">
2
-
3
- # Paubox Gem
4
- This gem and Paubox Transactional Email HTTP API are currently in alpha development.
5
-
6
- This is the official Ruby wrapper for the Paubox Transactional Email HTTP API. The Paubox Transactional Email API allows your application to send secure, HIPAA-compliant email via Paubox and track deliveries and opens.
7
-
8
- It extends the [Ruby Mail Library](https://github.com/mikel/mail) for seamless integration in your existing Ruby application. The API wrapper also allows you to construct and send messages directly without the Ruby Mail Library.
9
-
10
- # Table of Contents
11
- * [Installation](#installation)
12
- * [Usage](#usage)
13
- * [Contributing](#contributing)
14
- * [License](#license)
15
-
16
-
17
- <a name="#installation"></a>
18
- ## Installation
19
-
20
- Add this line to your application's Gemfile:
21
-
22
- ```ruby
23
- gem 'paubox'
24
- ```
25
-
26
- And then execute:
27
-
28
- $ bundle install
29
-
30
- Or install it yourself as:
31
-
32
- $ gem install paubox
33
-
34
- ### Getting Paubox API Credentials
35
- You will need to have a Paubox account. You can [sign up here](https://www.paubox.com/join/see-pricing?unit=messages).
36
-
37
- Once you have an account, follow the instructions on the Rest API dashboard to verify domain ownership and generate API credentials.
38
-
39
- ### Configuring API Credentials
40
- Include your API credentials in an initializer (e.g. config/initializers/paubox.rb in Rails).
41
-
42
- Keep your API credentials out of version control. Store these in environmental variables.
43
- ```ruby
44
- Paubox.configure do |config|
45
- config.api_key = ENV['PAUBOX_API_KEY']
46
- config.api_user = ENV['PAUBOX_API_USER']
47
- end
48
- ```
49
-
50
- <a name="#usage"></a>
51
- ## Usage
52
-
53
- ### Sending Messages with the Ruby Mail Library
54
-
55
- Using the Ruby Mail Library? Sending via Paubox is easy. Just build a message as normal and set Mail::Paubox as the delivery method.
56
- ```ruby
57
- require 'Paubox'
58
- require 'json'
59
- require 'mail'
60
-
61
- message = Mail.new do
62
- from 'you@yourdomain.com'
63
- to 'someone@somewhere.com'
64
- cc 'another@somewhere.com'
65
- subject 'HIPAA-compliant email made easy'
66
-
67
- text_part do
68
- body 'This message will be sent securely by Paubox.'
69
- end
70
-
71
- html_part do
72
- content_type 'text/html; charset=UTF-8'
73
- body '<h1>This message will be sent securely by Paubox.</h1>'
74
- end
75
-
76
- delivery_method Mail::Paubox
77
- end
78
-
79
- message.deliver!
80
- => {"message"=>"Service OK", "sourceTrackingId"=>"2a3c048485aa4cf6"}
81
-
82
- message.source_tracking_id
83
- => "2a3c048485aa4cf6"
84
- ```
85
-
86
- ### Allowing non-TLS message delivery
87
-
88
- If you want to send non-PHI mail that does not need to be HIPAA-compliant, you can allow the message delivery to take place even if a TLS connection is unavailable. This means a message will not be converted into a secure portal message when a non-TLS connection is encountered.
89
- ```ruby
90
- require 'Paubox'
91
- require 'json'
92
- require 'mail'
93
-
94
- message = Mail.new do
95
- from 'you@yourdomain.com'
96
- to 'someone@somewhere.com'
97
- subject 'Sending non-PHI'
98
- body 'This message delivery will not enforce TLS transmission.'
99
-
100
- delivery_method Mail::Paubox
101
- end
102
-
103
- message.allow_non_tls = true
104
- message.deliver!
105
- ```
106
-
107
- ### Forcing Secure Notifications
108
-
109
- Paubox Secure Notifications allow an extra layer of security, especially when coupled with an organization's requirement for message recipients to use 2-factor authentication to read messages (this setting is available to org administrators in the Paubox Admin Panel).
110
-
111
- Instead of receiving an email with the message contents, the recipient will receive a notification email that they have a new message in Paubox.
112
- ```ruby
113
- require 'Paubox'
114
- require 'json'
115
- require 'mail'
116
-
117
- message = Mail.new do
118
- from 'you@yourdomain.com'
119
- to 'someone@somewhere.com'
120
- subject 'Sending non-PHI'
121
- body 'This message delivery will not enforce TLS transmission.'
122
-
123
- delivery_method Mail::Paubox
124
- end
125
-
126
- message.force_secure_notification = 'true'
127
- message.deliver!
128
- ```
129
-
130
- ### Adding Attachments
131
-
132
- ```ruby
133
- require 'Paubox'
134
- require 'json'
135
- require 'mail'
136
-
137
- message = Mail.new do
138
- from 'you@yourdomain.com'
139
- to 'someone@somewhere.com'
140
- cc 'another@somewhere.com'
141
- subject 'HIPAA-compliant email made easy'
142
-
143
- delivery_method Mail::Paubox
144
- end
145
-
146
- message.add_file("D:\\TestFolder\\YourFileName.txt")
147
- message.deliver!
148
- ```
149
-
150
- ### Sending Messages using just the Paubox API
151
- You don't need to use Ruby Mail to build and send messages with Paubox.
152
- ```ruby
153
- require 'Paubox'
154
- require 'json'
155
-
156
- args = { from: 'you@yourdomain.com',
157
- to: 'someone@domain.com, someone-else@domain.com',
158
- cc: ['another@domain.com', 'yet-another@domain.com'],
159
- bcc: 'bcc-recipient@domain.com',
160
- reply_to: 'reply-to@yourdomain.com',
161
- subject: 'Testing!',
162
- text_content: 'Hello World!',
163
- html_content: '<h1>Hello World!</h1>'
164
- }
165
-
166
- message = Paubox::Message.new(args)
167
-
168
- client = Paubox::Client.new
169
- client.deliver_mail(message)
170
- => {"message"=>"Service OK", "sourceTrackingId"=>"2a3c048485aa4cf6"}
171
- ```
172
-
173
- ### Checking Email Dispositions
174
- ```ruby
175
- require 'Paubox'
176
- require 'json'
177
-
178
- client = Paubox::Client.new
179
- email_disposition = client.email_disposition('2a3c048485aa4cf6')
180
-
181
- # Get array of email_dispositions. One email_disposition is generated for each recipient.
182
- message_deliveries = email_disposition.message_deliveries
183
- => [<struct Paubox::EmailDisposition::MessageDelivery recipient="test@domain.com", status=#<struct Paubox::EmailDisposition::MessageDeliveryStatus delivery_status="delivered", delivery_time=Mon, 30 Apr 2018 12:54:19 -0700, opened_status="opened", opened_time=Mon, 30 Apr 2018 12:55:19 -0700>>]
184
-
185
- # Inspect a message delivery
186
- delivery = message_deliveries.first
187
-
188
- delivery.recipient
189
- => "test@domain.com"
190
-
191
- # Inspect the message delivery status
192
- status = delivery.status
193
-
194
- status.delivery_status
195
- => "delivered"
196
-
197
- status.delivery_time
198
- => Mon, 30 Apr 2018 12:54:19 -0700
199
-
200
- # opened_status is only available for single-recipient messages
201
- status.opened_status
202
- => "opened"
203
-
204
- # opened_time is only available for single-recipient messages
205
- status.opened_time
206
- => Mon, 30 Apr 2018 12:55:19 -0700
207
- ```
208
-
209
- <a name="#contributing"></a>
210
- ## Contributing
211
-
212
- Bug reports and pull requests are welcome on GitHub at https://github.com/paubox/paubox_ruby.
213
-
214
-
215
- <a name="#license"></a>
216
- ## License
217
-
218
- Licensed under the Apache License, Version 2.0 (the "License");
219
- you may not use this file except in compliance with the License.
220
- You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
221
-
222
- Unless required by applicable law or agreed to in writing, software
223
- distributed under the License is distributed on an "AS IS" BASIS,
224
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
225
- See the License for the specific language governing permissions and
226
- limitations under the License.
227
-
228
- ## Copyright
229
- Copyright &copy; 2019, Paubox Inc.
230
-
1
+ <img src="https://avatars.githubusercontent.com/u/22528478?s=200&v=4" alt="Paubox" width="150px">
2
+
3
+ # Paubox Gem
4
+ This is the official Ruby wrapper for the Paubox Email API. The Paubox Email API allows your application to send secure, HIPAA compliant email via Paubox and track deliveries and opens.
5
+
6
+ It extends the [Ruby Mail Library](https://github.com/mikel/mail) for seamless integration in your existing Ruby application. The API wrapper also allows you to construct and send messages directly without the Ruby Mail Library.
7
+
8
+ # Table of Contents
9
+ * [Installation](#installation)
10
+ * [Usage](#usage)
11
+ * [Contributing](#contributing)
12
+ * [License](#license)
13
+
14
+
15
+ <a name="#installation"></a>
16
+ ## Installation
17
+
18
+ Add this line to your application's Gemfile:
19
+
20
+ ```ruby
21
+ gem 'paubox'
22
+ ```
23
+
24
+ And then execute:
25
+
26
+ $ bundle install
27
+
28
+ Or install it yourself as:
29
+
30
+ $ gem install paubox
31
+
32
+ ### Getting Paubox API Credentials
33
+ You will need to have a Paubox account. You can [sign up here](https://www.paubox.com/join/see-pricing?unit=messages).
34
+
35
+ Once you have an account, follow the instructions on the Rest API dashboard to verify domain ownership and generate API credentials.
36
+
37
+ ### Configuring API Credentials
38
+ Include your API credentials in an initializer (e.g. config/initializers/paubox.rb in Rails).
39
+
40
+ Keep your API credentials out of version control. Store these in environment variables.
41
+
42
+ ```ruby
43
+ Paubox.configure do |config|
44
+ config.api_key = ENV['PAUBOX_API_KEY']
45
+ config.api_user = ENV['PAUBOX_API_USER']
46
+ end
47
+ ```
48
+
49
+ If you need to send from multiple domains, you can pass credentials in the options hash when you set Ruby Mail's `Mail#delivery_method`, or when using `Paubox::Message`, when you instantiate `Paubox::Client`.
50
+
51
+ **(optional) Setting credentials when using Ruby Mail:**
52
+
53
+ ```ruby
54
+ message = Mail.new do
55
+ ...
56
+ delivery_method(Mail::Paubox, api_key: ENV['PAUBOX_API_KEY'],
57
+ api_user: ENV['PAUBOX_API_USER'])
58
+ end
59
+ ```
60
+
61
+ **(optional) Setting credentials when using Paubox::Client:**
62
+
63
+ ```ruby
64
+ client = Paubox::Client.new(api_key: ENV['PAUBOX_API_KEY'],
65
+ api_user: ENV['PAUBOX_API_USER'])
66
+ ```
67
+
68
+ <a name="#usage"></a>
69
+ ## Usage
70
+
71
+ ### Sending Messages with the Ruby Mail Library
72
+
73
+ Using the Ruby Mail Library? Sending via Paubox is easy. Just build a message as normal and set Mail::Paubox as the delivery method.
74
+
75
+ ```ruby
76
+ require 'Paubox'
77
+ require 'json'
78
+ require 'mail'
79
+
80
+ message = Mail.new do
81
+ from 'you@yourdomain.com'
82
+ to 'someone@somewhere.com'
83
+ cc 'another@somewhere.com'
84
+ subject 'HIPAA-compliant email made easy'
85
+
86
+ text_part do
87
+ body 'This message will be sent securely by Paubox.'
88
+ end
89
+
90
+ html_part do
91
+ content_type 'text/html; charset=UTF-8'
92
+ body '<h1>This message will be sent securely by Paubox.</h1>'
93
+ end
94
+
95
+ delivery_method Mail::Paubox
96
+ end
97
+
98
+ message.deliver!
99
+ => {"message"=>"Service OK", "sourceTrackingId"=>"2a3c048485aa4cf6"}
100
+
101
+ message.source_tracking_id
102
+ => "2a3c048485aa4cf6"
103
+ ```
104
+
105
+ ### Allowing non-TLS message delivery
106
+
107
+ If you want to send non-PHI mail that does not need to be HIPAA compliant, you can allow the message delivery to take place even if a TLS connection is unavailable. This means a message will not be converted into a secure portal message when a non-TLS connection is encountered.
108
+
109
+ ```ruby
110
+ require 'Paubox'
111
+ require 'json'
112
+ require 'mail'
113
+
114
+ message = Mail.new do
115
+ from 'you@yourdomain.com'
116
+ to 'someone@somewhere.com'
117
+ subject 'Sending non-PHI'
118
+ body 'This message delivery will not enforce TLS transmission.'
119
+
120
+ delivery_method Mail::Paubox
121
+ end
122
+
123
+ message.allow_non_tls = true
124
+ message.deliver!
125
+ ```
126
+
127
+ ### Forcing Secure Notifications
128
+
129
+ Paubox Secure Notifications allow an extra layer of security, especially when coupled with an organization's requirement for message recipients to use 2-factor authentication to read messages (this setting is available to org administrators in the Paubox Admin Panel).
130
+
131
+ Instead of receiving an email with the message contents, the recipient will receive a notification email that they have a new message in Paubox.
132
+
133
+ ```ruby
134
+ require 'Paubox'
135
+ require 'json'
136
+ require 'mail'
137
+
138
+ message = Mail.new do
139
+ from 'you@yourdomain.com'
140
+ to 'someone@somewhere.com'
141
+ subject 'Sending non-PHI'
142
+ body 'This message delivery will not enforce TLS transmission.'
143
+
144
+ delivery_method Mail::Paubox
145
+ end
146
+
147
+ message.force_secure_notification = 'true'
148
+ message.deliver!
149
+ ```
150
+
151
+ ### Adding Attachments
152
+
153
+ ```ruby
154
+ require 'Paubox'
155
+ require 'json'
156
+ require 'mail'
157
+
158
+ message = Mail.new do
159
+ from 'you@yourdomain.com'
160
+ to 'someone@somewhere.com'
161
+ cc 'another@somewhere.com'
162
+ subject 'HIPAA-compliant email made easy'
163
+
164
+ delivery_method Mail::Paubox
165
+ end
166
+
167
+ message.add_file("path_to_your_file")
168
+ message.deliver!
169
+ ```
170
+
171
+ ### Sending Messages using just the Paubox API
172
+ You don't need to use Ruby Mail to build and send messages with Paubox.
173
+
174
+ ```ruby
175
+ require 'Paubox'
176
+ require 'json'
177
+
178
+ args = { from: 'you@yourdomain.com',
179
+ to: 'someone@domain.com, someone-else@domain.com',
180
+ cc: ['another@domain.com', 'yet-another@domain.com'],
181
+ bcc: 'bcc-recipient@domain.com',
182
+ reply_to: 'reply-to@yourdomain.com',
183
+ subject: 'Testing!',
184
+ text_content: 'Hello World!',
185
+ html_content: '<h1>Hello World!</h1>'
186
+ }
187
+
188
+ message = Paubox::Message.new(args)
189
+
190
+ client = Paubox::Client.new
191
+ client.deliver_mail(message)
192
+ => {"message"=>"Service OK", "sourceTrackingId"=>"2a3c048485aa4cf6"}
193
+ ```
194
+
195
+ ### Send Messages using Dynamic Templates
196
+ Using [dynamic templates](https://docs.paubox.com/docs/paubox_email_api/dynamic_templates/) is similar to sending a regular message. Just create a `Paubox::TemplatedMessage` object and pass a `template` object with the name of the template and variables:
197
+
198
+ ```ruby
199
+ require 'Paubox'
200
+ require 'json'
201
+
202
+ args = { from: 'you@yourdomain.com',
203
+ to: 'someone@domain.com, someone-else@domain.com',
204
+ cc: ['another@domain.com', 'yet-another@domain.com'],
205
+ bcc: 'bcc-recipient@domain.com',
206
+ reply_to: 'reply-to@yourdomain.com',
207
+ subject: 'Testing!',
208
+ template: {
209
+ name: 'Test Template',
210
+ values: {
211
+ first_name: 'Timothy',
212
+ last_name: 'Testerson'
213
+ }
214
+ }
215
+ }
216
+
217
+ templated_message = Paubox::TemplatedMessage.new(args)
218
+
219
+ client = Paubox::Client.new
220
+ client.deliver_mail(templated_message)
221
+ => {"sourceTrackingId"=>"166904b5-dce7-4de1-92e8-3d505c165ff5", "data"=>"Service OK"}
222
+ ```
223
+
224
+ _Note that there is no `content` when using templated messages._
225
+
226
+ ### Checking Email Dispositions
227
+ ```ruby
228
+ require 'Paubox'
229
+ require 'json'
230
+
231
+ client = Paubox::Client.new
232
+ email_disposition = client.email_disposition('2a3c048485aa4cf6')
233
+
234
+ # Get array of email_dispositions. One email_disposition is generated for each recipient.
235
+ message_deliveries = email_disposition.message_deliveries
236
+ => [<struct Paubox::EmailDisposition::MessageDelivery recipient="test@domain.com", status=#<struct Paubox::EmailDisposition::MessageDeliveryStatus delivery_status="delivered", delivery_time=Mon, 30 Apr 2018 12:54:19 -0700, opened_status="opened", opened_time=Mon, 30 Apr 2018 12:55:19 -0700>>]
237
+
238
+ # Inspect a message delivery
239
+ delivery = message_deliveries.first
240
+
241
+ delivery.recipient
242
+ => "test@domain.com"
243
+
244
+ # Inspect the message delivery status
245
+ status = delivery.status
246
+
247
+ status.delivery_status
248
+ => "delivered"
249
+
250
+ status.delivery_time
251
+ => Mon, 30 Apr 2018 12:54:19 -0700
252
+
253
+ # opened_status is only available for single-recipient messages
254
+ status.opened_status
255
+ => "opened"
256
+
257
+ # opened_time is only available for single-recipient messages
258
+ status.opened_time
259
+ => Mon, 30 Apr 2018 12:55:19 -0700
260
+ ```
261
+
262
+ <a name="#contributing"></a>
263
+ ## Contributing
264
+
265
+ Bug reports and pull requests are welcome on GitHub at https://github.com/paubox/paubox_ruby.
266
+
267
+
268
+ <a name="#license"></a>
269
+ ## License
270
+
271
+ Licensed under the Apache License, Version 2.0 (the "License");
272
+ you may not use this file except in compliance with the License.
273
+ You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
274
+
275
+ Unless required by applicable law or agreed to in writing, software
276
+ distributed under the License is distributed on an "AS IS" BASIS,
277
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
278
+ See the License for the specific language governing permissions and
279
+ limitations under the License.
280
+
281
+ ## Copyright
282
+ Copyright &copy; 2022, Paubox, Inc.
283
+
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- task default: :spec
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec