mailosaur 7.12.0 → 7.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/Mailosaur/files.rb +16 -0
- data/lib/Mailosaur/messages.rb +17 -0
- data/lib/Mailosaur/models/preview.rb +20 -0
- data/lib/Mailosaur/models/preview_email_client.rb +36 -0
- data/lib/Mailosaur/models/preview_email_client_list_result.rb +14 -0
- data/lib/Mailosaur/models/preview_list_result.rb +14 -0
- data/lib/Mailosaur/models/preview_request.rb +16 -0
- data/lib/Mailosaur/models/preview_request_options.rb +12 -0
- data/lib/Mailosaur/previews.rb +29 -0
- data/lib/Mailosaur/version.rb +1 -1
- data/lib/mailosaur.rb +13 -1
- metadata +12 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c417909e984bf0a87b874005ad64189ad558f7d84c684fb611f67acbb65e4c0
|
4
|
+
data.tar.gz: 14b33b02313b33441b8b81a38b20a076a4f4d4f3cf9d75c10bf647e19e7f9225
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3ee70bc3325a97b85affc84f2ed0e72ed6e7ec02bb684fed6894d88ad4a4b74b46e593ac07b6a6ba6e3a1458ef76576cfb715096c04f971a0c2c45a336bf355
|
7
|
+
data.tar.gz: e35f4d3da9895285738241c72f8aa0b40b7da76ed298f83cae7a007222386ec20bdaee136f4c3658f94823786568dc553db05418f8a4da56627fb14bb8412290
|
data/lib/Mailosaur/files.rb
CHANGED
@@ -43,5 +43,21 @@ module Mailosaur
|
|
43
43
|
@handle_http_error.call(response) unless response.status == 200
|
44
44
|
response.body
|
45
45
|
end
|
46
|
+
|
47
|
+
#
|
48
|
+
# Download an email preview
|
49
|
+
#
|
50
|
+
# Downloads a screenshot of your email rendered in a real email client. Simply supply
|
51
|
+
# the unique identifier for the required preview.
|
52
|
+
#
|
53
|
+
# @param id The identifier of the email preview to be downloaded.
|
54
|
+
#
|
55
|
+
# @return [NOT_IMPLEMENTED] operation results.
|
56
|
+
#
|
57
|
+
def get_preview(id)
|
58
|
+
response = conn.get "api/files/previews/#{id}"
|
59
|
+
@handle_http_error.call(response) unless response.status == 200
|
60
|
+
response.body
|
61
|
+
end
|
46
62
|
end
|
47
63
|
end
|
data/lib/Mailosaur/messages.rb
CHANGED
@@ -234,5 +234,22 @@ module Mailosaur
|
|
234
234
|
model = JSON.parse(response.body)
|
235
235
|
Mailosaur::Models::Message.new(model)
|
236
236
|
end
|
237
|
+
|
238
|
+
#
|
239
|
+
# Generate email previews.
|
240
|
+
#
|
241
|
+
# Generates screenshots of an email rendered in the specified email clients.
|
242
|
+
#
|
243
|
+
# @param id [String] The identifier of the email to preview.
|
244
|
+
# @param options [PreviewRequestOptions] The options with which to generate previews.
|
245
|
+
#
|
246
|
+
# @return [PreviewListResult] operation result.
|
247
|
+
#
|
248
|
+
def generate_previews(id, options)
|
249
|
+
response = conn.post "api/messages/#{id}/previews", options.to_json
|
250
|
+
@handle_http_error.call(response) unless response.status == 200
|
251
|
+
model = JSON.parse(response.body)
|
252
|
+
Mailosaur::Models::PreviewListResult.new(model)
|
253
|
+
end
|
237
254
|
end
|
238
255
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Mailosaur
|
2
|
+
module Models
|
3
|
+
class Preview < BaseModel
|
4
|
+
def initialize(data = {})
|
5
|
+
@id = data['id']
|
6
|
+
@email_client = data['emailClient']
|
7
|
+
@disable_images = data['disableImages']
|
8
|
+
end
|
9
|
+
|
10
|
+
# @return [String] Unique identifier for the email preview.
|
11
|
+
attr_accessor :id
|
12
|
+
|
13
|
+
# @return [String] The email client the preview was generated with.
|
14
|
+
attr_accessor :email_client
|
15
|
+
|
16
|
+
# @return [Boolean] True if images were disabled in the preview.
|
17
|
+
attr_accessor :disable_images
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Mailosaur
|
2
|
+
module Models
|
3
|
+
class PreviewEmailClient < BaseModel
|
4
|
+
def initialize(data = {})
|
5
|
+
@id = data['id']
|
6
|
+
@name = data['id']
|
7
|
+
@platform_group = data['id']
|
8
|
+
@platform_type = data['id']
|
9
|
+
@platform_version = data['id']
|
10
|
+
@can_disable_images = data['canDisableImages']
|
11
|
+
@status = data['status']
|
12
|
+
end
|
13
|
+
|
14
|
+
# @return [String] Unique identifier for the email preview.
|
15
|
+
attr_accessor :id
|
16
|
+
|
17
|
+
# @return [String] The display name of the email client.
|
18
|
+
attr_accessor :name
|
19
|
+
|
20
|
+
# @return [String] Whether the platform is desktop, mobile, or web-based.
|
21
|
+
attr_accessor :platform_group
|
22
|
+
|
23
|
+
# @return [String] The type of platform on which the email client is running.
|
24
|
+
attr_accessor :platform_type
|
25
|
+
|
26
|
+
# @return [String] The platform version number.
|
27
|
+
attr_accessor :platform_version
|
28
|
+
|
29
|
+
# @return [Boolean] If true, images can be disabled when generating previews.
|
30
|
+
attr_accessor :can_disable_images
|
31
|
+
|
32
|
+
# @return [String] The current status of the email client.
|
33
|
+
attr_accessor :status
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Mailosaur
|
2
|
+
module Models
|
3
|
+
class PreviewEmailClientListResult < BaseModel
|
4
|
+
def initialize(data = {})
|
5
|
+
@items = []
|
6
|
+
(data['items'] || []).each { |i| @items << Mailosaur::Models::PreviewEmailClient.new(i) }
|
7
|
+
end
|
8
|
+
|
9
|
+
# @return [Array<PreviewEmailClient>] A list of available email clients with which to generate email previews.
|
10
|
+
# A list of available email clients.
|
11
|
+
attr_accessor :items
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Mailosaur
|
2
|
+
module Models
|
3
|
+
class PreviewListResult < BaseModel
|
4
|
+
def initialize(data = {})
|
5
|
+
@items = []
|
6
|
+
(data['items'] || []).each { |i| @items << Mailosaur::Models::Preview.new(i) }
|
7
|
+
end
|
8
|
+
|
9
|
+
# @return [Array<Preview>] A list of requested email previews.
|
10
|
+
# The summaries for each requested preview.
|
11
|
+
attr_accessor :items
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Mailosaur
|
2
|
+
module Models
|
3
|
+
class PreviewRequest < BaseModel
|
4
|
+
def initialize(email_client, disable_images: false)
|
5
|
+
@email_client = email_client
|
6
|
+
@disable_images = disable_images
|
7
|
+
end
|
8
|
+
|
9
|
+
# @return [String] The email client the preview was generated with.
|
10
|
+
attr_accessor :email_client
|
11
|
+
|
12
|
+
# @return [Boolean] True if images were disabled in the preview.
|
13
|
+
attr_accessor :disable_images
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Mailosaur
|
2
|
+
class Previews
|
3
|
+
#
|
4
|
+
# Creates and initializes a new instance of the Previews class.
|
5
|
+
# @param client connection.
|
6
|
+
#
|
7
|
+
def initialize(conn, handle_http_error)
|
8
|
+
@conn = conn
|
9
|
+
@handle_http_error = handle_http_error
|
10
|
+
end
|
11
|
+
|
12
|
+
# @return [Connection] the client connection.
|
13
|
+
attr_reader :conn
|
14
|
+
|
15
|
+
#
|
16
|
+
# List all email clients that can be used to generate email previews.
|
17
|
+
#
|
18
|
+
# Returns a list of available email clients.
|
19
|
+
#
|
20
|
+
# @return [PreviewEmailClientListResult] operation results.
|
21
|
+
#
|
22
|
+
def list_email_clients
|
23
|
+
response = conn.get 'api/previews/clients'
|
24
|
+
@handle_http_error.call(response) unless response.status == 200
|
25
|
+
model = JSON.parse(response.body)
|
26
|
+
Mailosaur::Models::PreviewEmailClientListResult.new(model)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/Mailosaur/version.rb
CHANGED
data/lib/mailosaur.rb
CHANGED
@@ -15,6 +15,7 @@ module Mailosaur
|
|
15
15
|
autoload :Servers, 'Mailosaur/servers.rb'
|
16
16
|
autoload :Usage, 'Mailosaur/usage.rb'
|
17
17
|
autoload :Devices, 'Mailosaur/devices.rb'
|
18
|
+
autoload :Previews, 'Mailosaur/previews.rb'
|
18
19
|
autoload :MailosaurError, 'Mailosaur/mailosaur_error.rb'
|
19
20
|
|
20
21
|
module Models
|
@@ -47,6 +48,12 @@ module Mailosaur
|
|
47
48
|
autoload :DeviceListResult, 'Mailosaur/models/device_list_result.rb'
|
48
49
|
autoload :DeviceCreateOptions, 'Mailosaur/models/device_create_options.rb'
|
49
50
|
autoload :OtpResult, 'Mailosaur/models/otp_result.rb'
|
51
|
+
autoload :Preview, 'Mailosaur/models/preview.rb'
|
52
|
+
autoload :PreviewEmailClient, 'Mailosaur/models/preview_email_client.rb'
|
53
|
+
autoload :PreviewEmailClientListResult, 'Mailosaur/models/preview_email_client_list_result.rb'
|
54
|
+
autoload :PreviewListResult, 'Mailosaur/models/preview_list_result.rb'
|
55
|
+
autoload :PreviewRequest, 'Mailosaur/models/preview_request.rb'
|
56
|
+
autoload :PreviewRequestOptions, 'Mailosaur/models/preview_request_options.rb'
|
50
57
|
autoload :BaseModel, 'Mailosaur/models/base_model.rb'
|
51
58
|
end
|
52
59
|
|
@@ -86,11 +93,16 @@ module Mailosaur
|
|
86
93
|
@usage ||= Usage.new(connection, method(:handle_http_error))
|
87
94
|
end
|
88
95
|
|
89
|
-
# @return [Devices]
|
96
|
+
# @return [Devices] devices
|
90
97
|
def devices
|
91
98
|
@devices ||= Devices.new(connection, method(:handle_http_error))
|
92
99
|
end
|
93
100
|
|
101
|
+
# @return [Previews] previews
|
102
|
+
def previews
|
103
|
+
@previews ||= Previews.new(connection, method(:handle_http_error))
|
104
|
+
end
|
105
|
+
|
94
106
|
private
|
95
107
|
|
96
108
|
def connection
|
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.13.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: 2023-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -56,20 +56,14 @@ dependencies:
|
|
56
56
|
requirements:
|
57
57
|
- - "~>"
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: '2.
|
60
|
-
- - ">="
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: 2.7.1
|
59
|
+
version: '2.8'
|
63
60
|
type: :development
|
64
61
|
prerelease: false
|
65
62
|
version_requirements: !ruby/object:Gem::Requirement
|
66
63
|
requirements:
|
67
64
|
- - "~>"
|
68
65
|
- !ruby/object:Gem::Version
|
69
|
-
version: '2.
|
70
|
-
- - ">="
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version: 2.7.1
|
66
|
+
version: '2.8'
|
73
67
|
- !ruby/object:Gem::Dependency
|
74
68
|
name: rake
|
75
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,6 +165,12 @@ files:
|
|
171
165
|
- lib/Mailosaur/models/message_summary.rb
|
172
166
|
- lib/Mailosaur/models/metadata.rb
|
173
167
|
- lib/Mailosaur/models/otp_result.rb
|
168
|
+
- lib/Mailosaur/models/preview.rb
|
169
|
+
- lib/Mailosaur/models/preview_email_client.rb
|
170
|
+
- lib/Mailosaur/models/preview_email_client_list_result.rb
|
171
|
+
- lib/Mailosaur/models/preview_list_result.rb
|
172
|
+
- lib/Mailosaur/models/preview_request.rb
|
173
|
+
- lib/Mailosaur/models/preview_request_options.rb
|
174
174
|
- lib/Mailosaur/models/search_criteria.rb
|
175
175
|
- lib/Mailosaur/models/server.rb
|
176
176
|
- lib/Mailosaur/models/server_create_options.rb
|
@@ -183,6 +183,7 @@ files:
|
|
183
183
|
- lib/Mailosaur/models/usage_transaction.rb
|
184
184
|
- lib/Mailosaur/models/usage_transaction_list_result.rb
|
185
185
|
- lib/Mailosaur/module_definition.rb
|
186
|
+
- lib/Mailosaur/previews.rb
|
186
187
|
- lib/Mailosaur/servers.rb
|
187
188
|
- lib/Mailosaur/usage.rb
|
188
189
|
- lib/Mailosaur/version.rb
|
@@ -211,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
211
212
|
- !ruby/object:Gem::Version
|
212
213
|
version: '0'
|
213
214
|
requirements: []
|
214
|
-
rubygems_version: 3.3.
|
215
|
+
rubygems_version: 3.3.26
|
215
216
|
signing_key:
|
216
217
|
specification_version: 4
|
217
218
|
summary: The Mailosaur Ruby library
|