mailosaur 7.4.0 → 7.5.0

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: '0629407acde130c71828a35283ecc427f73881193164f236a970d6226fe4ed7d'
4
- data.tar.gz: 66d6af0d7d7bd39d52f61c87c80acbf4524e2324c5ffe0c264397d8c99e4cdd0
3
+ metadata.gz: ba11091df0403a909d8a57e7700554de73b60d7210c5ded9464bfb11275b9b21
4
+ data.tar.gz: 62145309ef9d9e55381e05ef7e26f0d8c5eee04120a798e46a505c9f8eb4a22f
5
5
  SHA512:
6
- metadata.gz: 1754ac94d3a1566bf813e9adc6012ca42fa7be204dab7d733a2ae8bcc8d14b44a947f18a2795212ad49fd09406ebc3ba93c4cbc77b0ef57ecbf8c4f303cf4ea1
7
- data.tar.gz: 511648f014115e7ab22f8cf2893ff87264a7355b8dddf193655c992b742ff48a30cc69d57f8ca44589e45e246fb6566cb17a503714fc9c30c013e712127a0817
6
+ metadata.gz: c6a98ecd886efcd9b6b682a01ab84fd4d9f85fdbcacdbd7f6ca80997a354e294418bda65ad4c20e0fb116c9bc77ae2c05a75ab5d56a82ec5f3b526caaf2c2ab8
7
+ data.tar.gz: 19438600dabe29a2e5557636068f83d688950e3e5e52ecef0aeeb9400e522f28b61f1bb5367951fe88e375192944be754362cf05b23e702938f8fd9132261b99
@@ -22,7 +22,7 @@ module Mailosaur
22
22
  # @return [SpamAnalysisResult] operation results.
23
23
  #
24
24
  def spam(email)
25
- response = conn.get 'api/analysis/spam/' + email
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)
@@ -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 'api/files/attachments/' + id
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 'api/files/email/' + id
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)
@@ -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 'api/messages/' + id
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 'api/messages/' + id
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 = 'api/messages?server=' + server
91
- url += page ? '&page=' + page.to_s : ''
92
- url += items_per_page ? '&itemsPerPage=' + items_per_page.to_s : ''
93
- url += received_after ? '&receivedAfter=' + CGI.escape(received_after.iso8601) : ''
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 'api/messages?server=' + server
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 = 'api/messages/search?server=' + server
142
- url += page ? '&page=' + page.to_s : ''
143
- url += items_per_page ? '&itemsPerPage=' + items_per_page.to_s : ''
144
- url += received_after ? '&receivedAfter=' + CGI.escape(received_after.iso8601) : ''
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 'api/messages?server=' + server, message_create_options.to_json
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 'api/messages/' + id + '/forward', message_forward_options.to_json
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 'api/messages/' + id + '/reply', message_reply_options.to_json
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
 
@@ -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
@@ -54,7 +54,7 @@ module Mailosaur
54
54
  # @return [Server] operation results.
55
55
  #
56
56
  def get(id)
57
- response = conn.get 'api/servers/' + id
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 'api/servers/' + id + '/password'
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 'api/servers/' + id, server.to_json
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 'api/servers/' + id
106
+ response = conn.delete "api/servers/#{id}"
107
107
  @handle_http_error.call(response) unless response.status == 204
108
108
  nil
109
109
  end
@@ -1,3 +1,3 @@
1
1
  module Mailosaur
2
- VERSION = '7.4.0'.freeze
2
+ VERSION = '7.5.0'.freeze
3
3
  end
data/lib/mailosaur.rb CHANGED
@@ -86,9 +86,9 @@ module Mailosaur
86
86
  Faraday.new(@base_url, {
87
87
  headers: {
88
88
  content_type: 'application/json; charset=utf-8',
89
- user_agent: 'mailosaur-ruby/' + Mailosaur::VERSION
89
+ user_agent: "mailosaur-ruby/#{Mailosaur::VERSION}"
90
90
  }
91
- }).tap { |conn| conn.basic_auth(@api_key, '') }
91
+ }).tap { |conn| conn.request(:basic_auth, @api_key, '') }
92
92
  end
93
93
 
94
94
  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.0
4
+ version: 7.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mailosaur
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-27 00:00:00.000000000 Z
11
+ date: 2021-11-25 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: '12.3'
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: '12.3'
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: 0.68.0
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: 0.68.0
100
+ version: 1.19.0
107
101
  - !ruby/object:Gem::Dependency
108
102
  name: shoulda-context
109
103
  requirement: !ruby/object:Gem::Requirement
@@ -204,7 +198,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
204
198
  requirements:
205
199
  - - ">="
206
200
  - !ruby/object:Gem::Version
207
- version: '2.2'
201
+ version: '2.5'
208
202
  required_rubygems_version: !ruby/object:Gem::Requirement
209
203
  requirements:
210
204
  - - ">="