MailchimpMarketing 3.0.5 → 3.0.6

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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/MailchimpMarketing.gemspec +1 -1
  3. data/README.md +22 -26
  4. data/lib/MailchimpMarketing.rb +1 -1
  5. data/lib/MailchimpMarketing/api/activity_feed_api.rb +11 -67
  6. data/lib/MailchimpMarketing/api/authorized_apps_api.rb +17 -110
  7. data/lib/MailchimpMarketing/api/automations_api.rb +111 -666
  8. data/lib/MailchimpMarketing/api/batch_webhooks_api.rb +28 -177
  9. data/lib/MailchimpMarketing/api/batches_api.rb +22 -142
  10. data/lib/MailchimpMarketing/api/campaign_folders_api.rb +28 -177
  11. data/lib/MailchimpMarketing/api/campaigns_api.rb +125 -784
  12. data/lib/MailchimpMarketing/api/connected_sites_api.rb +27 -174
  13. data/lib/MailchimpMarketing/api/conversations_api.rb +31 -200
  14. data/lib/MailchimpMarketing/api/dashboard_api.rb +26 -215
  15. data/lib/MailchimpMarketing/api/ecommerce_api.rb +388 -2253
  16. data/lib/MailchimpMarketing/api/external_auths_api.rb +17 -110
  17. data/lib/MailchimpMarketing/api/facebook_ads_api.rb +14 -81
  18. data/lib/MailchimpMarketing/api/file_manager_api.rb +60 -402
  19. data/lib/MailchimpMarketing/api/landing_pages_api.rb +45 -280
  20. data/lib/MailchimpMarketing/api/lists_api.rb +420 -2575
  21. data/lib/MailchimpMarketing/api/ping_api.rb +6 -32
  22. data/lib/MailchimpMarketing/api/postcards_api.rb +8 -40
  23. data/lib/MailchimpMarketing/api/reporting_api.rb +35 -231
  24. data/lib/MailchimpMarketing/api/reports_api.rb +131 -881
  25. data/lib/MailchimpMarketing/api/root_api.rb +6 -36
  26. data/lib/MailchimpMarketing/api/search_campaigns_api.rb +7 -38
  27. data/lib/MailchimpMarketing/api/search_members_api.rb +7 -40
  28. data/lib/MailchimpMarketing/api/template_folders_api.rb +28 -177
  29. data/lib/MailchimpMarketing/api/templates_api.rb +34 -228
  30. data/lib/MailchimpMarketing/api/verified_domains_api.rb +27 -165
  31. data/lib/MailchimpMarketing/api_client.rb +11 -55
  32. data/lib/MailchimpMarketing/api_error.rb +1 -1
  33. data/lib/MailchimpMarketing/configuration.rb +1 -1
  34. data/lib/MailchimpMarketing/version.rb +2 -2
  35. metadata +2 -2
@@ -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: 3.0.5
6
+ OpenAPI spec version: 3.0.6
7
7
  Contact: apihelp@mailchimp.com
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
  Swagger Codegen version: 2.4.12
@@ -15,20 +15,9 @@ require 'faraday'
15
15
 
16
16
  module MailchimpMarketing
17
17
  class ApiClient
18
- # Defines the headers to be used in HTTP requests of all API calls by default.
19
- #
20
- # @return [Hash]
21
- attr_accessor :default_headers
22
-
23
- # Initializes the ApiClient
24
18
  def initialize(config = {})
25
19
  @host = "https://server.api.mailchimp.com/3.0"
26
20
  @user_agent = "Swagger-Codegen/#{VERSION}/ruby"
27
- @default_headers = {
28
- 'Content-Type' => 'application/json',
29
- 'User-Agent' => @user_agent
30
- }
31
-
32
21
  set_config(config)
33
22
  end
34
23
 
@@ -40,11 +29,9 @@ module MailchimpMarketing
40
29
  begin
41
30
  split = api_key.split('-')
42
31
  server = 'invalid-server'
43
-
44
32
  if split.length == 2
45
33
  server = split[1]
46
34
  end
47
-
48
35
  server
49
36
  rescue
50
37
  ""
@@ -52,11 +39,8 @@ module MailchimpMarketing
52
39
  end
53
40
 
54
41
  def set_config(config = {})
55
- # Basic Auth
56
42
  @api_key = config[:api_key] || ''
57
43
  @is_basic_auth = @api_key.to_s.strip.empty? == false
58
-
59
- # OAuth
60
44
  @access_token = config[:access_token] || ''
61
45
  @is_oauth = @access_token.to_s.strip.empty? == false
62
46
 
@@ -69,7 +53,10 @@ module MailchimpMarketing
69
53
  end
70
54
 
71
55
  def call_api(http_method, path, opts = {})
72
- header_params = @default_headers.merge(opts[:header_params] || {})
56
+ header_params = {
57
+ 'Content-Type' => 'application/json',
58
+ 'User-Agent' => @user_agent
59
+ }
73
60
  query_params = opts[:query_params] || {}
74
61
  form_params = opts[:form_params] || {}
75
62
 
@@ -100,16 +87,14 @@ module MailchimpMarketing
100
87
  host = @server.length > 0 ? @host.sub('server', @server) : @host
101
88
  url = host + path
102
89
 
103
- # Basic Authentication
90
+ # Apply Authentication
104
91
  conn = Faraday.new(url) do |conn|
92
+ conn.headers = header_params
105
93
  conn.params = query_params
106
94
 
107
95
  if @is_basic_auth
108
- conn.headers = header_params
109
96
  conn.basic_auth('user', @api_key)
110
- end
111
-
112
- if @is_oauth
97
+ elsif @is_oauth
113
98
  conn.headers["Authorization"] = "Bearer #{@access_token}"
114
99
  end
115
100
  end
@@ -144,34 +129,24 @@ module MailchimpMarketing
144
129
 
145
130
  # Sanitize filename by removing path.
146
131
  # e.g. ../../sun.gif becomes sun.gif
147
- #
148
- # @param [String] filename the filename to be sanitized
149
- # @return [String] the sanitized filename
150
132
  def sanitize_filename(filename)
151
133
  filename.gsub(/.*[\/\\]/, '')
152
134
  end
153
135
 
136
+ # Add leading and trailing slashes to path
154
137
  def build_request_url(path)
155
- # Add leading and trailing slashes to path
156
138
  path = "/#{path}".gsub(/\/+/, '/')
157
139
  URI.encode(@config.base_url + path)
158
140
  end
159
141
 
160
- # Builds the HTTP request body
161
- #
162
- # @param [Hash] header_params Header parameters
163
- # @param [Hash] form_params Query parameters
164
- # @param [Object] body HTTP body (JSON/XML)
165
- # @return [String] HTTP body data in the form of string
142
+ # Format HTTP request body as string
166
143
  def build_request_body(header_params, form_params, body)
167
- # http form
168
144
  if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
169
145
  header_params['Content-Type'] == 'multipart/form-data'
170
146
  data = {}
171
147
  form_params.each do |key, value|
172
148
  case value
173
149
  when ::File, ::Array, nil
174
- # let typhoeus handle File, Array and nil parameters
175
150
  data[key] = value
176
151
  else
177
152
  data[key] = value.to_s
@@ -186,29 +161,21 @@ module MailchimpMarketing
186
161
  end
187
162
 
188
163
  # Return Accept header based on an array of accepts provided.
189
- # @param [Array] accepts array for Accept
190
- # @return [String] the Accept header (e.g. application/json)
191
164
  def select_header_accept(accepts)
192
165
  return nil if accepts.nil? || accepts.empty?
193
- # use JSON when present, otherwise use all of the provided
194
166
  json_accept = accepts.find { |s| json_mime?(s) }
195
167
  json_accept || accepts.join(',')
196
168
  end
197
169
 
198
170
  # Return Content-Type header based on an array of content types provided.
199
- # @param [Array] content_types array for Content-Type
200
- # @return [String] the Content-Type header (e.g. application/json)
201
171
  def select_header_content_type(content_types)
202
- # use application/json by default
203
172
  return 'application/json' if content_types.nil? || content_types.empty?
204
- # use JSON when present, otherwise use the first one
173
+
205
174
  json_content_type = content_types.find { |s| json_mime?(s) }
206
175
  json_content_type || content_types.first
207
176
  end
208
177
 
209
178
  # Convert object (array, hash, object, etc) to JSON string.
210
- # @param [Object] model object to be converted into JSON string
211
- # @return [String] JSON string representation of the object
212
179
  def object_to_http_body(model)
213
180
  return model if model.nil? || model.is_a?(String)
214
181
  local_body = nil
@@ -221,8 +188,6 @@ module MailchimpMarketing
221
188
  end
222
189
 
223
190
  # Convert object(non-array) to hash.
224
- # @param [Object] obj object to be converted into JSON string
225
- # @return [String] JSON string representation of the object
226
191
  def object_to_hash(obj)
227
192
  if obj.respond_to?(:to_hash)
228
193
  obj.to_hash
@@ -232,7 +197,6 @@ module MailchimpMarketing
232
197
  end
233
198
 
234
199
  # Build parameter value according to the given collection format.
235
- # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi
236
200
  def build_collection_param(param, collection_format)
237
201
  case collection_format
238
202
  when :csv
@@ -244,7 +208,6 @@ module MailchimpMarketing
244
208
  when :pipes
245
209
  param.join('|')
246
210
  when :multi
247
- # return the array directly as typhoeus will handle it as expected
248
211
  param
249
212
  else
250
213
  fail "unknown collection format: #{collection_format.inspect}"
@@ -252,13 +215,6 @@ module MailchimpMarketing
252
215
  end
253
216
 
254
217
  # Check if the given MIME is a JSON MIME.
255
- # JSON MIME examples:
256
- # application/json
257
- # application/json; charset=UTF8
258
- # APPLICATION/JSON
259
- # */*
260
- # @param [String] mime MIME
261
- # @return [Boolean] True if the MIME is application/json
262
218
  def json_mime?(mime)
263
219
  (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
264
220
  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: 3.0.5
6
+ OpenAPI spec version: 3.0.6
7
7
  Contact: apihelp@mailchimp.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: 3.0.5
6
+ OpenAPI spec version: 3.0.6
7
7
  Contact: apihelp@mailchimp.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: 3.0.5
6
+ OpenAPI spec version: 3.0.6
7
7
  Contact: apihelp@mailchimp.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 MailchimpMarketing
14
- VERSION = '3.0.5'
14
+ VERSION = '3.0.6'
15
15
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: MailchimpMarketing
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.5
4
+ version: 3.0.6
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-08-03 00:00:00.000000000 Z
11
+ date: 2020-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday