MailchimpTransactional 1.0.6 → 1.0.13
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 +30 -115
- data/lib/MailchimpTransactional/api_error.rb +1 -1
- 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.13
|
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.13
|
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,162 +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
|
-
|
86
|
-
def request(http_method, url, body = nil, headers = nil)
|
87
|
-
if http_method.to_sym.downcase == :post
|
88
|
-
Faraday.post(url, body.to_json, headers)
|
89
|
-
else
|
90
|
-
fail ApiError.new('http_method must be :post')
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
# Return Accept header based on an array of accepts provided.
|
95
|
-
# @param [Array] accepts array for Accept
|
96
|
-
# @return [String] the Accept header (e.g. application/json)
|
97
|
-
def select_header_accept(accepts)
|
98
|
-
return nil if accepts.nil? || accepts.empty?
|
99
|
-
# use JSON when present, otherwise use all of the provided
|
100
|
-
json_accept = accepts.find { |s| json_mime?(s) }
|
101
|
-
json_accept || accepts.join(',')
|
102
|
-
end
|
103
|
-
|
104
|
-
# Return Content-Type header based on an array of content types provided.
|
105
|
-
# @param [Array] content_types array for Content-Type
|
106
|
-
# @return [String] the Content-Type header (e.g. application/json)
|
107
|
-
def select_header_content_type(content_types)
|
108
|
-
# use application/json by default
|
109
|
-
return 'application/json' if content_types.nil? || content_types.empty?
|
110
|
-
# use JSON when present, otherwise use the first one
|
111
|
-
json_content_type = content_types.find { |s| json_mime?(s) }
|
112
|
-
json_content_type || content_types.first
|
113
|
-
end
|
114
|
-
|
115
|
-
# Convert object (array, hash, object, etc) to JSON string.
|
116
|
-
# @param [Object] model object to be converted into JSON string
|
117
|
-
# @return [String] JSON string representation of the object
|
118
|
-
def object_to_http_body(model)
|
119
|
-
return model if model.nil? || model.is_a?(String)
|
120
|
-
local_body = nil
|
121
|
-
if model.is_a?(Array)
|
122
|
-
local_body = model.map { |m| object_to_hash(m) }
|
123
|
-
else
|
124
|
-
local_body = object_to_hash(model)
|
125
|
-
end
|
126
|
-
local_body.to_json
|
127
|
-
end
|
128
|
-
|
129
|
-
# Convert object(non-array) to hash.
|
130
|
-
# @param [Object] obj object to be converted into JSON string
|
131
|
-
# @return [String] JSON string representation of the object
|
132
|
-
def object_to_hash(obj)
|
133
|
-
if obj.respond_to?(:to_hash)
|
134
|
-
obj.to_hash
|
135
|
-
else
|
136
|
-
obj
|
137
|
-
end
|
138
|
-
end
|
139
79
|
|
140
|
-
|
141
|
-
|
142
|
-
def build_collection_param(param, collection_format)
|
143
|
-
case collection_format
|
144
|
-
when :csv
|
145
|
-
param.join(',')
|
146
|
-
when :ssv
|
147
|
-
param.join(' ')
|
148
|
-
when :tsv
|
149
|
-
param.join("\t")
|
150
|
-
when :pipes
|
151
|
-
param.join('|')
|
152
|
-
when :multi
|
153
|
-
# return the array directly as typhoeus will handle it as expected
|
154
|
-
param
|
155
|
-
else
|
156
|
-
fail "unknown collection format: #{collection_format.inspect}"
|
80
|
+
if (!data)
|
81
|
+
fail ApiError.new(:status => res.status, :response_body => res.body)
|
157
82
|
end
|
158
|
-
end
|
159
83
|
|
160
|
-
|
161
|
-
# JSON MIME examples:
|
162
|
-
# application/json
|
163
|
-
# application/json; charset=UTF8
|
164
|
-
# APPLICATION/JSON
|
165
|
-
# */*
|
166
|
-
# @param [String] mime MIME
|
167
|
-
# @return [Boolean] True if the MIME is application/json
|
168
|
-
def json_mime?(mime)
|
169
|
-
(mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
|
84
|
+
return data
|
170
85
|
end
|
171
86
|
end
|
172
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.13
|
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.13
|
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.13
|
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.13'
|
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.13
|
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-
|
11
|
+
date: 2020-08-18 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
|