mailosaur 7.4.0 → 7.7.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/lib/Mailosaur/analysis.rb +1 -1
- data/lib/Mailosaur/files.rb +2 -2
- data/lib/Mailosaur/mailosaur_error.rb +1 -3
- data/lib/Mailosaur/messages.rb +14 -14
- data/lib/Mailosaur/models/attachment.rb +4 -0
- data/lib/Mailosaur/models/code.rb +12 -0
- data/lib/Mailosaur/models/message_content.rb +5 -0
- data/lib/Mailosaur/models/message_create_options.rb +4 -0
- data/lib/Mailosaur/models/message_reply_options.rb +4 -0
- data/lib/Mailosaur/models/message_summary.rb +0 -5
- data/lib/Mailosaur/models/metadata.rb +23 -0
- data/lib/Mailosaur/servers.rb +4 -4
- data/lib/Mailosaur/version.rb +1 -1
- data/lib/mailosaur.rb +3 -2
- metadata +9 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f91c18a443ec50a2034fab26e92fef85673a3aa5c4afde59f95763ca6c84b26f
|
4
|
+
data.tar.gz: 8a0ecf04c844630ac316548778135e6f0ba36ae0302b05bfd7c1b81c16bc05cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bfab6fd07260d62159be23a80d8196fe73c2f7fba2b756ccf1e7d9b9b26ec7d50dfd7fd01b065830e3fc4c0e62ef656343b6478dcc419dbcea1c03c769d8cde
|
7
|
+
data.tar.gz: 837c2559149390868a1928ec653df6083b86b8830b8280687ad5dd8e2661e275943ed6bf0a7b8aaeccfa6665817b945e0767124236f94611980fdf2ea8281c9e
|
data/lib/Mailosaur/analysis.rb
CHANGED
@@ -22,7 +22,7 @@ module Mailosaur
|
|
22
22
|
# @return [SpamAnalysisResult] operation results.
|
23
23
|
#
|
24
24
|
def spam(email)
|
25
|
-
response = conn.get
|
25
|
+
response = conn.get "api/analysis/spam/#{email}"
|
26
26
|
@handle_http_error.call(response) unless response.status == 200
|
27
27
|
model = JSON.load(response.body)
|
28
28
|
Mailosaur::Models::SpamAnalysisResult.new(model)
|
data/lib/Mailosaur/files.rb
CHANGED
@@ -23,7 +23,7 @@ module Mailosaur
|
|
23
23
|
# @return [NOT_IMPLEMENTED] operation results.
|
24
24
|
#
|
25
25
|
def get_attachment(id)
|
26
|
-
response = conn.get
|
26
|
+
response = conn.get "api/files/attachments/#{id}"
|
27
27
|
@handle_http_error.call(response) unless response.status == 200
|
28
28
|
response.body
|
29
29
|
end
|
@@ -39,7 +39,7 @@ module Mailosaur
|
|
39
39
|
# @return [NOT_IMPLEMENTED] operation results.
|
40
40
|
#
|
41
41
|
def get_email(id)
|
42
|
-
response = conn.get
|
42
|
+
response = conn.get "api/files/email/#{id}"
|
43
43
|
@handle_http_error.call(response) unless response.status == 200
|
44
44
|
response.body
|
45
45
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
module Mailosaur
|
2
2
|
class MailosaurError < StandardError
|
3
|
-
attr_reader :error_type
|
4
|
-
attr_reader :http_status_code
|
5
|
-
attr_reader :http_response_body
|
3
|
+
attr_reader :error_type, :http_status_code, :http_response_body
|
6
4
|
|
7
5
|
def initialize(message = '', error_type = '', http_status_code = nil, http_response_body = nil)
|
8
6
|
super(message)
|
data/lib/Mailosaur/messages.rb
CHANGED
@@ -49,7 +49,7 @@ module Mailosaur
|
|
49
49
|
# @return [Message] operation results.
|
50
50
|
#
|
51
51
|
def get_by_id(id)
|
52
|
-
response = conn.get
|
52
|
+
response = conn.get "api/messages/#{id}"
|
53
53
|
@handle_http_error.call(response) unless response.status == 200
|
54
54
|
model = JSON.load(response.body)
|
55
55
|
Mailosaur::Models::Message.new(model)
|
@@ -64,7 +64,7 @@ module Mailosaur
|
|
64
64
|
# @param id The identifier of the message to be deleted.
|
65
65
|
#
|
66
66
|
def delete(id)
|
67
|
-
response = conn.delete
|
67
|
+
response = conn.delete "api/messages/#{id}"
|
68
68
|
@handle_http_error.call(response) unless response.status == 204
|
69
69
|
nil
|
70
70
|
end
|
@@ -87,10 +87,10 @@ module Mailosaur
|
|
87
87
|
# @return [MessageListResult] operation results.
|
88
88
|
#
|
89
89
|
def list(server, page: nil, items_per_page: nil, received_after: nil)
|
90
|
-
url =
|
91
|
-
url += page ?
|
92
|
-
url += items_per_page ?
|
93
|
-
url += received_after ?
|
90
|
+
url = "api/messages?server=#{server}"
|
91
|
+
url += page ? "&page=#{page}" : ''
|
92
|
+
url += items_per_page ? "&itemsPerPage=#{items_per_page}" : ''
|
93
|
+
url += received_after ? "&receivedAfter=#{CGI.escape(received_after.iso8601)}" : ''
|
94
94
|
|
95
95
|
response = conn.get url
|
96
96
|
|
@@ -109,7 +109,7 @@ module Mailosaur
|
|
109
109
|
# @param server [String] The identifier of the server to be emptied.
|
110
110
|
#
|
111
111
|
def delete_all(server)
|
112
|
-
response = conn.delete
|
112
|
+
response = conn.delete "api/messages?server=#{server}"
|
113
113
|
@handle_http_error.call(response) unless response.status == 204
|
114
114
|
nil
|
115
115
|
end
|
@@ -138,10 +138,10 @@ module Mailosaur
|
|
138
138
|
# @return [MessageListResult] operation results.
|
139
139
|
#
|
140
140
|
def search(server, criteria, page: nil, items_per_page: nil, timeout: nil, received_after: nil, error_on_timeout: true) # rubocop:disable all
|
141
|
-
url =
|
142
|
-
url += page ?
|
143
|
-
url += items_per_page ?
|
144
|
-
url += received_after ?
|
141
|
+
url = "api/messages/search?server=#{server}"
|
142
|
+
url += page ? "&page=#{page}" : ''
|
143
|
+
url += items_per_page ? "&itemsPerPage=#{items_per_page}" : ''
|
144
|
+
url += received_after ? "&receivedAfter=#{CGI.escape(received_after.iso8601)}" : ''
|
145
145
|
|
146
146
|
poll_count = 0
|
147
147
|
start_time = Time.now.to_f
|
@@ -184,7 +184,7 @@ module Mailosaur
|
|
184
184
|
# @return [Message] operation result.
|
185
185
|
#
|
186
186
|
def create(server, message_create_options)
|
187
|
-
response = conn.post
|
187
|
+
response = conn.post "api/messages?server=#{server}", message_create_options.to_json
|
188
188
|
@handle_http_error.call(response) unless response.status == 200
|
189
189
|
model = JSON.load(response.body)
|
190
190
|
Mailosaur::Models::Message.new(model)
|
@@ -202,7 +202,7 @@ module Mailosaur
|
|
202
202
|
# @return [Message] operation result.
|
203
203
|
#
|
204
204
|
def forward(id, message_forward_options)
|
205
|
-
response = conn.post
|
205
|
+
response = conn.post "api/messages/#{id}/forward", message_forward_options.to_json
|
206
206
|
@handle_http_error.call(response) unless response.status == 200
|
207
207
|
model = JSON.load(response.body)
|
208
208
|
Mailosaur::Models::Message.new(model)
|
@@ -221,7 +221,7 @@ module Mailosaur
|
|
221
221
|
# @return [Message] operation result.
|
222
222
|
#
|
223
223
|
def reply(id, message_reply_options)
|
224
|
-
response = conn.post
|
224
|
+
response = conn.post "api/messages/#{id}/reply", message_reply_options.to_json
|
225
225
|
@handle_http_error.call(response) unless response.status == 200
|
226
226
|
model = JSON.load(response.body)
|
227
227
|
Mailosaur::Models::Message.new(model)
|
@@ -5,6 +5,7 @@ module Mailosaur
|
|
5
5
|
@id = data['id']
|
6
6
|
@content_type = data['contentType']
|
7
7
|
@file_name = data['fileName']
|
8
|
+
@content = data['content']
|
8
9
|
@content_id = data['contentId']
|
9
10
|
@length = data['length']
|
10
11
|
@url = data['url']
|
@@ -19,6 +20,9 @@ module Mailosaur
|
|
19
20
|
# @return [String]
|
20
21
|
attr_accessor :file_name
|
21
22
|
|
23
|
+
# @return [String]
|
24
|
+
attr_accessor :content
|
25
|
+
|
22
26
|
# @return [String]
|
23
27
|
attr_accessor :content_id
|
24
28
|
|
@@ -4,6 +4,8 @@ module Mailosaur
|
|
4
4
|
def initialize(data = {})
|
5
5
|
@links = []
|
6
6
|
(data['links'] || []).each do |i| @links << Mailosaur::Models::Link.new(i) end
|
7
|
+
@codes = []
|
8
|
+
(data['codes'] || []).each do |i| @codes << Mailosaur::Models::Code.new(i) end
|
7
9
|
@images = []
|
8
10
|
(data['images'] || []).each do |i| @images << Mailosaur::Models::Image.new(i) end
|
9
11
|
@body = data['body']
|
@@ -12,6 +14,9 @@ module Mailosaur
|
|
12
14
|
# @return [Array<Link>]
|
13
15
|
attr_accessor :links
|
14
16
|
|
17
|
+
# @return [Array<Code>]
|
18
|
+
attr_accessor :codes
|
19
|
+
|
15
20
|
# @return [Array<Image>]
|
16
21
|
attr_accessor :images
|
17
22
|
|
@@ -7,6 +7,7 @@ module Mailosaur
|
|
7
7
|
@subject = data['subject']
|
8
8
|
@text = data['text']
|
9
9
|
@html = data['html']
|
10
|
+
@attachments = data['attachments']
|
10
11
|
end
|
11
12
|
|
12
13
|
# @return [String] The email address to which the email will be sent.
|
@@ -26,6 +27,9 @@ module Mailosaur
|
|
26
27
|
# @return [String] The HTML body of the email. Note that only text
|
27
28
|
# or html can be supplied, not both.
|
28
29
|
attr_accessor :html
|
30
|
+
|
31
|
+
# @return [Array<Attachment>] Any message attachments.
|
32
|
+
attr_accessor :attachments
|
29
33
|
end
|
30
34
|
end
|
31
35
|
end
|
@@ -4,6 +4,7 @@ module Mailosaur
|
|
4
4
|
def initialize(data = {})
|
5
5
|
@text = data['text']
|
6
6
|
@html = data['html']
|
7
|
+
@attachments = data['attachments']
|
7
8
|
end
|
8
9
|
|
9
10
|
# @return [String] Any additional plain text content to include in
|
@@ -13,6 +14,9 @@ module Mailosaur
|
|
13
14
|
# @return [String] Any additional HTML content to include in the
|
14
15
|
# reply. Note that only html or text can be supplied, not both.
|
15
16
|
attr_accessor :html
|
17
|
+
|
18
|
+
# @return [Array<Attachment>] Any message attachments.
|
19
|
+
attr_accessor :attachments
|
16
20
|
end
|
17
21
|
end
|
18
22
|
end
|
@@ -4,8 +4,6 @@ module Mailosaur
|
|
4
4
|
def initialize(data = {})
|
5
5
|
@id = data['id']
|
6
6
|
@server = data['server']
|
7
|
-
@rcpt = []
|
8
|
-
(data['rcpt'] || []).each do |i| @rcpt << Mailosaur::Models::MessageAddress.new(i) end
|
9
7
|
@from = []
|
10
8
|
(data['from'] || []).each do |i| @from << Mailosaur::Models::MessageAddress.new(i) end
|
11
9
|
@to = []
|
@@ -26,9 +24,6 @@ module Mailosaur
|
|
26
24
|
# @return [String]
|
27
25
|
attr_accessor :server
|
28
26
|
|
29
|
-
# @return [Array<MessageAddress>]
|
30
|
-
attr_accessor :rcpt
|
31
|
-
|
32
27
|
# @return [Array<MessageAddress>]
|
33
28
|
attr_accessor :from
|
34
29
|
|
@@ -4,10 +4,33 @@ module Mailosaur
|
|
4
4
|
def initialize(data = {})
|
5
5
|
@headers = []
|
6
6
|
(data['headers'] || []).each do |i| @headers << Mailosaur::Models::MessageHeader.new(i) end
|
7
|
+
|
8
|
+
@ehlo = data['ehlo']
|
9
|
+
|
10
|
+
@mail_from = data['mailFrom']
|
11
|
+
|
12
|
+
@rcpt_to = []
|
13
|
+
(data['rcptTo'] || []).each do |i| @rcpt_to << Mailosaur::Models::MessageAddress.new(i) end
|
7
14
|
end
|
8
15
|
|
9
16
|
# @return [Array<MessageHeader>] Email headers.
|
10
17
|
attr_accessor :headers
|
18
|
+
|
19
|
+
# @return [String] The fully-qualified domain name or IP address that was provided with the
|
20
|
+
# Extended HELLO (EHLO) or HELLO (HELO) command. This value is generally
|
21
|
+
# used to identify the SMTP client.
|
22
|
+
# https://datatracker.ietf.org/doc/html/rfc5321#section-4.1.1.1
|
23
|
+
attr_accessor :ehlo
|
24
|
+
|
25
|
+
# @return [String] The source mailbox/email address, referred to as the 'reverse-path',
|
26
|
+
# provided via the MAIL command during the SMTP transaction.
|
27
|
+
# https://datatracker.ietf.org/doc/html/rfc5321#section-4.1.1.2
|
28
|
+
attr_accessor :mail_from
|
29
|
+
|
30
|
+
# @return [Array<MessageAddress>] The recipient email addresses, each referred to as a 'forward-path',
|
31
|
+
# provided via the RCPT command during the SMTP transaction.
|
32
|
+
# https://datatracker.ietf.org/doc/html/rfc5321#section-4.1.1.3
|
33
|
+
attr_accessor :rcpt_to
|
11
34
|
end
|
12
35
|
end
|
13
36
|
end
|
data/lib/Mailosaur/servers.rb
CHANGED
@@ -54,7 +54,7 @@ module Mailosaur
|
|
54
54
|
# @return [Server] operation results.
|
55
55
|
#
|
56
56
|
def get(id)
|
57
|
-
response = conn.get
|
57
|
+
response = conn.get "api/servers/#{id}"
|
58
58
|
@handle_http_error.call(response) unless response.status == 200
|
59
59
|
model = JSON.load(response.body)
|
60
60
|
Mailosaur::Models::Server.new(model)
|
@@ -71,7 +71,7 @@ module Mailosaur
|
|
71
71
|
# @return [String] Server password.
|
72
72
|
#
|
73
73
|
def get_password(id)
|
74
|
-
response = conn.get
|
74
|
+
response = conn.get "api/servers/#{id}/password"
|
75
75
|
@handle_http_error.call(response) unless response.status == 200
|
76
76
|
model = JSON.load(response.body)
|
77
77
|
model['value']
|
@@ -88,7 +88,7 @@ module Mailosaur
|
|
88
88
|
# @return [Server] operation results.
|
89
89
|
#
|
90
90
|
def update(id, server)
|
91
|
-
response = conn.put
|
91
|
+
response = conn.put "api/servers/#{id}", server.to_json
|
92
92
|
@handle_http_error.call(response) unless response.status == 200
|
93
93
|
model = JSON.load(response.body)
|
94
94
|
Mailosaur::Models::Server.new(model)
|
@@ -103,7 +103,7 @@ module Mailosaur
|
|
103
103
|
# @param id [String] The identifier of the server to be deleted.
|
104
104
|
#
|
105
105
|
def delete(id)
|
106
|
-
response = conn.delete
|
106
|
+
response = conn.delete "api/servers/#{id}"
|
107
107
|
@handle_http_error.call(response) unless response.status == 204
|
108
108
|
nil
|
109
109
|
end
|
data/lib/Mailosaur/version.rb
CHANGED
data/lib/mailosaur.rb
CHANGED
@@ -34,6 +34,7 @@ module Mailosaur
|
|
34
34
|
autoload :MessageContent, 'Mailosaur/models/message_content.rb'
|
35
35
|
autoload :Server, 'Mailosaur/models/server.rb'
|
36
36
|
autoload :Link, 'Mailosaur/models/link.rb'
|
37
|
+
autoload :Code, 'Mailosaur/models/code.rb'
|
37
38
|
autoload :ServerListResult, 'Mailosaur/models/server_list_result.rb'
|
38
39
|
autoload :SpamFilterResults, 'Mailosaur/models/spam_filter_results.rb'
|
39
40
|
autoload :ServerCreateOptions, 'Mailosaur/models/server_create_options.rb'
|
@@ -86,9 +87,9 @@ module Mailosaur
|
|
86
87
|
Faraday.new(@base_url, {
|
87
88
|
headers: {
|
88
89
|
content_type: 'application/json; charset=utf-8',
|
89
|
-
user_agent:
|
90
|
+
user_agent: "mailosaur-ruby/#{Mailosaur::VERSION}"
|
90
91
|
}
|
91
|
-
}).tap { |conn| conn.basic_auth
|
92
|
+
}).tap { |conn| conn.request(:basic_auth, @api_key, '') }
|
92
93
|
end
|
93
94
|
|
94
95
|
def handle_http_error(response)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailosaur
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mailosaur
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -76,34 +76,28 @@ dependencies:
|
|
76
76
|
requirements:
|
77
77
|
- - "~>"
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version: '
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 12.3.0
|
79
|
+
version: '13.0'
|
83
80
|
type: :development
|
84
81
|
prerelease: false
|
85
82
|
version_requirements: !ruby/object:Gem::Requirement
|
86
83
|
requirements:
|
87
84
|
- - "~>"
|
88
85
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
90
|
-
- - ">="
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
version: 12.3.0
|
86
|
+
version: '13.0'
|
93
87
|
- !ruby/object:Gem::Dependency
|
94
88
|
name: rubocop
|
95
89
|
requirement: !ruby/object:Gem::Requirement
|
96
90
|
requirements:
|
97
91
|
- - "~>"
|
98
92
|
- !ruby/object:Gem::Version
|
99
|
-
version:
|
93
|
+
version: 1.19.0
|
100
94
|
type: :development
|
101
95
|
prerelease: false
|
102
96
|
version_requirements: !ruby/object:Gem::Requirement
|
103
97
|
requirements:
|
104
98
|
- - "~>"
|
105
99
|
- !ruby/object:Gem::Version
|
106
|
-
version:
|
100
|
+
version: 1.19.0
|
107
101
|
- !ruby/object:Gem::Dependency
|
108
102
|
name: shoulda-context
|
109
103
|
requirement: !ruby/object:Gem::Requirement
|
@@ -159,6 +153,7 @@ files:
|
|
159
153
|
- lib/Mailosaur/messages.rb
|
160
154
|
- lib/Mailosaur/models/attachment.rb
|
161
155
|
- lib/Mailosaur/models/base_model.rb
|
156
|
+
- lib/Mailosaur/models/code.rb
|
162
157
|
- lib/Mailosaur/models/image.rb
|
163
158
|
- lib/Mailosaur/models/link.rb
|
164
159
|
- lib/Mailosaur/models/message.rb
|
@@ -204,14 +199,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
204
199
|
requirements:
|
205
200
|
- - ">="
|
206
201
|
- !ruby/object:Gem::Version
|
207
|
-
version: '2.
|
202
|
+
version: '2.5'
|
208
203
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
209
204
|
requirements:
|
210
205
|
- - ">="
|
211
206
|
- !ruby/object:Gem::Version
|
212
207
|
version: '0'
|
213
208
|
requirements: []
|
214
|
-
rubygems_version: 3.2.
|
209
|
+
rubygems_version: 3.2.32
|
215
210
|
signing_key:
|
216
211
|
specification_version: 4
|
217
212
|
summary: The Mailosaur Ruby library
|