embulk-input-facebook_ads_insights 0.1.2 → 0.1.3
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d46e96da39a17161b5c84ce1e0f47b984d170311
|
4
|
+
data.tar.gz: 5e3558265b4c7201478eb70ab96bcc5ecfc8f467
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe9dca2e749a6f6f94adb57aaf1d788663e10a4c3a31ee9323452c6d2628f846cc212b3f8de96ee0916e7f8c463e8ea91f13f6e2e1d6433df9d21056ae46cee7
|
7
|
+
data.tar.gz: 83f87b360a4949455f323e9d949790c0a45077bb37ac70977db477343b9b78fec9ac528d97df328091f0341e23bdd31bccf48c2a595e7840b7e8a4bb2f06dc4c
|
data/build.gradle
CHANGED
@@ -16,6 +16,7 @@ import org.embulk.spi.ColumnConfig;
|
|
16
16
|
import org.slf4j.Logger;
|
17
17
|
import org.slf4j.LoggerFactory;
|
18
18
|
|
19
|
+
import java.util.ArrayList;
|
19
20
|
import java.util.List;
|
20
21
|
import java.util.stream.Collectors;
|
21
22
|
|
@@ -31,7 +32,7 @@ public class Client
|
|
31
32
|
this.pluginTask = pluginTask;
|
32
33
|
}
|
33
34
|
|
34
|
-
public
|
35
|
+
public List<AdsInsights> getInsights(boolean isPaginationValid) throws APIException, InterruptedException
|
35
36
|
{
|
36
37
|
AdReportRun adReportRun;
|
37
38
|
switch (pluginTask.getObjectType()) {
|
@@ -56,7 +57,8 @@ public class Client
|
|
56
57
|
while (adReportRun.fetch().getFieldAsyncPercentCompletion() != 100) {
|
57
58
|
Thread.sleep(ASYNC_SLEEP_TIME);
|
58
59
|
}
|
59
|
-
|
60
|
+
APINodeList<AdsInsights> adsInsights = adReportRun.getInsights().execute();
|
61
|
+
return isPaginationValid ? fetchAllPage(adsInsights) : adsInsights;
|
60
62
|
}
|
61
63
|
|
62
64
|
// TODO: plz make me dry
|
@@ -244,6 +246,17 @@ public class Client
|
|
244
246
|
return request.execute();
|
245
247
|
}
|
246
248
|
|
249
|
+
private List<AdsInsights> fetchAllPage(APINodeList<AdsInsights> adsInsights) throws APIException
|
250
|
+
{
|
251
|
+
List<AdsInsights> result = new ArrayList<>();
|
252
|
+
APINodeList<AdsInsights> next = adsInsights;
|
253
|
+
while (!next.isEmpty()) {
|
254
|
+
result.addAll(next);
|
255
|
+
next = next.nextPage();
|
256
|
+
}
|
257
|
+
return result;
|
258
|
+
}
|
259
|
+
|
247
260
|
private APIContext apiContext()
|
248
261
|
{
|
249
262
|
return new APIContext(pluginTask.getAccessToken());
|
data/src/main/java/org/embulk/input/facebook_ads_insights/FacebookAdsInsightsInputPlugin.java
CHANGED
@@ -56,7 +56,7 @@ public class FacebookAdsInsightsInputPlugin
|
|
56
56
|
try {
|
57
57
|
try (PageBuilder pageBuilder = new PageBuilder(Exec.getBufferAllocator(), schema, output)) {
|
58
58
|
Client client = new Client(task);
|
59
|
-
List<AdsInsights> insights = client.getInsights();
|
59
|
+
List<AdsInsights> insights = client.getInsights(!Exec.isPreview());
|
60
60
|
for (AdsInsights insight : insights) {
|
61
61
|
schema.visitColumns(new FacebookAdsInsightsColumnVisitor(insight, pageBuilder, task));
|
62
62
|
pageBuilder.addRecord();
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-input-facebook_ads_insights
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- naotaka nakane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,7 +50,7 @@ files:
|
|
50
50
|
- README.md
|
51
51
|
- build.gradle
|
52
52
|
- classpath/annotations-13.0.jar
|
53
|
-
- classpath/embulk-input-facebook_ads_insights-0.1.
|
53
|
+
- classpath/embulk-input-facebook_ads_insights-0.1.3.jar
|
54
54
|
- classpath/facebook-java-business-sdk-4.0.5.jar
|
55
55
|
- classpath/gson-2.5.jar
|
56
56
|
- classpath/guava-20.0.jar
|