MailchimpTransactional 1.0.5 → 1.0.12
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/Gemfile +1 -1
- data/LICENSE +53 -0
- data/MailchimpTransactional.gemspec +2 -2
- data/README.md +33 -14
- data/lib/MailchimpTransactional.rb +59 -75
- data/lib/MailchimpTransactional/api/exports_api.rb +18 -121
- data/lib/MailchimpTransactional/api/inbound_api.rb +37 -220
- data/lib/MailchimpTransactional/api/ips_api.rb +44 -307
- data/lib/MailchimpTransactional/api/messages_api.rb +45 -268
- data/lib/MailchimpTransactional/api/metadata_api.rb +16 -99
- data/lib/MailchimpTransactional/api/rejects_api.rb +12 -75
- data/lib/MailchimpTransactional/api/senders_api.rb +29 -172
- data/lib/MailchimpTransactional/api/subaccounts_api.rb +29 -172
- data/lib/MailchimpTransactional/api/tags_api.rb +22 -125
- data/lib/MailchimpTransactional/api/templates_api.rb +33 -196
- data/lib/MailchimpTransactional/api/urls_api.rb +27 -150
- data/lib/MailchimpTransactional/api/users_api.rb +19 -102
- data/lib/MailchimpTransactional/api/webhooks_api.rb +23 -126
- data/lib/MailchimpTransactional/api/whitelists_api.rb +12 -75
- data/lib/MailchimpTransactional/api_client.rb +31 -38
- data/lib/MailchimpTransactional/api_error.rb +2 -2
- data/lib/MailchimpTransactional/configuration.rb +1 -1
- data/lib/MailchimpTransactional/version.rb +2 -2
- metadata +6 -11
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
5
|
|
6
|
-
OpenAPI spec version: 1.0.
|
6
|
+
OpenAPI spec version: 1.0.12
|
7
7
|
Contact: apihelp@mandrill.com
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
9
|
Swagger Codegen version: 2.4.12
|
@@ -16,101 +16,38 @@ module MailchimpTransactional
|
|
16
16
|
class WhitelistsApi
|
17
17
|
attr_accessor :api_client
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
def initialize(api_key = '', api_client = ApiClient.default)
|
22
|
-
@api_key = api_key
|
19
|
+
def initialize(api_client = ApiClient.default)
|
23
20
|
@api_client = api_client
|
24
21
|
end
|
25
|
-
# /whitelists/add
|
26
|
-
# Adds an email to your email rejection whitelist. If the address is currently on your blacklist, that blacklist entry will be removed automatically.
|
27
|
-
# @param body
|
28
|
-
# @param [Hash] opts the optional parameters
|
29
|
-
# @return [InlineResponse20076]
|
30
|
-
def add(body = {}, opts = {})
|
31
|
-
data, _status_code, _headers = add_with_http_info(body, opts)
|
32
|
-
data
|
33
|
-
end
|
34
22
|
|
35
|
-
#
|
23
|
+
# Add email to whitelist
|
36
24
|
# Adds an email to your email rejection whitelist. If the address is currently on your blacklist, that blacklist entry will be removed automatically.
|
37
25
|
# @param body
|
38
26
|
# @param [Hash] opts the optional parameters
|
39
27
|
# @return [Array<(InlineResponse20076, Fixnum, Hash)>] InlineResponse20076 data, response status code and response headers
|
40
|
-
def
|
41
|
-
|
42
|
-
body[:key] = @api_key
|
43
|
-
|
44
|
-
# resource path
|
45
|
-
local_var_path = '/whitelists/add'
|
46
|
-
|
47
|
-
# http body (model)
|
48
|
-
auth_names = []
|
49
|
-
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
50
|
-
:body => body,
|
51
|
-
:auth_names => auth_names,
|
52
|
-
:return_type => 'InlineResponse20076')
|
53
|
-
return data, status_code, headers
|
54
|
-
end
|
55
|
-
# /whitelists/delete
|
56
|
-
# Removes an email address from the whitelist.
|
57
|
-
# @param body
|
58
|
-
# @param [Hash] opts the optional parameters
|
59
|
-
# @return [InlineResponse20078]
|
60
|
-
def delete(body = {}, opts = {})
|
61
|
-
data, _status_code, _headers = delete_with_http_info(body, opts)
|
28
|
+
def add(body = {})
|
29
|
+
data = @api_client.call_api(:POST, '/whitelists/add', body)
|
62
30
|
data
|
63
31
|
end
|
64
32
|
|
65
|
-
#
|
33
|
+
# Remove email from whitelist
|
66
34
|
# Removes an email address from the whitelist.
|
67
35
|
# @param body
|
68
36
|
# @param [Hash] opts the optional parameters
|
69
37
|
# @return [Array<(InlineResponse20078, Fixnum, Hash)>] InlineResponse20078 data, response status code and response headers
|
70
|
-
def
|
71
|
-
|
72
|
-
body[:key] = @api_key
|
73
|
-
|
74
|
-
# resource path
|
75
|
-
local_var_path = '/whitelists/delete'
|
76
|
-
|
77
|
-
# http body (model)
|
78
|
-
auth_names = []
|
79
|
-
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
80
|
-
:body => body,
|
81
|
-
:auth_names => auth_names,
|
82
|
-
:return_type => 'InlineResponse20078')
|
83
|
-
return data, status_code, headers
|
84
|
-
end
|
85
|
-
# /whitelists/list
|
86
|
-
# Retrieves your email rejection whitelist. You can provide an email address or search prefix to limit the results. Returns up to 1000 results.
|
87
|
-
# @param body
|
88
|
-
# @param [Hash] opts the optional parameters
|
89
|
-
# @return [Array<InlineResponse20077>]
|
90
|
-
def list(body = {}, opts = {})
|
91
|
-
data, _status_code, _headers = list_with_http_info(body, opts)
|
38
|
+
def delete(body = {})
|
39
|
+
data = @api_client.call_api(:POST, '/whitelists/delete', body)
|
92
40
|
data
|
93
41
|
end
|
94
42
|
|
95
|
-
#
|
43
|
+
# List whitelisted emails
|
96
44
|
# Retrieves your email rejection whitelist. You can provide an email address or search prefix to limit the results. Returns up to 1000 results.
|
97
45
|
# @param body
|
98
46
|
# @param [Hash] opts the optional parameters
|
99
47
|
# @return [Array<(Array<InlineResponse20077>, Fixnum, Hash)>] Array<InlineResponse20077> data, response status code and response headers
|
100
|
-
def
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
# resource path
|
105
|
-
local_var_path = '/whitelists/list'
|
106
|
-
|
107
|
-
# http body (model)
|
108
|
-
auth_names = []
|
109
|
-
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
110
|
-
:body => body,
|
111
|
-
:auth_names => auth_names,
|
112
|
-
:return_type => 'Array<InlineResponse20077>')
|
113
|
-
return data, status_code, headers
|
48
|
+
def list(body = {})
|
49
|
+
data = @api_client.call_api(:POST, '/whitelists/list', body)
|
50
|
+
data
|
114
51
|
end
|
115
52
|
end
|
116
53
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
5
|
|
6
|
-
OpenAPI spec version: 1.0.
|
6
|
+
OpenAPI spec version: 1.0.12
|
7
7
|
Contact: apihelp@mandrill.com
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
9
|
Swagger Codegen version: 2.4.12
|
@@ -11,84 +11,77 @@ Swagger Codegen version: 2.4.12
|
|
11
11
|
=end
|
12
12
|
|
13
13
|
require 'json'
|
14
|
-
require '
|
14
|
+
require 'excon'
|
15
15
|
|
16
16
|
module MailchimpTransactional
|
17
17
|
class ApiClient
|
18
|
-
|
19
|
-
#
|
20
|
-
# @return [Hash]
|
21
|
-
attr_accessor :default_headers
|
22
|
-
|
23
|
-
# Initializes the ApiClient
|
24
|
-
def initialize()
|
18
|
+
def initialize(api_key = '')
|
25
19
|
@host = "https://mandrillapp.com/api/1.0"
|
26
|
-
@user_agent = "Swagger-Codegen/#{VERSION}/ruby"
|
27
|
-
@default_headers = {
|
28
|
-
'Content-Type' => 'application/json',
|
29
|
-
'User-Agent' => @user_agent
|
30
|
-
}
|
31
20
|
@format_list = ['json', 'xml', 'php', 'yaml']
|
32
|
-
@content_type = 'application/json'
|
33
21
|
@default_output_format = 'json'
|
34
22
|
@accepts = ['application/json', 'application/xml', 'application/x-php', 'application/x-yaml; charset=utf-8']
|
23
|
+
set_api_key(api_key)
|
35
24
|
end
|
36
25
|
|
37
26
|
def self.default
|
38
27
|
@@default ||= ApiClient.new
|
39
28
|
end
|
40
29
|
|
30
|
+
def set_api_key(api_key = '')
|
31
|
+
@api_key = api_key
|
32
|
+
end
|
33
|
+
|
41
34
|
def set_default_output_format(output_format)
|
42
35
|
if @format_list.include? output_format
|
43
36
|
@default_output_format = output_format
|
44
37
|
end
|
45
38
|
end
|
46
39
|
|
47
|
-
def call_api(http_method, path,
|
48
|
-
header_params = @default_headers.merge(opts[:header_params] || {})
|
49
|
-
url = @host + path
|
50
|
-
|
40
|
+
def call_api(http_method, path, body = {})
|
51
41
|
use_default_output_format = true
|
42
|
+
active_output_format = @default_output_format
|
43
|
+
url = @host + path
|
52
44
|
|
53
|
-
|
54
|
-
|
55
|
-
if body && body[:outputFormat]
|
45
|
+
# format body
|
46
|
+
if body[:outputFormat]
|
56
47
|
format = body[:outputFormat].downcase
|
57
48
|
if @format_list.include? format
|
58
49
|
url += ".#{format}"
|
59
50
|
body.delete(:outputFormat)
|
60
51
|
use_default_output_format = false
|
52
|
+
active_output_format = format
|
61
53
|
end
|
62
54
|
end
|
63
55
|
|
56
|
+
# apply output format
|
64
57
|
if use_default_output_format && @format_list.include?(@default_output_format)
|
65
58
|
url += '.%s' % @default_output_format
|
59
|
+
active_output_format = @default_output_format
|
66
60
|
end
|
67
61
|
|
68
|
-
|
62
|
+
# apply api key
|
63
|
+
body[:key] = @api_key
|
64
|
+
|
65
|
+
# send request
|
66
|
+
conn = Excon.new(url, :headers => {'Content-Type' => 'application/json'})
|
67
|
+
res = conn.post(:body => body.to_json)
|
69
68
|
|
69
|
+
# handle response
|
70
70
|
data = nil
|
71
|
-
if res.headers['content-type'] && res.headers['content-type'].include?('application/json')
|
72
|
-
data = JSON.parse(res.body)
|
73
|
-
else
|
74
|
-
data = res.body
|
75
|
-
end
|
76
71
|
|
77
|
-
if
|
78
|
-
if
|
79
|
-
data
|
72
|
+
if res.status == 200
|
73
|
+
if active_output_format == 'json'
|
74
|
+
data = JSON.parse(res.body)
|
80
75
|
else
|
81
|
-
|
76
|
+
data = res.body
|
82
77
|
end
|
83
78
|
end
|
84
|
-
end
|
85
79
|
|
86
|
-
|
87
|
-
|
88
|
-
Faraday.post(url, body.to_json, headers)
|
89
|
-
else
|
90
|
-
fail ApiError.new('http_method must be :post')
|
80
|
+
if (!data)
|
81
|
+
fail ApiError.new(:status => res.status, :response_body => res.body)
|
91
82
|
end
|
83
|
+
|
84
|
+
return data
|
92
85
|
end
|
93
86
|
end
|
94
87
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
5
|
|
6
|
-
OpenAPI spec version: 1.0.
|
6
|
+
OpenAPI spec version: 1.0.12
|
7
7
|
Contact: apihelp@mandrill.com
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
9
|
Swagger Codegen version: 2.4.12
|
@@ -12,7 +12,7 @@ Swagger Codegen version: 2.4.12
|
|
12
12
|
|
13
13
|
module MailchimpTransactional
|
14
14
|
class ApiError < StandardError
|
15
|
-
attr_reader :
|
15
|
+
attr_reader :status, :type, :title, :detail, :instance, :errors,:response_headers, :response_body
|
16
16
|
|
17
17
|
# Usage examples:
|
18
18
|
# ApiError.new
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
5
|
|
6
|
-
OpenAPI spec version: 1.0.
|
6
|
+
OpenAPI spec version: 1.0.12
|
7
7
|
Contact: apihelp@mandrill.com
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
9
|
Swagger Codegen version: 2.4.12
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
5
|
|
6
|
-
OpenAPI spec version: 1.0.
|
6
|
+
OpenAPI spec version: 1.0.12
|
7
7
|
Contact: apihelp@mandrill.com
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
9
|
Swagger Codegen version: 2.4.12
|
@@ -11,5 +11,5 @@ Swagger Codegen version: 2.4.12
|
|
11
11
|
=end
|
12
12
|
|
13
13
|
module MailchimpTransactional
|
14
|
-
VERSION = '1.0.
|
14
|
+
VERSION = '1.0.12'
|
15
15
|
end
|
metadata
CHANGED
@@ -1,35 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: MailchimpTransactional
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Swagger-Codegen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06
|
11
|
+
date: 2020-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: excon
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
- - ">="
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 1.0.1
|
19
|
+
version: 0.76.0
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
30
|
-
- - ">="
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 1.0.1
|
26
|
+
version: 0.76.0
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: json
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -198,6 +192,7 @@ extensions: []
|
|
198
192
|
extra_rdoc_files: []
|
199
193
|
files:
|
200
194
|
- Gemfile
|
195
|
+
- LICENSE
|
201
196
|
- MailchimpTransactional.gemspec
|
202
197
|
- README.md
|
203
198
|
- lib/MailchimpTransactional.rb
|