mailosaur 6.0.0 → 6.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -1
- data/lib/Mailosaur/analysis.rb +1 -2
- data/lib/Mailosaur/files.rb +2 -3
- data/lib/Mailosaur/mailosaur_error.rb +4 -4
- data/lib/Mailosaur/messages.rb +27 -30
- data/lib/Mailosaur/models/base_model.rb +3 -4
- data/lib/Mailosaur/models/image.rb +1 -1
- data/lib/Mailosaur/models/message.rb +5 -5
- data/lib/Mailosaur/models/message_content.rb +2 -2
- data/lib/Mailosaur/models/message_list_result.rb +2 -2
- data/lib/Mailosaur/models/message_summary.rb +6 -6
- data/lib/Mailosaur/models/metadata.rb +1 -1
- data/lib/Mailosaur/models/server.rb +1 -1
- data/lib/Mailosaur/models/server_list_result.rb +1 -1
- data/lib/Mailosaur/models/spam_filter_results.rb +1 -1
- data/lib/Mailosaur/servers.rb +5 -6
- data/lib/Mailosaur/version.rb +1 -1
- data/lib/mailosaur.rb +30 -22
- metadata +41 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93384f72178b70f3cbf990d30be7d7110ede5b6e81338486d019b041d10b829c
|
4
|
+
data.tar.gz: 5b7342050cd44184dab1ffdf453c7eac88c12ccfae420dccab9f19b29aca66f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57d70f504d3b930d4d017a82c6de18cb89d6b9518219a9c5fb3b3cde1ab386f082977aba014ef698afb0052d07a79305738c9b531afcb8c0ad37acb711945ac5
|
7
|
+
data.tar.gz: ce5fc8101e3eff75a329c775fafe54b9615f81a928fde391e8932129ade0f90023c8352551f616e612c06d4b7f661a48e4ec940cc3de6b570ce97ce075ceac77
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[Mailosaur](https://mailosaur.com) allows you to automate tests involving email. Allowing you to perform end-to-end automated and functional email testing.
|
4
4
|
|
5
|
-
[![
|
5
|
+
[![](https://github.com/mailosaur/mailosaur-ruby/workflows/CI/badge.svg)](https://github.com/mailosaur/mailosaur-ruby/actions)
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -27,6 +27,15 @@ export MAILOSAUR_SERVER=server_id
|
|
27
27
|
bundle exec rake test
|
28
28
|
```
|
29
29
|
|
30
|
+
## Linting code
|
31
|
+
|
32
|
+
Simply run Rubocop:
|
33
|
+
|
34
|
+
```
|
35
|
+
bundle install
|
36
|
+
bundle exec rubocop
|
37
|
+
```
|
38
|
+
|
30
39
|
## Contacting us
|
31
40
|
|
32
41
|
You can get us at [support@mailosaur.com](mailto:support@mailosaur.com)
|
data/lib/Mailosaur/analysis.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
module Mailosaur
|
2
2
|
class Analysis
|
3
|
-
|
4
3
|
#
|
5
4
|
# Creates and initializes a new instance of the Analysis class.
|
6
5
|
# @param conn client connection.
|
@@ -23,7 +22,7 @@ module Mailosaur
|
|
23
22
|
#
|
24
23
|
def spam(email)
|
25
24
|
response = conn.get 'api/analysis/spam/' + email
|
26
|
-
|
25
|
+
|
27
26
|
unless response.status == 200
|
28
27
|
error_model = JSON.load(response.body)
|
29
28
|
mailosaur_error = Mailosaur::MailosaurError.new('Operation returned an invalid status code \'' + response.status.to_s + '\'', error_model)
|
data/lib/Mailosaur/files.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
module Mailosaur
|
2
2
|
class Files
|
3
|
-
|
4
3
|
#
|
5
4
|
# Creates and initializes a new instance of the Files class.
|
6
5
|
# @param client connection.
|
@@ -24,7 +23,7 @@ module Mailosaur
|
|
24
23
|
#
|
25
24
|
def get_attachment(id)
|
26
25
|
response = conn.get 'api/files/attachments/' + id
|
27
|
-
|
26
|
+
|
28
27
|
unless response.status == 200
|
29
28
|
error_model = JSON.load(response.body)
|
30
29
|
mailosaur_error = Mailosaur::MailosaurError.new('Operation returned an invalid status code \'' + response.status.to_s + '\'', error_model)
|
@@ -46,7 +45,7 @@ module Mailosaur
|
|
46
45
|
#
|
47
46
|
def get_email(id)
|
48
47
|
response = conn.get 'api/files/email/' + id
|
49
|
-
|
48
|
+
|
50
49
|
unless response.status == 200
|
51
50
|
error_model = JSON.load(response.body)
|
52
51
|
mailosaur_error = Mailosaur::MailosaurError.new('Operation returned an invalid status code \'' + response.status.to_s + '\'', error_model)
|
@@ -14,10 +14,10 @@ module Mailosaur
|
|
14
14
|
@model = nil
|
15
15
|
|
16
16
|
unless error_model.nil?
|
17
|
-
@type = error_model[
|
18
|
-
@messages = error_model[
|
19
|
-
@model = error_model[
|
20
|
-
end
|
17
|
+
@type = error_model['type']
|
18
|
+
@messages = error_model['messages']
|
19
|
+
@model = error_model['model']
|
20
|
+
end
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
data/lib/Mailosaur/messages.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
1
3
|
module Mailosaur
|
2
4
|
class Messages
|
3
|
-
|
4
5
|
#
|
5
6
|
# Creates and initializes a new instance of the Messages class.
|
6
7
|
# @param client connection.
|
@@ -21,23 +22,20 @@ module Mailosaur
|
|
21
22
|
# @param server [String] The identifier of the server hosting the message.
|
22
23
|
# @param criteria [SearchCriteria] The search criteria to use in order to find
|
23
24
|
# a match.
|
24
|
-
# @param timeout [Integer] Specify how long to wait for a matching result
|
25
|
+
# @param timeout [Integer] Specify how long to wait for a matching result
|
25
26
|
# (in milliseconds).
|
26
|
-
# @param received_after [DateTime] Limits results to only messages received
|
27
|
+
# @param received_after [DateTime] Limits results to only messages received
|
27
28
|
# after this date/time.
|
28
29
|
#
|
29
30
|
# @return [Message] operation results.
|
30
31
|
#
|
31
|
-
def get(server, criteria, timeout:
|
32
|
+
def get(server, criteria, timeout: 10_000, received_after: DateTime.now - (1.0 / 24))
|
32
33
|
# Defaults timeout to 10s, receivedAfter to 1h
|
33
|
-
if server.length > 8
|
34
|
-
raise Mailosaur::MailosaurError.new('Use get_by_id to retrieve a message using its identifier', nil)
|
35
|
-
end
|
34
|
+
raise Mailosaur::MailosaurError.new('Use get_by_id to retrieve a message using its identifier', nil) if server.length > 8
|
36
35
|
|
37
|
-
result = search(server, criteria, timeout:timeout, received_after:received_after)
|
38
|
-
|
36
|
+
result = search(server, criteria, timeout: timeout, received_after: received_after)
|
37
|
+
get_by_id(result.items[0].id)
|
39
38
|
end
|
40
|
-
|
41
39
|
|
42
40
|
#
|
43
41
|
# Retrieve a message
|
@@ -51,7 +49,7 @@ module Mailosaur
|
|
51
49
|
#
|
52
50
|
def get_by_id(id)
|
53
51
|
response = conn.get 'api/messages/' + id
|
54
|
-
|
52
|
+
|
55
53
|
unless response.status == 200
|
56
54
|
error_model = JSON.load(response.body)
|
57
55
|
mailosaur_error = Mailosaur::MailosaurError.new('Operation returned an invalid status code \'' + response.status.to_s + '\'', error_model)
|
@@ -94,16 +92,19 @@ module Mailosaur
|
|
94
92
|
# pagination.
|
95
93
|
# @param items_per_page [Integer] A limit on the number of results to be
|
96
94
|
# returned per page. Can be set between 1 and 1000 items, the default is 50.
|
95
|
+
# @param received_after [DateTime] Limits results to only messages received
|
96
|
+
# after this date/time.
|
97
97
|
#
|
98
98
|
# @return [MessageListResult] operation results.
|
99
99
|
#
|
100
|
-
def list(server, page:nil, items_per_page:nil)
|
100
|
+
def list(server, page: nil, items_per_page: nil, received_after: nil)
|
101
101
|
url = 'api/messages?server=' + server
|
102
102
|
url += page ? '&page=' + page : ''
|
103
103
|
url += items_per_page ? '&itemsPerPage=' + items_per_page : ''
|
104
|
+
url += received_after ? '&receivedAfter=' + CGI.escape(received_after.iso8601) : ''
|
104
105
|
|
105
106
|
response = conn.get url
|
106
|
-
|
107
|
+
|
107
108
|
unless response.status == 200
|
108
109
|
error_model = JSON.load(response.body)
|
109
110
|
mailosaur_error = Mailosaur::MailosaurError.new('Operation returned an invalid status code \'' + response.status.to_s + '\'', error_model)
|
@@ -148,42 +149,38 @@ module Mailosaur
|
|
148
149
|
# pagination.
|
149
150
|
# @param items_per_page [Integer] A limit on the number of results to be
|
150
151
|
# returned per page. Can be set between 1 and 1000 items, the default is 50.
|
151
|
-
# @param timeout [Integer] Specify how long to wait for a matching result
|
152
|
+
# @param timeout [Integer] Specify how long to wait for a matching result
|
152
153
|
# (in milliseconds).
|
153
|
-
# @param received_after [DateTime] Limits results to only messages received
|
154
|
+
# @param received_after [DateTime] Limits results to only messages received
|
154
155
|
# after this date/time.
|
155
156
|
#
|
156
157
|
# @return [MessageListResult] operation results.
|
157
158
|
#
|
158
|
-
def search(server, criteria, page:nil, items_per_page:nil, timeout:nil, received_after:nil)
|
159
|
+
def search(server, criteria, page: nil, items_per_page: nil, timeout: nil, received_after: nil) # rubocop:disable all
|
159
160
|
url = 'api/messages/search?server=' + server
|
160
161
|
url += page ? '&page=' + page.to_s : ''
|
161
162
|
url += items_per_page ? '&itemsPerPage=' + items_per_page.to_s : ''
|
162
|
-
url += received_after ? '&receivedAfter=' + received_after.iso8601 : ''
|
163
|
+
url += received_after ? '&receivedAfter=' + CGI.escape(received_after.iso8601) : ''
|
163
164
|
|
164
165
|
poll_count = 0
|
165
166
|
start_time = Time.now.to_f
|
166
167
|
|
167
|
-
loop do
|
168
|
+
loop do
|
168
169
|
response = conn.post url, criteria.to_json
|
169
|
-
|
170
|
+
|
170
171
|
unless response.status == 200
|
171
172
|
error_model = JSON.load(response.body)
|
172
|
-
mailosaur_error = Mailosaur::MailosaurError.new('Operation returned an invalid status code \'' + response.status.to_s + '\'', error_model)
|
173
|
+
mailosaur_error = Mailosaur::MailosaurError.new('Operation returned an invalid status code \'' + response.status.to_s + '\'', error_model) # rubocop:disable Metrics/LineLength
|
173
174
|
raise mailosaur_error
|
174
175
|
end
|
175
176
|
|
176
177
|
model = JSON.load(response.body)
|
177
|
-
if timeout.to_i
|
178
|
-
|
179
|
-
|
178
|
+
return Mailosaur::Models::MessageListResult.new(model) if timeout.to_i.zero? || !model['items'].empty?
|
179
|
+
|
180
|
+
delay_pattern = (response.headers['x-ms-delay'] || '1000').split(',').map(&:to_i)
|
181
|
+
|
182
|
+
delay = poll_count >= delay_pattern.length ? delay_pattern[delay_pattern.length - 1] : delay_pattern[poll_count]
|
180
183
|
|
181
|
-
delay_pattern = (response.headers['x-ms-delay'] || '1000').split(',').map{ |x| x.to_i }
|
182
|
-
|
183
|
-
delay = poll_count >= delay_pattern.length ?
|
184
|
-
delay_pattern[delay_pattern.length - 1] :
|
185
|
-
delay_pattern[poll_count]
|
186
|
-
|
187
184
|
poll_count += 1
|
188
185
|
|
189
186
|
## Stop if timeout will be exceeded
|
@@ -191,7 +188,7 @@ module Mailosaur
|
|
191
188
|
raise Mailosaur::MailosaurError.new('No matching messages were found in time', nil)
|
192
189
|
end
|
193
190
|
|
194
|
-
sleep
|
191
|
+
sleep(delay / 1000)
|
195
192
|
end
|
196
193
|
end
|
197
194
|
end
|
@@ -1,16 +1,15 @@
|
|
1
1
|
module Mailosaur
|
2
2
|
module Models
|
3
3
|
class BaseModel
|
4
|
-
def to_json
|
4
|
+
def to_json(*_args)
|
5
5
|
hash = {}
|
6
|
-
|
6
|
+
instance_variables.each do |var|
|
7
7
|
key = var.to_s.delete('@').split('_').collect(&:capitalize).join
|
8
8
|
key = key[0].downcase + key[1..-1]
|
9
|
-
hash[key] =
|
9
|
+
hash[key] = instance_variable_get var
|
10
10
|
end
|
11
11
|
hash.to_json
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
16
|
-
|
@@ -4,19 +4,19 @@ module Mailosaur
|
|
4
4
|
def initialize(data = {})
|
5
5
|
@id = data['id']
|
6
6
|
@from = []
|
7
|
-
(data['from'] || []).each do |
|
7
|
+
(data['from'] || []).each do |i| @from << Mailosaur::Models::MessageAddress.new(i) end
|
8
8
|
@to = []
|
9
|
-
(data['to'] || []).each do |
|
9
|
+
(data['to'] || []).each do |i| @to << Mailosaur::Models::MessageAddress.new(i) end
|
10
10
|
@cc = []
|
11
|
-
(data['cc'] || []).each do |
|
11
|
+
(data['cc'] || []).each do |i| @cc << Mailosaur::Models::MessageAddress.new(i) end
|
12
12
|
@bcc = []
|
13
|
-
(data['bcc'] || []).each do |
|
13
|
+
(data['bcc'] || []).each do |i| @bcc << Mailosaur::Models::MessageAddress.new(i) end
|
14
14
|
@received = DateTime.parse(data['received'])
|
15
15
|
@subject = data['subject']
|
16
16
|
@html = Mailosaur::Models::MessageContent.new(data['html'])
|
17
17
|
@text = Mailosaur::Models::MessageContent.new(data['text'])
|
18
18
|
@attachments = []
|
19
|
-
(data['attachments'] || []).each do |
|
19
|
+
(data['attachments'] || []).each do |i| @attachments << Mailosaur::Models::Attachment.new(i) end
|
20
20
|
@metadata = Mailosaur::Models::Metadata.new(data['metadata'])
|
21
21
|
@server = data['server']
|
22
22
|
end
|
@@ -3,9 +3,9 @@ module Mailosaur
|
|
3
3
|
class MessageContent < BaseModel
|
4
4
|
def initialize(data = {})
|
5
5
|
@links = []
|
6
|
-
(data['links'] || []).each do |
|
6
|
+
(data['links'] || []).each do |i| @links << Mailosaur::Models::Link.new(i) end
|
7
7
|
@images = []
|
8
|
-
(data['images'] || []).each do |
|
8
|
+
(data['images'] || []).each do |i| @images << Mailosaur::Models::Image.new(i) end
|
9
9
|
@body = data['body']
|
10
10
|
end
|
11
11
|
|
@@ -3,9 +3,9 @@ module Mailosaur
|
|
3
3
|
class MessageListResult < BaseModel
|
4
4
|
def initialize(data = {})
|
5
5
|
@items = []
|
6
|
-
(data['items'] || []).each do |
|
6
|
+
(data['items'] || []).each do |i| @items << Mailosaur::Models::MessageSummary.new(i) end
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
# @return [Array<MessageSummary>] The individual summaries of each
|
10
10
|
# message forming the result. Summaries are returned sorted by received
|
11
11
|
# date, with the most recently-received messages appearing first.
|
@@ -5,19 +5,19 @@ module Mailosaur
|
|
5
5
|
@id = data['id']
|
6
6
|
@server = data['server']
|
7
7
|
@rcpt = []
|
8
|
-
(data['rcpt'] || []).each do |
|
8
|
+
(data['rcpt'] || []).each do |i| @rcpt << Mailosaur::Models::MessageAddress.new(i) end
|
9
9
|
@from = []
|
10
|
-
(data['from'] || []).each do |
|
10
|
+
(data['from'] || []).each do |i| @from << Mailosaur::Models::MessageAddress.new(i) end
|
11
11
|
@to = []
|
12
|
-
(data['to'] || []).each do |
|
12
|
+
(data['to'] || []).each do |i| @to << Mailosaur::Models::MessageAddress.new(i) end
|
13
13
|
@cc = []
|
14
|
-
(data['cc'] || []).each do |
|
14
|
+
(data['cc'] || []).each do |i| @cc << Mailosaur::Models::MessageAddress.new(i) end
|
15
15
|
@bcc = []
|
16
|
-
(data['bcc'] || []).each do |
|
16
|
+
(data['bcc'] || []).each do |i| @bcc << Mailosaur::Models::MessageAddress.new(i) end
|
17
17
|
@received = DateTime.parse(data['received'])
|
18
18
|
@subject = data['subject']
|
19
19
|
@summary = data['summary']
|
20
|
-
@attachments = data['attachments']
|
20
|
+
@attachments = data['attachments']
|
21
21
|
end
|
22
22
|
|
23
23
|
# @return
|
@@ -3,7 +3,7 @@ module Mailosaur
|
|
3
3
|
class Metadata < BaseModel
|
4
4
|
def initialize(data = {})
|
5
5
|
@headers = []
|
6
|
-
(data['headers'] || []).each do |
|
6
|
+
(data['headers'] || []).each do |i| @headers << Mailosaur::Models::MessageHeader.new(i) end
|
7
7
|
end
|
8
8
|
|
9
9
|
# @return [Array<MessageHeader>] Email headers.
|
@@ -8,7 +8,7 @@ module Mailosaur
|
|
8
8
|
@users = data['users']
|
9
9
|
@messages = data['messages']
|
10
10
|
@forwarding_rules = []
|
11
|
-
(data['forwardingRules'] || []).each do |
|
11
|
+
(data['forwardingRules'] || []).each do |i| @forwarding_rules << Mailosaur::Models::ForwardingRule.new(i) end
|
12
12
|
end
|
13
13
|
|
14
14
|
# @return [String] Unique identifier for the server. Used as username for
|
@@ -3,7 +3,7 @@ module Mailosaur
|
|
3
3
|
class ServerListResult < BaseModel
|
4
4
|
def initialize(data = {})
|
5
5
|
@items = []
|
6
|
-
(data['items'] || []).each do |
|
6
|
+
(data['items'] || []).each do |i| @items << Mailosaur::Models::Server.new(i) end
|
7
7
|
end
|
8
8
|
|
9
9
|
# @return [Array<Server>] The individual servers forming the result.
|
@@ -3,7 +3,7 @@ module Mailosaur
|
|
3
3
|
class SpamFilterResults < BaseModel
|
4
4
|
def initialize(data = {})
|
5
5
|
@spam_assassin = []
|
6
|
-
(data['spamAssassin'] || []).each do |
|
6
|
+
(data['spamAssassin'] || []).each do |i| @spam_assassin << Mailosaur::Models::SpamAssassinRule.new(i) end
|
7
7
|
end
|
8
8
|
|
9
9
|
# @return [Array<SpamAssassinRule>]
|
data/lib/Mailosaur/servers.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
module Mailosaur
|
2
2
|
class Servers
|
3
|
-
|
4
3
|
#
|
5
4
|
# Creates and initializes a new instance of the Servers class.
|
6
5
|
# @param client connection.
|
@@ -20,9 +19,9 @@ module Mailosaur
|
|
20
19
|
#
|
21
20
|
# @return [ServerListResult] operation results.
|
22
21
|
#
|
23
|
-
def list
|
22
|
+
def list
|
24
23
|
response = conn.get 'api/servers'
|
25
|
-
|
24
|
+
|
26
25
|
unless response.status == 200
|
27
26
|
error_model = JSON.load(response.body)
|
28
27
|
mailosaur_error = Mailosaur::MailosaurError.new('Operation returned an invalid status code \'' + response.status.to_s + '\'', error_model)
|
@@ -44,7 +43,7 @@ module Mailosaur
|
|
44
43
|
#
|
45
44
|
def create(server_create_options)
|
46
45
|
response = conn.post 'api/servers', server_create_options.to_json
|
47
|
-
|
46
|
+
|
48
47
|
unless response.status == 200
|
49
48
|
error_model = JSON.load(response.body)
|
50
49
|
mailosaur_error = Mailosaur::MailosaurError.new('Operation returned an invalid status code \'' + response.status.to_s + '\'', error_model)
|
@@ -67,7 +66,7 @@ module Mailosaur
|
|
67
66
|
#
|
68
67
|
def get(id)
|
69
68
|
response = conn.get 'api/servers/' + id
|
70
|
-
|
69
|
+
|
71
70
|
unless response.status == 200
|
72
71
|
error_model = JSON.load(response.body)
|
73
72
|
mailosaur_error = Mailosaur::MailosaurError.new('Operation returned an invalid status code \'' + response.status.to_s + '\'', error_model)
|
@@ -90,7 +89,7 @@ module Mailosaur
|
|
90
89
|
#
|
91
90
|
def update(id, server)
|
92
91
|
response = conn.put 'api/servers/' + id, server.to_json
|
93
|
-
|
92
|
+
|
94
93
|
unless response.status == 200
|
95
94
|
error_model = JSON.load(response.body)
|
96
95
|
mailosaur_error = Mailosaur::MailosaurError.new('Operation returned an invalid status code \'' + response.status.to_s + '\'', error_model)
|
data/lib/Mailosaur/version.rb
CHANGED
data/lib/mailosaur.rb
CHANGED
@@ -38,37 +38,45 @@ module Mailosaur
|
|
38
38
|
end
|
39
39
|
|
40
40
|
class MailosaurClient
|
41
|
+
#
|
42
|
+
# Creates initializes a new instance of the MailosaurClient class.
|
43
|
+
# @param api_key [String] your Mailosaur API key.
|
44
|
+
# @param base_url [String] the base URI of the service.
|
45
|
+
#
|
46
|
+
def initialize(api_key, base_url = 'https://mailosaur.com/')
|
47
|
+
@api_key = api_key
|
48
|
+
@base_url = base_url
|
49
|
+
end
|
50
|
+
|
41
51
|
# @return [Analysis] analysis
|
42
|
-
|
52
|
+
def analysis
|
53
|
+
@analysis ||= Analysis.new(connection)
|
54
|
+
end
|
43
55
|
|
44
56
|
# @return [Files] files
|
45
|
-
|
57
|
+
def files
|
58
|
+
@files ||= Files.new(connection)
|
59
|
+
end
|
46
60
|
|
47
61
|
# @return [Messages] messages
|
48
|
-
|
62
|
+
def messages
|
63
|
+
@messages ||= Messages.new(connection)
|
64
|
+
end
|
49
65
|
|
50
66
|
# @return [Servers] servers
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
# Creates initializes a new instance of the MailosaurClient class.
|
55
|
-
# @param api_key [String] your Mailosaur API key.
|
56
|
-
# @param base_url [String] the base URI of the service.
|
57
|
-
#
|
58
|
-
def initialize(api_key, base_url)
|
59
|
-
conn = Faraday.new(base_url || 'https://mailosaur.com/', {
|
60
|
-
:headers => {
|
61
|
-
:content_type => 'application/json; charset=utf-8',
|
62
|
-
:user_agent => 'mailosaur-ruby/' + Mailosaur::VERSION
|
63
|
-
}
|
64
|
-
})
|
67
|
+
def servers
|
68
|
+
@servers ||= Servers.new(connection)
|
69
|
+
end
|
65
70
|
|
66
|
-
|
71
|
+
private
|
67
72
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
73
|
+
def connection
|
74
|
+
Faraday.new(@base_url, {
|
75
|
+
headers: {
|
76
|
+
content_type: 'application/json; charset=utf-8',
|
77
|
+
user_agent: 'mailosaur-ruby/' + Mailosaur::VERSION
|
78
|
+
}
|
79
|
+
}).tap { |conn| conn.basic_auth(@api_key, '') }
|
72
80
|
end
|
73
81
|
end
|
74
82
|
end
|
metadata
CHANGED
@@ -1,95 +1,109 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailosaur
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.
|
4
|
+
version: 6.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mailosaur Ltd
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.9.0
|
20
20
|
- - "<="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '1.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 0.9.0
|
30
30
|
- - "<="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '1.0'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
34
|
+
name: json
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
39
|
+
version: 1.7.5
|
40
40
|
- - "<="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
42
|
+
version: '3.0'
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
49
|
+
version: 1.7.5
|
50
50
|
- - "<="
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '
|
52
|
+
version: '3.0'
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: mail
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '2.6'
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 2.6.1
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '2.6'
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 2.6.1
|
53
73
|
- !ruby/object:Gem::Dependency
|
54
74
|
name: rake
|
55
75
|
requirement: !ruby/object:Gem::Requirement
|
56
76
|
requirements:
|
57
77
|
- - ">="
|
58
78
|
- !ruby/object:Gem::Version
|
59
|
-
version:
|
79
|
+
version: 12.3.0
|
60
80
|
- - "~>"
|
61
81
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
82
|
+
version: '12.3'
|
63
83
|
type: :development
|
64
84
|
prerelease: false
|
65
85
|
version_requirements: !ruby/object:Gem::Requirement
|
66
86
|
requirements:
|
67
87
|
- - ">="
|
68
88
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
89
|
+
version: 12.3.0
|
70
90
|
- - "~>"
|
71
91
|
- !ruby/object:Gem::Version
|
72
|
-
version: '
|
92
|
+
version: '12.3'
|
73
93
|
- !ruby/object:Gem::Dependency
|
74
|
-
name:
|
94
|
+
name: rubocop
|
75
95
|
requirement: !ruby/object:Gem::Requirement
|
76
96
|
requirements:
|
77
97
|
- - "~>"
|
78
98
|
- !ruby/object:Gem::Version
|
79
|
-
version:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 2.6.1
|
99
|
+
version: 0.68.0
|
83
100
|
type: :development
|
84
101
|
prerelease: false
|
85
102
|
version_requirements: !ruby/object:Gem::Requirement
|
86
103
|
requirements:
|
87
104
|
- - "~>"
|
88
105
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
90
|
-
- - ">="
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
version: 2.6.1
|
106
|
+
version: 0.68.0
|
93
107
|
- !ruby/object:Gem::Dependency
|
94
108
|
name: shoulda-context
|
95
109
|
requirement: !ruby/object:Gem::Requirement
|
@@ -177,14 +191,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
177
191
|
requirements:
|
178
192
|
- - ">="
|
179
193
|
- !ruby/object:Gem::Version
|
180
|
-
version: '
|
194
|
+
version: '2.2'
|
181
195
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
196
|
requirements:
|
183
197
|
- - ">="
|
184
198
|
- !ruby/object:Gem::Version
|
185
199
|
version: '0'
|
186
200
|
requirements: []
|
187
|
-
rubygems_version: 3.0.
|
201
|
+
rubygems_version: 3.0.3
|
188
202
|
signing_key:
|
189
203
|
specification_version: 4
|
190
204
|
summary: Ruby client library for Mailosaur
|