mailosaur 5.0.2 → 5.0.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE +1 -1
- data/README.md +0 -39
- data/lib/Mailosaur/analysis.rb +14 -161
- data/lib/Mailosaur/files.rb +21 -253
- data/lib/Mailosaur/messages.rb +63 -567
- data/lib/Mailosaur/models/attachment.rb +10 -77
- data/lib/Mailosaur/models/base_model.rb +16 -0
- data/lib/Mailosaur/models/forwarding_rule.rb +8 -61
- data/lib/Mailosaur/models/image.rb +6 -45
- data/lib/Mailosaur/models/link.rb +6 -45
- data/lib/Mailosaur/models/message.rb +21 -173
- data/lib/Mailosaur/models/message_address.rb +7 -53
- data/lib/Mailosaur/models/message_content.rb +9 -71
- data/lib/Mailosaur/models/message_header.rb +6 -45
- data/lib/Mailosaur/models/message_list_result.rb +6 -45
- data/lib/Mailosaur/models/message_summary.rb +20 -162
- data/lib/Mailosaur/models/metadata.rb +6 -45
- data/lib/Mailosaur/models/search_criteria.rb +7 -53
- data/lib/Mailosaur/models/server.rb +11 -94
- data/lib/Mailosaur/models/server_create_options.rb +5 -37
- data/lib/Mailosaur/models/server_list_result.rb +6 -45
- data/lib/Mailosaur/models/spam_analysis_result.rb +7 -48
- data/lib/Mailosaur/models/spam_assassin_rule.rb +7 -53
- data/lib/Mailosaur/models/spam_filter_results.rb +6 -46
- data/lib/Mailosaur/module_definition.rb +0 -5
- data/lib/Mailosaur/servers.rb +52 -465
- data/lib/Mailosaur/version.rb +1 -6
- data/lib/mailosaur.rb +32 -16
- metadata +49 -42
- data/lib/Mailosaur/mailosaur_base_client.rb +0 -120
data/lib/Mailosaur/version.rb
CHANGED
data/lib/mailosaur.rb
CHANGED
@@ -4,11 +4,7 @@ require 'base64'
|
|
4
4
|
require 'erb'
|
5
5
|
require 'securerandom'
|
6
6
|
require 'time'
|
7
|
-
require 'timeliness'
|
8
7
|
require 'faraday'
|
9
|
-
require 'faraday-cookie_jar'
|
10
|
-
require 'concurrent'
|
11
|
-
require 'ms_rest'
|
12
8
|
require 'Mailosaur/module_definition'
|
13
9
|
|
14
10
|
module Mailosaur
|
@@ -16,7 +12,6 @@ module Mailosaur
|
|
16
12
|
autoload :Files, 'Mailosaur/files.rb'
|
17
13
|
autoload :Messages, 'Mailosaur/messages.rb'
|
18
14
|
autoload :Servers, 'Mailosaur/servers.rb'
|
19
|
-
autoload :MailosaurBaseClient, 'Mailosaur/mailosaur_base_client.rb'
|
20
15
|
autoload :MailosaurError, 'Mailosaur/mailosaur_error.rb'
|
21
16
|
|
22
17
|
module Models
|
@@ -38,20 +33,41 @@ module Mailosaur
|
|
38
33
|
autoload :ServerListResult, 'Mailosaur/models/server_list_result.rb'
|
39
34
|
autoload :SpamFilterResults, 'Mailosaur/models/spam_filter_results.rb'
|
40
35
|
autoload :ServerCreateOptions, 'Mailosaur/models/server_create_options.rb'
|
36
|
+
autoload :BaseModel, 'Mailosaur/models/base_model.rb'
|
41
37
|
end
|
42
38
|
|
43
|
-
class MailosaurClient
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
39
|
+
class MailosaurClient
|
40
|
+
# @return [Analysis] analysis
|
41
|
+
attr_reader :analysis
|
42
|
+
|
43
|
+
# @return [Files] files
|
44
|
+
attr_reader :files
|
45
|
+
|
46
|
+
# @return [Messages] messages
|
47
|
+
attr_reader :messages
|
48
|
+
|
49
|
+
# @return [Servers] servers
|
50
|
+
attr_reader :servers
|
51
|
+
|
52
|
+
#
|
53
|
+
# Creates initializes a new instance of the MailosaurClient class.
|
54
|
+
# @param api_key [String] your Mailosaur API key.
|
55
|
+
# @param base_url [String] the base URI of the service.
|
56
|
+
#
|
57
|
+
def initialize(api_key, base_url)
|
58
|
+
conn = Faraday.new(base_url || 'https://mailosaur.com/', {
|
59
|
+
:headers => {
|
60
|
+
:content_type => 'application/json; charset=utf-8',
|
61
|
+
:user_agent => 'mailosaur-ruby/5.0.20'
|
62
|
+
}
|
63
|
+
})
|
64
|
+
|
65
|
+
conn.basic_auth(api_key, '')
|
49
66
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
'%s.%s@%s' % [SecureRandom.hex(3), server, host]
|
67
|
+
@analysis = Analysis.new(conn)
|
68
|
+
@files = Files.new(conn)
|
69
|
+
@messages = Messages.new(conn)
|
70
|
+
@servers = Servers.new(conn)
|
55
71
|
end
|
56
72
|
end
|
57
73
|
end
|
metadata
CHANGED
@@ -1,71 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailosaur
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.20
|
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: 2019-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 2.1.0
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
17
|
+
- - ">="
|
25
18
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
27
|
-
-
|
28
|
-
name: ms_rest
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - '='
|
19
|
+
version: 1.7.5
|
20
|
+
- - "<="
|
32
21
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0
|
22
|
+
version: '3.0'
|
34
23
|
type: :runtime
|
35
24
|
prerelease: false
|
36
25
|
version_requirements: !ruby/object:Gem::Requirement
|
37
26
|
requirements:
|
38
|
-
- -
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.7.5
|
30
|
+
- - "<="
|
39
31
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0
|
32
|
+
version: '3.0'
|
41
33
|
- !ruby/object:Gem::Dependency
|
42
34
|
name: faraday
|
43
35
|
requirement: !ruby/object:Gem::Requirement
|
44
36
|
requirements:
|
45
|
-
- - "
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 0.14.0
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
37
|
+
- - ">="
|
53
38
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
55
|
-
-
|
56
|
-
name: faraday-cookie_jar
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
39
|
+
version: 0.9.0
|
40
|
+
- - "<="
|
60
41
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
42
|
+
version: '1.0'
|
62
43
|
type: :runtime
|
63
44
|
prerelease: false
|
64
45
|
version_requirements: !ruby/object:Gem::Requirement
|
65
46
|
requirements:
|
66
|
-
- - "
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 0.9.0
|
50
|
+
- - "<="
|
67
51
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
52
|
+
version: '1.0'
|
69
53
|
- !ruby/object:Gem::Dependency
|
70
54
|
name: rake
|
71
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,6 +57,9 @@ dependencies:
|
|
73
57
|
- - ">="
|
74
58
|
- !ruby/object:Gem::Version
|
75
59
|
version: 10.5.0
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '10.5'
|
76
63
|
type: :development
|
77
64
|
prerelease: false
|
78
65
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -80,11 +67,17 @@ dependencies:
|
|
80
67
|
- - ">="
|
81
68
|
- !ruby/object:Gem::Version
|
82
69
|
version: 10.5.0
|
70
|
+
- - "~>"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '10.5'
|
83
73
|
- !ruby/object:Gem::Dependency
|
84
74
|
name: mail
|
85
75
|
requirement: !ruby/object:Gem::Requirement
|
86
76
|
requirements:
|
87
77
|
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '2.6'
|
80
|
+
- - ">="
|
88
81
|
- !ruby/object:Gem::Version
|
89
82
|
version: 2.6.1
|
90
83
|
type: :development
|
@@ -92,6 +85,9 @@ dependencies:
|
|
92
85
|
version_requirements: !ruby/object:Gem::Requirement
|
93
86
|
requirements:
|
94
87
|
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.6'
|
90
|
+
- - ">="
|
95
91
|
- !ruby/object:Gem::Version
|
96
92
|
version: 2.6.1
|
97
93
|
- !ruby/object:Gem::Dependency
|
@@ -99,6 +95,9 @@ dependencies:
|
|
99
95
|
requirement: !ruby/object:Gem::Requirement
|
100
96
|
requirements:
|
101
97
|
- - "~>"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '1.2'
|
100
|
+
- - ">="
|
102
101
|
- !ruby/object:Gem::Version
|
103
102
|
version: 1.2.2
|
104
103
|
type: :development
|
@@ -106,6 +105,9 @@ dependencies:
|
|
106
105
|
version_requirements: !ruby/object:Gem::Requirement
|
107
106
|
requirements:
|
108
107
|
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '1.2'
|
110
|
+
- - ">="
|
109
111
|
- !ruby/object:Gem::Version
|
110
112
|
version: 1.2.2
|
111
113
|
- !ruby/object:Gem::Dependency
|
@@ -113,6 +115,9 @@ dependencies:
|
|
113
115
|
requirement: !ruby/object:Gem::Requirement
|
114
116
|
requirements:
|
115
117
|
- - "~>"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '3.2'
|
120
|
+
- - ">="
|
116
121
|
- !ruby/object:Gem::Version
|
117
122
|
version: 3.2.7
|
118
123
|
type: :development
|
@@ -120,10 +125,13 @@ dependencies:
|
|
120
125
|
version_requirements: !ruby/object:Gem::Requirement
|
121
126
|
requirements:
|
122
127
|
- - "~>"
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '3.2'
|
130
|
+
- - ">="
|
123
131
|
- !ruby/object:Gem::Version
|
124
132
|
version: 3.2.7
|
125
|
-
description:
|
126
|
-
email:
|
133
|
+
description: Ruby client library for Mailosaur.
|
134
|
+
email: code@mailosaur.com
|
127
135
|
executables: []
|
128
136
|
extensions: []
|
129
137
|
extra_rdoc_files: []
|
@@ -132,10 +140,10 @@ files:
|
|
132
140
|
- README.md
|
133
141
|
- lib/Mailosaur/analysis.rb
|
134
142
|
- lib/Mailosaur/files.rb
|
135
|
-
- lib/Mailosaur/mailosaur_base_client.rb
|
136
143
|
- lib/Mailosaur/mailosaur_error.rb
|
137
144
|
- lib/Mailosaur/messages.rb
|
138
145
|
- lib/Mailosaur/models/attachment.rb
|
146
|
+
- lib/Mailosaur/models/base_model.rb
|
139
147
|
- lib/Mailosaur/models/forwarding_rule.rb
|
140
148
|
- lib/Mailosaur/models/image.rb
|
141
149
|
- lib/Mailosaur/models/link.rb
|
@@ -176,9 +184,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
176
184
|
- !ruby/object:Gem::Version
|
177
185
|
version: '0'
|
178
186
|
requirements: []
|
179
|
-
|
180
|
-
rubygems_version: 2.6.14
|
187
|
+
rubygems_version: 3.0.3
|
181
188
|
signing_key:
|
182
189
|
specification_version: 4
|
183
|
-
summary:
|
190
|
+
summary: Ruby client library for Mailosaur
|
184
191
|
test_files: []
|
@@ -1,120 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
-
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
-
# regenerated.
|
5
|
-
|
6
|
-
module Mailosaur
|
7
|
-
#
|
8
|
-
# A service client - single point of access to the REST API.
|
9
|
-
#
|
10
|
-
class MailosaurBaseClient < MsRest::ServiceClient
|
11
|
-
include MsRest::Serialization
|
12
|
-
|
13
|
-
# @return [String] the base URI of the service.
|
14
|
-
attr_accessor :base_url
|
15
|
-
|
16
|
-
# @return Subscription credentials which uniquely identify client
|
17
|
-
# subscription.
|
18
|
-
attr_accessor :credentials
|
19
|
-
|
20
|
-
# @return [Analysis] analysis
|
21
|
-
attr_reader :analysis
|
22
|
-
|
23
|
-
# @return [Files] files
|
24
|
-
attr_reader :files
|
25
|
-
|
26
|
-
# @return [Messages] messages
|
27
|
-
attr_reader :messages
|
28
|
-
|
29
|
-
# @return [Servers] servers
|
30
|
-
attr_reader :servers
|
31
|
-
|
32
|
-
#
|
33
|
-
# Creates initializes a new instance of the MailosaurBaseClient class.
|
34
|
-
# @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
|
35
|
-
# @param base_url [String] the base URI of the service.
|
36
|
-
# @param options [Array] filters to be applied to the HTTP requests.
|
37
|
-
#
|
38
|
-
def initialize(credentials = nil, base_url = nil, options = nil)
|
39
|
-
super(credentials, options)
|
40
|
-
@base_url = base_url || 'https://mailosaur.com/'
|
41
|
-
|
42
|
-
fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
|
43
|
-
@credentials = credentials
|
44
|
-
|
45
|
-
@analysis = Analysis.new(self)
|
46
|
-
@files = Files.new(self)
|
47
|
-
@messages = Messages.new(self)
|
48
|
-
@servers = Servers.new(self)
|
49
|
-
add_telemetry
|
50
|
-
end
|
51
|
-
|
52
|
-
#
|
53
|
-
# Makes a request and returns the body of the response.
|
54
|
-
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
55
|
-
# @param path [String] the path, relative to {base_url}.
|
56
|
-
# @param options [Hash{String=>String}] specifying any request options like :body.
|
57
|
-
# @return [Hash{String=>String}] containing the body of the response.
|
58
|
-
# Example:
|
59
|
-
#
|
60
|
-
# request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
|
61
|
-
# path = "/path"
|
62
|
-
# options = {
|
63
|
-
# body: request_content,
|
64
|
-
# query_params: {'api-version' => '2016-02-01'}
|
65
|
-
# }
|
66
|
-
# result = @client.make_request(:put, path, options)
|
67
|
-
#
|
68
|
-
def make_request(method, path, options = {})
|
69
|
-
result = make_request_with_http_info(method, path, options)
|
70
|
-
result.body unless result.nil?
|
71
|
-
end
|
72
|
-
|
73
|
-
#
|
74
|
-
# Makes a request and returns the operation response.
|
75
|
-
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
76
|
-
# @param path [String] the path, relative to {base_url}.
|
77
|
-
# @param options [Hash{String=>String}] specifying any request options like :body.
|
78
|
-
# @return [MsRest::HttpOperationResponse] Operation response containing the request, response and status.
|
79
|
-
#
|
80
|
-
def make_request_with_http_info(method, path, options = {})
|
81
|
-
result = make_request_async(method, path, options).value!
|
82
|
-
result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
|
83
|
-
result
|
84
|
-
end
|
85
|
-
|
86
|
-
#
|
87
|
-
# Makes a request asynchronously.
|
88
|
-
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
89
|
-
# @param path [String] the path, relative to {base_url}.
|
90
|
-
# @param options [Hash{String=>String}] specifying any request options like :body.
|
91
|
-
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
92
|
-
#
|
93
|
-
def make_request_async(method, path, options = {})
|
94
|
-
fail ArgumentError, 'method is nil' if method.nil?
|
95
|
-
fail ArgumentError, 'path is nil' if path.nil?
|
96
|
-
|
97
|
-
request_url = options[:base_url] || @base_url
|
98
|
-
if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
|
99
|
-
@request_headers['Content-Type'] = options[:headers]['Content-Type']
|
100
|
-
end
|
101
|
-
|
102
|
-
request_headers = @request_headers
|
103
|
-
options.merge!({headers: request_headers.merge(options[:headers] || {})})
|
104
|
-
options.merge!({credentials: @credentials}) unless @credentials.nil?
|
105
|
-
|
106
|
-
super(request_url, method, path, options)
|
107
|
-
end
|
108
|
-
|
109
|
-
|
110
|
-
private
|
111
|
-
#
|
112
|
-
# Adds telemetry information.
|
113
|
-
#
|
114
|
-
def add_telemetry
|
115
|
-
sdk_information = 'Mailosaur'
|
116
|
-
sdk_information = "#{sdk_information}/5.0.2"
|
117
|
-
add_user_agent_information(sdk_information)
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|