embulk-input-zendesk 0.3.0 → 0.3.1

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: b8a2dc7f31c8524872638398698c54696dd1ae72
4
- data.tar.gz: 408233498ae7989a63dae5afd92ea84dadddd359
3
+ metadata.gz: ad43cfba07a05a5677083290abad4876dfaa652a
4
+ data.tar.gz: 90dbefa73c45d26e7a499e8c5b1f6618af4512f5
5
5
  SHA512:
6
- metadata.gz: c8ec39ad37f463cc25e7ec6903cf885ae2cb54a199badc696575fb90a79f2bfb1b412e03896b0546a7d27f5bbedd355092a44c83aea0578cc7c88a2f0a00ab19
7
- data.tar.gz: e3123aeb68dc367b08dcaacb9aa62d07af2821afe098d189e7e7e58a6005f80e7373a9fd6fcf626e993f9316068c599d216c6a201f2e0e2d544454bc097d2623
6
+ metadata.gz: 1bcbdc100b762d7bfa73cddc605d34b64040dcb218e37f31e03b0342dbf4594cbfe5f970d861997dbb85a6b734911fa291db526bbc50a6a933f424ae4924a6ac
7
+ data.tar.gz: ceef0158dc916745848727ccc3dd58bd8f63d38647475b3f4a0fee75aa95a690b690ba030d99a08fecdd3d14a0a6fa5fa0e2cf2a34ef109d45aba597dd48cdf5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.3.1 - 2019-04-09
2
+ * [fixed] Fix checking 404 by status code when fetching related objects #52 [#52](https://github.com/treasure-data/embulk-input-zendesk/pull/52)
3
+
1
4
  ## 0.3.0 - 2019-04-08
2
5
  * [enhancement] Convert embulk-input-zendesk to Java #50 [#50](https://github.com/treasure-data/embulk-input-zendesk/pull/50)
3
6
 
data/build.gradle CHANGED
@@ -15,7 +15,7 @@ configurations {
15
15
  provided
16
16
  }
17
17
 
18
- version = "0.3.0"
18
+ version = "0.3.1"
19
19
 
20
20
  sourceCompatibility = 1.8
21
21
  targetCompatibility = 1.8
@@ -8,6 +8,7 @@ import com.google.common.annotations.VisibleForTesting;
8
8
  import com.google.common.base.Throwables;
9
9
  import com.google.common.collect.ImmutableList;
10
10
 
11
+ import org.apache.http.HttpStatus;
11
12
  import org.embulk.config.Config;
12
13
  import org.embulk.config.ConfigDefault;
13
14
  import org.embulk.config.ConfigDiff;
@@ -19,6 +20,7 @@ import org.embulk.config.TaskSource;
19
20
  import org.embulk.exec.GuessExecutor;
20
21
  import org.embulk.input.zendesk.models.AuthenticationMethod;
21
22
  import org.embulk.input.zendesk.models.Target;
23
+ import org.embulk.input.zendesk.models.ZendeskException;
22
24
  import org.embulk.input.zendesk.services.ZendeskSupportAPIService;
23
25
  import org.embulk.input.zendesk.utils.ZendeskConstants;
24
26
  import org.embulk.input.zendesk.utils.ZendeskDateUtils;
@@ -434,11 +436,12 @@ public class ZendeskInputPlugin implements InputPlugin
434
436
  }
435
437
  catch (final ConfigException e) {
436
438
  // Sometimes we get 404 when having invalid endpoint, so ignore when we get 404 InvalidEndpoint
437
- if (!e.getMessage().contains(ZendeskConstants.Misc.INVALID_END_POINT_RESPONSE)) {
439
+ if (!(e.getCause() instanceof ZendeskException && ((ZendeskException) e.getCause()).getStatusCode() == HttpStatus.SC_NOT_FOUND)) {
438
440
  throw e;
439
441
  }
440
442
  }
441
443
  });
444
+
442
445
  ZendeskUtils.addRecord(jsonNode, schema, pageBuilder);
443
446
  }
444
447
 
@@ -117,7 +117,8 @@ public class ZendeskRestClient
117
117
  }
118
118
  catch (RetryExecutor.RetryGiveupException | InterruptedException e) {
119
119
  if (e instanceof RetryExecutor.RetryGiveupException && e.getCause() != null && e.getCause() instanceof ZendeskException) {
120
- throw new ConfigException(e.getCause().getMessage());
120
+ throw new ConfigException("Status: '" + ((ZendeskException) (e.getCause())).getStatusCode() + "', error message: '" + e.getCause().getMessage() + "'",
121
+ e.getCause());
121
122
  }
122
123
  throw new ConfigException(e);
123
124
  }
@@ -177,7 +178,7 @@ public class ZendeskRestClient
177
178
  //That means "No records from start_time". We can recognize it same as 200.
178
179
  return false;
179
180
  }
180
- throw new ConfigException("Status: '" + status + "', error message '" + message + "'");
181
+ throw new ConfigException("Status: '" + status + "', error message: '" + message + "'");
181
182
  }
182
183
 
183
184
  if (status == ZendeskConstants.HttpStatus.TOO_MANY_REQUEST || status == HttpStatus.SC_INTERNAL_SERVER_ERROR
@@ -39,10 +39,8 @@ public class ZendeskConstants
39
39
  public static final String ISO_TIMESTAMP_FORMAT = "yyyy-MM-dd'T'HH:mm:ssXXX";
40
40
  public static final String ISO_INSTANT = "yyyy-MM-dd'T'HH:mm:ss'Z'";
41
41
  public static final String TOO_RECENT_START_TIME = "Too recent start_time.";
42
- public static final String INVALID_END_POINT_RESPONSE = "\"error\":\"InvalidEndpoint\"";
43
42
  public static final int RECORDS_SIZE_PER_PAGE = 100;
44
43
  public static final int MAXIMUM_RECORDS_INCREMENTAL = 1000;
45
- public static final int TOO_MANY_REQUEST = 429;
46
44
 
47
45
  // 1 MB
48
46
  public static final int GUESS_BUFFER_SIZE = 1024 * 1024;
@@ -90,7 +90,7 @@ public class TestZendeskRestClient
90
90
  @Test
91
91
  public void doGetRetryFail429WithoutRetryAfter()
92
92
  {
93
- String expectedMessage = "Number of allowed incremental export API requests per minute exceeded";
93
+ String expectedMessage = "Status: '429', error message: 'Number of allowed incremental export API requests per minute exceeded'";
94
94
  int expectedRetryTime = 3;
95
95
  testExceptionMessageForDoGet("doGet429", expectedMessage, expectedRetryTime);
96
96
  }
@@ -98,7 +98,7 @@ public class TestZendeskRestClient
98
98
  @Test
99
99
  public void doGetRetryFail429WithRetryAfter()
100
100
  {
101
- String expectedMessage = "Number of allowed incremental export API requests per minute exceeded";
101
+ String expectedMessage = "Status: '429', error message: 'Number of allowed incremental export API requests per minute exceeded'";
102
102
  int expectedRetryTime = 3;
103
103
 
104
104
  when(response.containsHeader("x-rate-limit")).thenReturn(true);
@@ -123,7 +123,7 @@ public class TestZendeskRestClient
123
123
  @Test
124
124
  public void doGetRetry422FailBecauseNotContainTooRecentStartTime()
125
125
  {
126
- String expectedMessage = "Status: '422', error message 'dummy text'";
126
+ String expectedMessage = "Status: '422', error message: 'dummy text'";
127
127
  int expectedRetryTime = 1;
128
128
  testExceptionMessageForDoGet("doGet422NotContainTooRecentStartTime", expectedMessage, expectedRetryTime);
129
129
  }
@@ -131,7 +131,7 @@ public class TestZendeskRestClient
131
131
  @Test
132
132
  public void doGetNotRetry422BecauseContainTooRecentStartTime()
133
133
  {
134
- String expectedMessage = "Status: '422', error message 'dummy text'";
134
+ String expectedMessage = "Status: '422', error message: 'dummy text'";
135
135
  int expectedRetryTime = 1;
136
136
  testExceptionMessageForDoGet("doGet422ContainTooRecentStartTime", expectedMessage, expectedRetryTime);
137
137
  }
@@ -158,7 +158,7 @@ public class TestZendeskRestClient
158
158
  public void doGetRetry404()
159
159
  {
160
160
  setup("doGet404");
161
- String expectedMessage = "dummy text";
161
+ String expectedMessage = "Status: '404', error message: 'dummy text'";
162
162
  int expectedRetryTime = 1;
163
163
  try {
164
164
  zendeskRestClient.doGet("any", task, false);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-zendesk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - hieu.duong
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-08 00:00:00.000000000 Z
11
+ date: 2019-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -96,7 +96,7 @@ files:
96
96
  - src/test/resources/data/util.json
97
97
  - src/test/resources/data/util_page.json
98
98
  - classpath/commons-logging-1.2.jar
99
- - classpath/embulk-input-zendesk-0.3.0.jar
99
+ - classpath/embulk-input-zendesk-0.3.1.jar
100
100
  - classpath/httpcore-4.4.10.jar
101
101
  - classpath/httpclient-4.5.6.jar
102
102
  - classpath/commons-codec-1.10.jar