paubox 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +13 -12
- data/.rspec +2 -2
- data/.travis.yml +5 -5
- data/Gemfile +6 -4
- data/LICENSE.txt +12 -12
- data/README.md +230 -171
- data/Rakefile +8 -6
- data/bin/console +15 -14
- data/bin/setup +8 -8
- data/lib/mail/paubox.rb +21 -19
- data/lib/paubox.rb +24 -22
- data/lib/paubox/client.rb +85 -81
- data/lib/paubox/email_disposition.rb +62 -57
- data/lib/paubox/format_helper.rb +60 -55
- data/lib/paubox/mail_to_message.rb +94 -70
- data/lib/paubox/message.rb +98 -73
- data/lib/paubox/version.rb +5 -3
- data/lib/paubox_ruby.rb +3 -1
- data/paubox_ruby.gemspec +34 -32
- metadata +19 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a259c46c870059aff289a90bc661f86de6954c33b88ae75613dee3c9f15c1418
|
4
|
+
data.tar.gz: 4a5768c1ee7b711c91576ef7f43fc219150ed0c5f81512fe36269c09db825c8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4285803ec83dd1f57b4407a4c0e7e177e1d571dcf6075b04707377c0286f1d76693858e69d6c6784d21245c286474025eb3514ddcb9414f2001891e6bcede3a5
|
7
|
+
data.tar.gz: 6e5b536a02e5df73675b255f6ed8080d3a5bf97a48f533bc2fb5f0e3189c8013cf7a373afffc957fe854335b07e074e1f2c858dbe50e2e64ab41ff7231c73aea
|
data/.gitignore
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
/.bundle/
|
2
|
-
/.yardoc
|
3
|
-
/Gemfile.lock
|
4
|
-
/_yardoc/
|
5
|
-
/coverage/
|
6
|
-
/doc/
|
7
|
-
/pkg/
|
8
|
-
/spec/reports/
|
9
|
-
/tmp/
|
10
|
-
|
11
|
-
|
12
|
-
|
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
|
13
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
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,171 +1,230 @@
|
|
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
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
body '
|
69
|
-
end
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
```
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
message
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
```
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
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 © 2019, Paubox Inc.
|
230
|
+
|