MailchimpMarketing 3.0.2 → 3.0.5
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/MailchimpMarketing.gemspec +1 -1
- data/README.md +41 -28
- data/lib/MailchimpMarketing.rb +5 -6
- data/lib/MailchimpMarketing/api/activity_feed_api.rb +7 -7
- data/lib/MailchimpMarketing/api/authorized_apps_api.rb +9 -9
- data/lib/MailchimpMarketing/api/automations_api.rb +47 -47
- data/lib/MailchimpMarketing/api/batch_webhooks_api.rb +11 -11
- data/lib/MailchimpMarketing/api/batches_api.rb +9 -9
- data/lib/MailchimpMarketing/api/campaign_folders_api.rb +11 -11
- data/lib/MailchimpMarketing/api/campaigns_api.rb +57 -57
- data/lib/MailchimpMarketing/api/connected_sites_api.rb +11 -11
- data/lib/MailchimpMarketing/api/conversations_api.rb +11 -11
- data/lib/MailchimpMarketing/api/dashboard_api.rb +13 -13
- data/lib/MailchimpMarketing/api/ecommerce_api.rb +119 -119
- data/lib/MailchimpMarketing/api/external_auths_api.rb +7 -7
- data/lib/MailchimpMarketing/api/facebook_ads_api.rb +9 -9
- data/lib/MailchimpMarketing/api/file_manager_api.rb +25 -25
- data/lib/MailchimpMarketing/api/landing_pages_api.rb +13 -13
- data/lib/MailchimpMarketing/api/lists_api.rb +145 -145
- data/lib/MailchimpMarketing/api/ping_api.rb +3 -3
- data/lib/MailchimpMarketing/api/postcards_api.rb +3 -3
- data/lib/MailchimpMarketing/api/reporting_api.rb +25 -25
- data/lib/MailchimpMarketing/api/reports_api.rb +49 -49
- data/lib/MailchimpMarketing/api/root_api.rb +3 -3
- data/lib/MailchimpMarketing/api/search_campaigns_api.rb +3 -3
- data/lib/MailchimpMarketing/api/search_members_api.rb +3 -3
- data/lib/MailchimpMarketing/api/template_folders_api.rb +11 -11
- data/lib/MailchimpMarketing/api/templates_api.rb +15 -15
- data/lib/MailchimpMarketing/api/verified_domains_api.rb +11 -11
- data/lib/MailchimpMarketing/api_client.rb +35 -12
- data/lib/MailchimpMarketing/api_error.rb +1 -1
- data/lib/MailchimpMarketing/configuration.rb +1 -1
- data/lib/MailchimpMarketing/version.rb +2 -2
- 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.
|
6
|
+
OpenAPI spec version: 3.0.5
|
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
|
@@ -19,7 +19,7 @@ module MailchimpMarketing
|
|
19
19
|
def initialize(api_client)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
-
#
|
22
|
+
# List api root resources
|
23
23
|
# Get links to all other resources available in the API.
|
24
24
|
# @param [Hash] opts the optional parameters
|
25
25
|
# @option opts [Array<String>] :fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
|
@@ -30,7 +30,7 @@ module MailchimpMarketing
|
|
30
30
|
data
|
31
31
|
end
|
32
32
|
|
33
|
-
#
|
33
|
+
# List api root resources
|
34
34
|
# Get links to all other resources available in the API.
|
35
35
|
# @param [Hash] opts the optional parameters
|
36
36
|
# @option opts [Array<String>] :fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
|
@@ -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.
|
6
|
+
OpenAPI spec version: 3.0.5
|
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
|
@@ -19,7 +19,7 @@ module MailchimpMarketing
|
|
19
19
|
def initialize(api_client)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
-
# Search
|
22
|
+
# Search campaigns
|
23
23
|
# Search all campaigns for the specified query terms.
|
24
24
|
# @param query The search query used to filter results.
|
25
25
|
# @param [Hash] opts the optional parameters
|
@@ -31,7 +31,7 @@ module MailchimpMarketing
|
|
31
31
|
data
|
32
32
|
end
|
33
33
|
|
34
|
-
# Search
|
34
|
+
# Search campaigns
|
35
35
|
# Search all campaigns for the specified query terms.
|
36
36
|
# @param query The search query used to filter results.
|
37
37
|
# @param [Hash] opts the optional parameters
|
@@ -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.
|
6
|
+
OpenAPI spec version: 3.0.5
|
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
|
@@ -19,7 +19,7 @@ module MailchimpMarketing
|
|
19
19
|
def initialize(api_client)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
-
# Search
|
22
|
+
# Search members
|
23
23
|
# Search for list members. This search can be restricted to a specific list, or can be used to search across all lists in an account.
|
24
24
|
# @param query The search query used to filter results.
|
25
25
|
# @param [Hash] opts the optional parameters
|
@@ -32,7 +32,7 @@ module MailchimpMarketing
|
|
32
32
|
data
|
33
33
|
end
|
34
34
|
|
35
|
-
# Search
|
35
|
+
# Search members
|
36
36
|
# Search for list members. This search can be restricted to a specific list, or can be used to search across all lists in an account.
|
37
37
|
# @param query The search query used to filter results.
|
38
38
|
# @param [Hash] opts the optional parameters
|
@@ -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.
|
6
|
+
OpenAPI spec version: 3.0.5
|
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
|
@@ -19,7 +19,7 @@ module MailchimpMarketing
|
|
19
19
|
def initialize(api_client)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
-
# Delete
|
22
|
+
# Delete template folder
|
23
23
|
# Delete a specific template folder, and mark all the templates in the folder as 'unfiled'.
|
24
24
|
# @param folder_id The unique id for the template folder.
|
25
25
|
# @param [Hash] opts the optional parameters
|
@@ -29,7 +29,7 @@ module MailchimpMarketing
|
|
29
29
|
nil
|
30
30
|
end
|
31
31
|
|
32
|
-
# Delete
|
32
|
+
# Delete template folder
|
33
33
|
# Delete a specific template folder, and mark all the templates in the folder as 'unfiled'.
|
34
34
|
# @param folder_id The unique id for the template folder.
|
35
35
|
# @param [Hash] opts the optional parameters
|
@@ -62,7 +62,7 @@ module MailchimpMarketing
|
|
62
62
|
:auth_names => auth_names)
|
63
63
|
return data, status_code, headers
|
64
64
|
end
|
65
|
-
#
|
65
|
+
# List template folders
|
66
66
|
# Get all folders used to organize templates.
|
67
67
|
# @param [Hash] opts the optional parameters
|
68
68
|
# @option opts [Array<String>] :fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
|
@@ -75,7 +75,7 @@ module MailchimpMarketing
|
|
75
75
|
data
|
76
76
|
end
|
77
77
|
|
78
|
-
#
|
78
|
+
# List template folders
|
79
79
|
# Get all folders used to organize templates.
|
80
80
|
# @param [Hash] opts the optional parameters
|
81
81
|
# @option opts [Array<String>] :fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
|
@@ -116,7 +116,7 @@ module MailchimpMarketing
|
|
116
116
|
:return_type => 'TemplateFolders')
|
117
117
|
return data, status_code, headers
|
118
118
|
end
|
119
|
-
# Get
|
119
|
+
# Get template folder
|
120
120
|
# Get information about a specific folder used to organize templates.
|
121
121
|
# @param folder_id The unique id for the template folder.
|
122
122
|
# @param [Hash] opts the optional parameters
|
@@ -128,7 +128,7 @@ module MailchimpMarketing
|
|
128
128
|
data
|
129
129
|
end
|
130
130
|
|
131
|
-
# Get
|
131
|
+
# Get template folder
|
132
132
|
# Get information about a specific folder used to organize templates.
|
133
133
|
# @param folder_id The unique id for the template folder.
|
134
134
|
# @param [Hash] opts the optional parameters
|
@@ -166,7 +166,7 @@ module MailchimpMarketing
|
|
166
166
|
:return_type => 'TemplateFolder')
|
167
167
|
return data, status_code, headers
|
168
168
|
end
|
169
|
-
# Update
|
169
|
+
# Update template folder
|
170
170
|
# Update a specific folder used to organize templates.
|
171
171
|
# @param folder_id The unique id for the template folder.
|
172
172
|
# @param body
|
@@ -177,7 +177,7 @@ module MailchimpMarketing
|
|
177
177
|
data
|
178
178
|
end
|
179
179
|
|
180
|
-
# Update
|
180
|
+
# Update template folder
|
181
181
|
# Update a specific folder used to organize templates.
|
182
182
|
# @param folder_id The unique id for the template folder.
|
183
183
|
# @param body
|
@@ -212,7 +212,7 @@ module MailchimpMarketing
|
|
212
212
|
:return_type => 'TemplateFolder')
|
213
213
|
return data, status_code, headers
|
214
214
|
end
|
215
|
-
#
|
215
|
+
# Add template folder
|
216
216
|
# Create a new template folder.
|
217
217
|
# @param body
|
218
218
|
# @param [Hash] opts the optional parameters
|
@@ -222,7 +222,7 @@ module MailchimpMarketing
|
|
222
222
|
data
|
223
223
|
end
|
224
224
|
|
225
|
-
#
|
225
|
+
# Add template folder
|
226
226
|
# Create a new template folder.
|
227
227
|
# @param body
|
228
228
|
# @param [Hash] opts the optional parameters
|
@@ -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.
|
6
|
+
OpenAPI spec version: 3.0.5
|
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
|
@@ -19,7 +19,7 @@ module MailchimpMarketing
|
|
19
19
|
def initialize(api_client)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
-
# Delete
|
22
|
+
# Delete template
|
23
23
|
# Delete a specific template.
|
24
24
|
# @param template_id The unique id for the template.
|
25
25
|
# @param [Hash] opts the optional parameters
|
@@ -29,7 +29,7 @@ module MailchimpMarketing
|
|
29
29
|
nil
|
30
30
|
end
|
31
31
|
|
32
|
-
# Delete
|
32
|
+
# Delete template
|
33
33
|
# Delete a specific template.
|
34
34
|
# @param template_id The unique id for the template.
|
35
35
|
# @param [Hash] opts the optional parameters
|
@@ -62,7 +62,7 @@ module MailchimpMarketing
|
|
62
62
|
:auth_names => auth_names)
|
63
63
|
return data, status_code, headers
|
64
64
|
end
|
65
|
-
#
|
65
|
+
# List templates
|
66
66
|
# Get a list of an account's available templates.
|
67
67
|
# @param [Hash] opts the optional parameters
|
68
68
|
# @option opts [Array<String>] :fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
|
@@ -82,7 +82,7 @@ module MailchimpMarketing
|
|
82
82
|
data
|
83
83
|
end
|
84
84
|
|
85
|
-
#
|
85
|
+
# List templates
|
86
86
|
# Get a list of an account's available templates.
|
87
87
|
# @param [Hash] opts the optional parameters
|
88
88
|
# @option opts [Array<String>] :fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
|
@@ -137,7 +137,7 @@ module MailchimpMarketing
|
|
137
137
|
:return_type => 'Templates')
|
138
138
|
return data, status_code, headers
|
139
139
|
end
|
140
|
-
# Get
|
140
|
+
# Get template info
|
141
141
|
# Get information about a specific template.
|
142
142
|
# @param template_id The unique id for the template.
|
143
143
|
# @param [Hash] opts the optional parameters
|
@@ -149,7 +149,7 @@ module MailchimpMarketing
|
|
149
149
|
data
|
150
150
|
end
|
151
151
|
|
152
|
-
# Get
|
152
|
+
# Get template info
|
153
153
|
# Get information about a specific template.
|
154
154
|
# @param template_id The unique id for the template.
|
155
155
|
# @param [Hash] opts the optional parameters
|
@@ -187,7 +187,7 @@ module MailchimpMarketing
|
|
187
187
|
:return_type => 'TemplateInstance')
|
188
188
|
return data, status_code, headers
|
189
189
|
end
|
190
|
-
#
|
190
|
+
# View default content
|
191
191
|
# Get the sections that you can edit in a template, including each section's default content.
|
192
192
|
# @param template_id The unique id for the template.
|
193
193
|
# @param [Hash] opts the optional parameters
|
@@ -199,7 +199,7 @@ module MailchimpMarketing
|
|
199
199
|
data
|
200
200
|
end
|
201
201
|
|
202
|
-
#
|
202
|
+
# View default content
|
203
203
|
# Get the sections that you can edit in a template, including each section's default content.
|
204
204
|
# @param template_id The unique id for the template.
|
205
205
|
# @param [Hash] opts the optional parameters
|
@@ -237,7 +237,7 @@ module MailchimpMarketing
|
|
237
237
|
:return_type => 'TemplateDefaultContent')
|
238
238
|
return data, status_code, headers
|
239
239
|
end
|
240
|
-
# Update
|
240
|
+
# Update template
|
241
241
|
# Update the name, HTML, or `folder_id` of an existing template.
|
242
242
|
# @param template_id The unique id for the template.
|
243
243
|
# @param body
|
@@ -248,7 +248,7 @@ module MailchimpMarketing
|
|
248
248
|
data
|
249
249
|
end
|
250
250
|
|
251
|
-
# Update
|
251
|
+
# Update template
|
252
252
|
# Update the name, HTML, or `folder_id` of an existing template.
|
253
253
|
# @param template_id The unique id for the template.
|
254
254
|
# @param body
|
@@ -283,8 +283,8 @@ module MailchimpMarketing
|
|
283
283
|
:return_type => 'TemplateInstance')
|
284
284
|
return data, status_code, headers
|
285
285
|
end
|
286
|
-
#
|
287
|
-
# Create a new template for the account. Only
|
286
|
+
# Add template
|
287
|
+
# Create a new template for the account. Only Classic templates are supported.
|
288
288
|
# @param body
|
289
289
|
# @param [Hash] opts the optional parameters
|
290
290
|
# @return [TemplateInstance]
|
@@ -293,8 +293,8 @@ module MailchimpMarketing
|
|
293
293
|
data
|
294
294
|
end
|
295
295
|
|
296
|
-
#
|
297
|
-
# Create a new template for the account. Only
|
296
|
+
# Add template
|
297
|
+
# Create a new template for the account. Only Classic templates are supported.
|
298
298
|
# @param body
|
299
299
|
# @param [Hash] opts the optional parameters
|
300
300
|
# @return [Array<(TemplateInstance, Fixnum, Hash)>] TemplateInstance data, response status code and response headers
|
@@ -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.
|
6
|
+
OpenAPI spec version: 3.0.5
|
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
|
@@ -19,7 +19,7 @@ module MailchimpMarketing
|
|
19
19
|
def initialize(api_client)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
-
# Add
|
22
|
+
# Add domain to account
|
23
23
|
# Add a domain to the account.
|
24
24
|
# @param body
|
25
25
|
# @param [Hash] opts the optional parameters
|
@@ -29,7 +29,7 @@ module MailchimpMarketing
|
|
29
29
|
data
|
30
30
|
end
|
31
31
|
|
32
|
-
# Add
|
32
|
+
# Add domain to account
|
33
33
|
# Add a domain to the account.
|
34
34
|
# @param body
|
35
35
|
# @param [Hash] opts the optional parameters
|
@@ -63,7 +63,7 @@ module MailchimpMarketing
|
|
63
63
|
:return_type => 'VerifiedDomains')
|
64
64
|
return data, status_code, headers
|
65
65
|
end
|
66
|
-
# Delete
|
66
|
+
# Delete domain
|
67
67
|
# Delete a verified domain from the account.
|
68
68
|
# @param domain_name The domain to be verified.
|
69
69
|
# @param [Hash] opts the optional parameters
|
@@ -73,7 +73,7 @@ module MailchimpMarketing
|
|
73
73
|
nil
|
74
74
|
end
|
75
75
|
|
76
|
-
# Delete
|
76
|
+
# Delete domain
|
77
77
|
# Delete a verified domain from the account.
|
78
78
|
# @param domain_name The domain to be verified.
|
79
79
|
# @param [Hash] opts the optional parameters
|
@@ -106,7 +106,7 @@ module MailchimpMarketing
|
|
106
106
|
:auth_names => auth_names)
|
107
107
|
return data, status_code, headers
|
108
108
|
end
|
109
|
-
# Get
|
109
|
+
# Get domain info
|
110
110
|
# Get the details for a single domain on the account.
|
111
111
|
# @param domain_name The domain to be verified.
|
112
112
|
# @param [Hash] opts the optional parameters
|
@@ -116,7 +116,7 @@ module MailchimpMarketing
|
|
116
116
|
data
|
117
117
|
end
|
118
118
|
|
119
|
-
# Get
|
119
|
+
# Get domain info
|
120
120
|
# Get the details for a single domain on the account.
|
121
121
|
# @param domain_name The domain to be verified.
|
122
122
|
# @param [Hash] opts the optional parameters
|
@@ -150,7 +150,7 @@ module MailchimpMarketing
|
|
150
150
|
:return_type => 'VerifiedDomains')
|
151
151
|
return data, status_code, headers
|
152
152
|
end
|
153
|
-
#
|
153
|
+
# List sending domains
|
154
154
|
# Get all of the sending domains on the account.
|
155
155
|
# @param [Hash] opts the optional parameters
|
156
156
|
# @return [VerifiedDomains1]
|
@@ -159,7 +159,7 @@ module MailchimpMarketing
|
|
159
159
|
data
|
160
160
|
end
|
161
161
|
|
162
|
-
#
|
162
|
+
# List sending domains
|
163
163
|
# Get all of the sending domains on the account.
|
164
164
|
# @param [Hash] opts the optional parameters
|
165
165
|
# @return [Array<(VerifiedDomains1, Fixnum, Hash)>] VerifiedDomains1 data, response status code and response headers
|
@@ -192,7 +192,7 @@ module MailchimpMarketing
|
|
192
192
|
:return_type => 'VerifiedDomains1')
|
193
193
|
return data, status_code, headers
|
194
194
|
end
|
195
|
-
#
|
195
|
+
# Verify domain
|
196
196
|
# Verify a domain for sending.
|
197
197
|
# @param domain_name The domain to be verified.
|
198
198
|
# @param body
|
@@ -203,7 +203,7 @@ module MailchimpMarketing
|
|
203
203
|
data
|
204
204
|
end
|
205
205
|
|
206
|
-
#
|
206
|
+
# Verify domain
|
207
207
|
# Verify a domain for sending.
|
208
208
|
# @param domain_name The domain to be verified.
|
209
209
|
# @param body
|
@@ -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.
|
6
|
+
OpenAPI spec version: 3.0.5
|
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
|
@@ -21,7 +21,7 @@ module MailchimpMarketing
|
|
21
21
|
attr_accessor :default_headers
|
22
22
|
|
23
23
|
# Initializes the ApiClient
|
24
|
-
def initialize(
|
24
|
+
def initialize(config = {})
|
25
25
|
@host = "https://server.api.mailchimp.com/3.0"
|
26
26
|
@user_agent = "Swagger-Codegen/#{VERSION}/ruby"
|
27
27
|
@default_headers = {
|
@@ -29,8 +29,7 @@ module MailchimpMarketing
|
|
29
29
|
'User-Agent' => @user_agent
|
30
30
|
}
|
31
31
|
|
32
|
-
|
33
|
-
@server = server || get_server_from_api_key(api_key)
|
32
|
+
set_config(config)
|
34
33
|
end
|
35
34
|
|
36
35
|
def self.default
|
@@ -39,18 +38,34 @@ module MailchimpMarketing
|
|
39
38
|
|
40
39
|
def get_server_from_api_key(api_key = '')
|
41
40
|
begin
|
42
|
-
split = api_key.split('-
|
43
|
-
|
44
|
-
|
41
|
+
split = api_key.split('-')
|
42
|
+
server = 'invalid-server'
|
43
|
+
|
44
|
+
if split.length == 2
|
45
|
+
server = split[1]
|
46
|
+
end
|
47
|
+
|
45
48
|
server
|
46
49
|
rescue
|
47
50
|
""
|
48
51
|
end
|
49
52
|
end
|
50
53
|
|
51
|
-
def set_config(
|
52
|
-
|
53
|
-
@
|
54
|
+
def set_config(config = {})
|
55
|
+
# Basic Auth
|
56
|
+
@api_key = config[:api_key] || ''
|
57
|
+
@is_basic_auth = @api_key.to_s.strip.empty? == false
|
58
|
+
|
59
|
+
# OAuth
|
60
|
+
@access_token = config[:access_token] || ''
|
61
|
+
@is_oauth = @access_token.to_s.strip.empty? == false
|
62
|
+
|
63
|
+
# If using Basic auth and no server is provided,
|
64
|
+
# attempt to extract it from the api_key directy.
|
65
|
+
@server = config[:server] || 'invalid-server'
|
66
|
+
if @server == 'invalid-server' && @is_basic_auth
|
67
|
+
@server = get_server_from_api_key(@api_key)
|
68
|
+
end
|
54
69
|
end
|
55
70
|
|
56
71
|
def call_api(http_method, path, opts = {})
|
@@ -85,10 +100,18 @@ module MailchimpMarketing
|
|
85
100
|
host = @server.length > 0 ? @host.sub('server', @server) : @host
|
86
101
|
url = host + path
|
87
102
|
|
103
|
+
# Basic Authentication
|
88
104
|
conn = Faraday.new(url) do |conn|
|
89
105
|
conn.params = query_params
|
90
|
-
|
91
|
-
|
106
|
+
|
107
|
+
if @is_basic_auth
|
108
|
+
conn.headers = header_params
|
109
|
+
conn.basic_auth('user', @api_key)
|
110
|
+
end
|
111
|
+
|
112
|
+
if @is_oauth
|
113
|
+
conn.headers["Authorization"] = "Bearer #{@access_token}"
|
114
|
+
end
|
92
115
|
end
|
93
116
|
|
94
117
|
case http_method.to_sym.downcase
|