embulk-output-mailchimp 0.3.15 → 0.3.16
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f302894ddc97cb2d46fcd4017e1c5bfd49d7a47
|
4
|
+
data.tar.gz: 4ca3f4eaa7c1ce19a378e855b5604b49fae962d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3451461a7022d3e747aa58a72c6568d51cd9651cc6d177abbfe87540b50aee8d65b8b9950689c48f9570410265f32a27be057218581d485637db6833af1b6cc4
|
7
|
+
data.tar.gz: 40bb5c7e83bb6e33d3fe078b8684bf476edb77cc6c1d673754631806a98bc5fac6d5d2da23d27ca69506f61cc3f39df73ee3e46ae7d51d762c6aced8a79ebaf4
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
## 0.3.16 - 2017-08-28
|
2
|
+
- Fixed user friendly error message when input invalid api key [#31](https://github.com/treasure-data/embulk-output-mailchimp/pull/31)
|
3
|
+
|
1
4
|
## 0.3.15 - 2017-07-26
|
2
5
|
- Add checking exception to retry [#30](https://github.com/treasure-data/embulk-output-mailchimp/pull/30)
|
3
6
|
|
data/build.gradle
CHANGED
Binary file
|
@@ -11,6 +11,7 @@ import com.google.common.base.Joiner;
|
|
11
11
|
import com.google.common.collect.FluentIterable;
|
12
12
|
import com.google.common.collect.ImmutableList;
|
13
13
|
import com.google.common.collect.Maps;
|
14
|
+
import org.eclipse.jetty.client.HttpResponseException;
|
14
15
|
import org.eclipse.jetty.http.HttpMethod;
|
15
16
|
import org.embulk.config.ConfigException;
|
16
17
|
import org.embulk.output.mailchimp.helper.MailChimpHelper;
|
@@ -23,6 +24,7 @@ import org.embulk.output.mailchimp.model.MergeField;
|
|
23
24
|
import org.embulk.output.mailchimp.model.MergeFields;
|
24
25
|
import org.embulk.output.mailchimp.model.MetaDataResponse;
|
25
26
|
import org.embulk.output.mailchimp.model.ReportResponse;
|
27
|
+
import org.embulk.spi.DataException;
|
26
28
|
import org.embulk.spi.Exec;
|
27
29
|
import org.slf4j.Logger;
|
28
30
|
|
@@ -180,23 +182,33 @@ public class MailChimpClient
|
|
180
182
|
|
181
183
|
private void extractDataCenter(MailChimpOutputPluginDelegate.PluginTask task)
|
182
184
|
{
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
185
|
+
if (task.getAuthMethod() == OAUTH) {
|
186
|
+
// Extract data center from meta data URL
|
187
|
+
JsonNode response = client.sendRequest("https://login.mailchimp.com/oauth2/metadata", HttpMethod.GET, task);
|
188
|
+
MetaDataResponse metaDataResponse;
|
189
|
+
try {
|
190
|
+
metaDataResponse = mapper.treeToValue(response, MetaDataResponse.class);
|
188
191
|
mailchimpEndpoint = MessageFormat.format(mailchimpEndpoint, metaDataResponse.getDc());
|
189
192
|
}
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
193
|
+
catch (JsonProcessingException e) {
|
194
|
+
throw new DataException(e);
|
195
|
+
}
|
196
|
+
}
|
197
|
+
else if (task.getAuthMethod() == API_KEY && task.getApikey().isPresent()) {
|
198
|
+
// Authenticate and return data center
|
199
|
+
if (!task.getApikey().get().contains("-")) {
|
200
|
+
throw new ConfigException("API Key format invalid.");
|
201
|
+
}
|
202
|
+
|
203
|
+
String domain = task.getApikey().get().split("-")[1];
|
204
|
+
String endpoint = MessageFormat.format(mailchimpEndpoint + "/", domain);
|
205
|
+
try {
|
194
206
|
client.sendRequest(endpoint, HttpMethod.GET, task);
|
195
207
|
mailchimpEndpoint = MessageFormat.format(mailchimpEndpoint, domain);
|
196
208
|
}
|
197
|
-
|
198
|
-
|
199
|
-
|
209
|
+
catch (HttpResponseException re) {
|
210
|
+
throw new ConfigException("Your API key may be invalid, or you've attempted to access the wrong datacenter.");
|
211
|
+
}
|
200
212
|
}
|
201
213
|
}
|
202
214
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-output-mailchimp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thang Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -89,7 +89,7 @@ files:
|
|
89
89
|
- test/override_assert_raise.rb
|
90
90
|
- test/run-test.rb
|
91
91
|
- classpath/embulk-base-restclient-0.5.3.jar
|
92
|
-
- classpath/embulk-output-mailchimp-0.3.
|
92
|
+
- classpath/embulk-output-mailchimp-0.3.16.jar
|
93
93
|
- classpath/embulk-util-retryhelper-jetty92-0.5.3.jar
|
94
94
|
- classpath/jetty-client-9.2.14.v20151106.jar
|
95
95
|
- classpath/jetty-http-9.2.14.v20151106.jar
|