embulk-parser-twitter_ads_stats 0.1.0

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 (44) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +21 -0
  3. data/.scalafmt.conf +7 -0
  4. data/LICENSE.txt +21 -0
  5. data/README.md +79 -0
  6. data/build.gradle +79 -0
  7. data/build.sbt +15 -0
  8. data/classpath/embulk-parser-twitter_ads_stats-0.1.0.jar +0 -0
  9. data/classpath/scala-library-2.12.3.jar +0 -0
  10. data/classpath/spray-json_2.12-1.3.3.jar +0 -0
  11. data/gradle/wrapper/gradle-wrapper.jar +0 -0
  12. data/gradle/wrapper/gradle-wrapper.properties +5 -0
  13. data/gradlew +172 -0
  14. data/gradlew.bat +84 -0
  15. data/lib/embulk/guess/twitter_ads_stats.rb +61 -0
  16. data/lib/embulk/parser/twitter_ads_stats.rb +3 -0
  17. data/project/Dependencies.scala +11 -0
  18. data/project/build.properties +1 -0
  19. data/project/plugins.sbt +2 -0
  20. data/src/main/scala/org/embulk/parser/twitter_ads_stats/Column.scala +50 -0
  21. data/src/main/scala/org/embulk/parser/twitter_ads_stats/LoanPattern.scala +19 -0
  22. data/src/main/scala/org/embulk/parser/twitter_ads_stats/MetricElementNames.scala +47 -0
  23. data/src/main/scala/org/embulk/parser/twitter_ads_stats/MetricsGroupJson.scala +19 -0
  24. data/src/main/scala/org/embulk/parser/twitter_ads_stats/ParseException.scala +27 -0
  25. data/src/main/scala/org/embulk/parser/twitter_ads_stats/PluginTask.scala +9 -0
  26. data/src/main/scala/org/embulk/parser/twitter_ads_stats/TwitterAdsStatsParserPlugin.scala +98 -0
  27. data/src/main/scala/org/embulk/parser/twitter_ads_stats/define/Data.scala +19 -0
  28. data/src/main/scala/org/embulk/parser/twitter_ads_stats/define/FieldNameUtil.scala +9 -0
  29. data/src/main/scala/org/embulk/parser/twitter_ads_stats/define/IDData.scala +36 -0
  30. data/src/main/scala/org/embulk/parser/twitter_ads_stats/define/Metrics.scala +23 -0
  31. data/src/main/scala/org/embulk/parser/twitter_ads_stats/define/Request.scala +42 -0
  32. data/src/main/scala/org/embulk/parser/twitter_ads_stats/define/Root.scala +21 -0
  33. data/src/main/scala/org/embulk/parser/twitter_ads_stats/define/RootJson.scala +107 -0
  34. data/src/main/scala/org/embulk/parser/twitter_ads_stats/package.scala +192 -0
  35. data/src/test/resources/test.json +759 -0
  36. data/src/test/scala/org/embulk/parser/twitter_ads_stats/ColumnSpec.scala +33 -0
  37. data/src/test/scala/org/embulk/parser/twitter_ads_stats/MetricElementNamesSpec.scala +14 -0
  38. data/src/test/scala/org/embulk/parser/twitter_ads_stats/MetricsGroupJsonSpec.scala +20 -0
  39. data/src/test/scala/org/embulk/parser/twitter_ads_stats/UnitSpec.scala +5 -0
  40. data/src/test/scala/org/embulk/parser/twitter_ads_stats/define/MetricsJsonSpec.scala +57 -0
  41. data/src/test/scala/org/embulk/parser/twitter_ads_stats/define/ParamsSpec.scala +26 -0
  42. data/src/test/scala/org/embulk/parser/twitter_ads_stats/define/RootJsonSpec.scala +20 -0
  43. data/src/test/scala/org/embulk/parser/twitter_ads_stats/define/RootSpec.scala +356 -0
  44. metadata +114 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4ca8f41888ef794943233b27500abfd44a6ea81c
4
+ data.tar.gz: bbeae8f3f901f49d9586df442ecebca04c74b6a6
5
+ SHA512:
6
+ metadata.gz: 464100f398dbac01996400ab9d42298584d438175f8e7ab506dbd4383014d0146bf8b306ea543b9b73d35669cf0229d4128a0bc387539e67eb2151dff71d2165
7
+ data.tar.gz: 6ad7e1b484dee64b7d63c283c9dc81677143dc03bb4039c18563de0019ce3388225ffe1c7d0d3e56189dc95b819baee6508ee42ce2f5ba7842963846b5ff31c6
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ *~
2
+ /pkg/
3
+ /tmp/
4
+ *.gemspec
5
+ .gradle/
6
+ /classpath/
7
+ build/
8
+ .idea
9
+ /.settings/
10
+ /.metadata/
11
+ .classpath
12
+ .project
13
+
14
+ target/
15
+
16
+ # idea
17
+ *.iml
18
+ .idea
19
+
20
+ # mac
21
+ .DS_Store
data/.scalafmt.conf ADDED
@@ -0,0 +1,7 @@
1
+ style = defaultWithAlign
2
+ danglingParentheses = true
3
+ indentOperator = spray
4
+ maxColumn = 120
5
+ rewrite.rules = [RedundantParens, SortImports, PreferCurlyFors]
6
+ binPack.literalArgumentLists = false
7
+ unindentTopLevelOperators = true
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+
2
+ MIT License
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # Twitter Ads Stats parser plugin for Embulk
2
+
3
+ This plugin parse [Twitter Ads Stats](https://developer.twitter.com/en/docs/ads/analytics/overview/metrics-and-segmentation) json file.
4
+
5
+ ##Parse Logic
6
+ 1. Flatten to metrics by date.
7
+ 2. Group Metrics into Metrics Group by json type.
8
+
9
+ ## Overview
10
+
11
+ * **Plugin type**: parser
12
+ * **Guess supported**: no
13
+
14
+ ## Configuration
15
+
16
+ - **stop_on_invalid_record**
17
+ Stop bulk load transaction if a file includes invalid record (such as invalid timestamp) (boolean, default: false)
18
+
19
+ ## Example
20
+
21
+ #### Input File
22
+ I suppose this kind of [input file](https://github.com/kimutyam/embulk-parser-twitter_ads_stats/tree/master/src/test/resources/test.json).
23
+
24
+
25
+ #### YML
26
+
27
+ ```yaml
28
+ in:
29
+ type: any file input plugin type
30
+ parser:
31
+ type: sample
32
+ stop_on_invalid_record: true
33
+ ```
34
+
35
+ #### Preview Result
36
+
37
+ ```
38
+ *************************** 1 ***************************
39
+ id (string) : xxxxx
40
+ date (string) : 2017-08-20
41
+ segment (string) :
42
+ placement (string) : ALL_ON_TWITTER
43
+ billing ( json) : {"billed_charge_local_micro":100000000000,"billed_engagements":100}
44
+ engagement ( json) : {"likes":1,"engagements":1,"app_clicks":100,"clicks":100,"card_engagements":100,"qualified_impressions":null,"retweets":1,"impressions":1,"follows":1,"replies":1,"url_clicks":1}
45
+ media ( json) : {"media_engagements":1,"media_views":1}
46
+ mobile_conversion ( json) : {"mobile_conversion_rates_order_quantity":null,"mobile_conversion_content_views_post_view":null,"mobile_conversion_tutorials_completed_assisted":null,"mobile_conversion_shares_post_engagement":null,"mobile_conversion_checkouts_initiated_order_quantity":null,"mobile_conversion_searches_order_quantity":null,"mobile_conversion_add_to_carts_assisted":null,"mobile_conversion_tutorials_completed_order_quantity":null,"mobile_conversion_searches_assisted":null,"mobile_conversion_key_page_views_assisted":null,"mobile_conversion_achievements_unlocked_sale_amount":null,"mobile_conversion_payment_info_additions_assisted":null,"mobile_conversion_spent_credits_post_engagement":null,"mobile_conversion_rates_post_engagement":null,"mobile_conversion_installs_order_quantity":null,"mobile_conversion_checkouts_initiated_post_view":null,"mobile_conversion_add_to_carts_post_engagement":null,"mobile_conversion_logins_assisted":1,"mobile_conversion_reservations_assisted":null,"mobile_conversion_add_to_carts_sale_amount":null,"mobile_conversion_shares_assisted":null,"mobile_conversion_content_views_sale_amount":null,"mobile_conversion_reservations_post_view":null,"mobile_conversion_reservations_post_engagement":null,"mobile_conversion_shares_order_quantity":null,"mobile_conversion_key_page_views_post_view":null,"mobile_conversion_content_views_assisted":null,"mobile_conversion_add_to_wishlists_assisted":null,"mobile_conversion_content_views_order_quantity":null,"mobile_conversion_spent_credits_order_quantity":null,"mobile_conversion_key_page_views_post_engagement":null,"mobile_conversion_levels_achieved_order_quantity":null,"mobile_conversion_updates_post_engagement":null,"mobile_conversion_tutorials_completed_post_view":null,"mobile_conversion_achievements_unlocked_order_quantity":null,"mobile_conversion_shares_post_view":null,"mobile_conversion_payment_info_additions_sale_amount":null,"mobile_conversion_add_to_wishlists_sale_amount":null,"mobile_conversion_achievements_unlocked_post_engagement":null,"mobile_conversion_updates_sale_amount":null,"mobile_conversion_payment_info_additions_order_quantity":null,"mobile_conversion_key_page_views_order_quantity_order_quantity":null,"mobile_conversion_rates_assisted":null,"mobile_conversion_logins_post_view":null,"mobile_conversion_levels_achieved_sale_amount":null,"mobile_conversion_updates_order_quantity":null,"mobile_conversion_re_engages_order_quantity":null,"mobile_conversion_invites_order_quantity":null,"mobile_conversion_logins_post_engagement":1,"mobile_conversion_key_page_views_sale_amount":null,"mobile_conversion_content_views_post_engagement":null,"mobile_conversion_re_engages_post_view":null,"mobile_conversion_add_to_wishlists_post_engagement":null,"mobile_conversion_add_to_carts_post_view":null,"mobile_conversion_tutorials_completed_sale_amount":null,"mobile_conversion_spent_credits_sale_amount":null,"mobile_conversion_payment_info_additions_post_view":null,"mobile_conversion_logins_sale_amount":null,"mobile_conversion_installs_assisted":1,"mobile_conversion_re_engages_post_engagement":1,"mobile_conversion_shares_sale_amount":null,"mobile_conversion_installs_post_engagement":1,"mobile_conversion_reservations_order_quantity":null,"mobile_conversion_add_to_wishlists_order_quantity":null,"mobile_conversion_add_to_wishlists_post_view":null,"mobile_conversion_searches_post_view":null,"mobile_conversion_invites_sale_amount":null,"mobile_conversion_achievements_unlocked_assisted":null,"mobile_conversion_achievements_unlocked_post_view":null,"mobile_conversion_invites_assisted":null,"mobile_conversion_levels_achieved_post_engagement":null,"mobile_conversion_add_to_carts_order_quantity":null,"mobile_conversion_levels_achieved_assisted":null,"mobile_conversion_spent_credits_assisted":null,"mobile_conversion_spent_credits_post_view":null,"mobile_conversion_installs_sale_amount":null,"mobile_conversion_updates_assisted":null,"mobile_conversion_installs_post_view":null,"mobile_conversion_searches_sale_amount":null,"mobile_conversion_checkouts_initiated_post_engagement":null,"mobile_conversion_rates_post_view":null,"mobile_conversion_levels_achieved_post_view":null,"mobile_conversion_reservations_sale_amount":null,"mobile_conversion_tutorials_completed_post_engagement":null,"mobile_conversion_logins_order_quantity":null,"mobile_conversion_re_engages_assisted":1,"mobile_conversion_re_engages_sale_amount":null,"mobile_conversion_checkouts_initiated_sale_amount":null,"mobile_conversion_checkouts_initiated_assisted":null,"mobile_conversion_rates_sale_amount":null,"mobile_conversion_updates_post_view":null,"mobile_conversion_invites_post_engagement":null,"mobile_conversion_payment_info_additions_post_engagement":null,"mobile_conversion_invites_post_view":null,"mobile_conversion_searches_post_engagement":null}
47
+ video ( json) : {"video_views_75":1,"video_total_views":1,"video_mrc_views":1,"video_3s100pct_views":1,"video_cta_clicks":null,"video_views_100":1,"video_views_50":1,"video_views_25":1,"video_content_starts":1}
48
+ web_conversion ( json) : {"conversion_site_visits_order_quantity_engagement":null,"conversion_downloads_post_view":null,"conversion_purchases_order_quantity":null,"conversion_purchases_metric":1,"conversion_sign_ups_metric":null,"conversion_site_visits_post_view":null,"conversion_custom_sale_amount":null,"conversion_custom_post_view":null,"conversion_downloads_order_quantity_engagement":null,"conversion_sign_ups_post_view":null,"conversion_custom_sale_amount_engagement":null,"conversion_sign_ups_sale_amount_view":null,"conversion_sign_ups_assisted":null,"conversion_custom_order_quantity_engagement":null,"conversion_custom_order_quantity":null,"conversion_purchases_assisted":1,"conversion_sign_ups_order_quantity_view":null,"conversion_sign_ups_sale_amount":null,"conversion_downloads_post_engagement":null,"conversion_site_visits_assisted":null,"conversion_downloads_sale_amount_engagement":null,"conversion_sign_ups_order_quantity_engagement":null,"conversion_purchases_post_engagement":1,"conversion_sign_ups_order_quantity":null,"conversion_custom_order_quantity_view":null,"conversion_purchases_sale_amount_view":null,"conversion_custom_post_engagement":null,"conversion_site_visits_order_quantity_view":null,"conversion_site_visits_sale_amount_view":null,"conversion_downloads_assisted":null,"conversion_downloads_metric":null,"conversion_purchases_post_view":null,"conversion_downloads_sale_amount":null,"conversion_downloads_sale_amount_view":null,"conversion_site_visits_sale_amount_engagement":null,"conversion_site_visits_sale_amount":null,"conversion_site_visits_metric":1,"conversion_purchases_sale_amount_engagement":null,"conversion_custom_assisted":null,"conversion_sign_ups_post_engagement":null,"conversion_purchases_order_quantity_view":null,"conversion_downloads_order_quantity":null,"conversion_custom_metric":null,"conversion_custom_sale_amount_view":null,"conversion_site_visits_post_engagement":1,"conversion_purchases_sale_amount":100000000,"conversion_downloads_order_quantity_view":null,"conversion_site_visits_order_quantity":null,"conversion_purchases_order_quantity_engagement":null,"conversion_sign_ups_sale_amount_engagement":null}
49
+ *************************** 2 ***************************
50
+ id (string) : xxxxx
51
+ date (string) : 2017-08-21
52
+ segment (string) :
53
+ placement (string) : ALL_ON_TWITTER
54
+ billing ( json) : {"billed_charge_local_micro":200000000000,"billed_engagements":200}
55
+ engagement ( json) : {"likes":2,"engagements":2,"app_clicks":200,"clicks":200,"card_engagements":200,"qualified_impressions":null,"retweets":2,"impressions":2,"follows":2,"replies":2,"url_clicks":2}
56
+ media ( json) : {"media_engagements":2,"media_views":2}
57
+ mobile_conversion ( json) : {"mobile_conversion_rates_order_quantity":null,"mobile_conversion_content_views_post_view":null,"mobile_conversion_tutorials_completed_assisted":null,"mobile_conversion_shares_post_engagement":null,"mobile_conversion_checkouts_initiated_order_quantity":null,"mobile_conversion_searches_order_quantity":null,"mobile_conversion_add_to_carts_assisted":null,"mobile_conversion_tutorials_completed_order_quantity":null,"mobile_conversion_searches_assisted":null,"mobile_conversion_key_page_views_assisted":null,"mobile_conversion_achievements_unlocked_sale_amount":null,"mobile_conversion_payment_info_additions_assisted":null,"mobile_conversion_spent_credits_post_engagement":null,"mobile_conversion_rates_post_engagement":null,"mobile_conversion_installs_order_quantity":null,"mobile_conversion_checkouts_initiated_post_view":null,"mobile_conversion_add_to_carts_post_engagement":null,"mobile_conversion_logins_assisted":2,"mobile_conversion_reservations_assisted":null,"mobile_conversion_add_to_carts_sale_amount":null,"mobile_conversion_shares_assisted":null,"mobile_conversion_content_views_sale_amount":null,"mobile_conversion_reservations_post_view":null,"mobile_conversion_reservations_post_engagement":null,"mobile_conversion_shares_order_quantity":null,"mobile_conversion_key_page_views_post_view":null,"mobile_conversion_content_views_assisted":null,"mobile_conversion_add_to_wishlists_assisted":null,"mobile_conversion_content_views_order_quantity":null,"mobile_conversion_spent_credits_order_quantity":null,"mobile_conversion_key_page_views_post_engagement":null,"mobile_conversion_levels_achieved_order_quantity":null,"mobile_conversion_updates_post_engagement":null,"mobile_conversion_tutorials_completed_post_view":null,"mobile_conversion_achievements_unlocked_order_quantity":null,"mobile_conversion_shares_post_view":null,"mobile_conversion_payment_info_additions_sale_amount":null,"mobile_conversion_add_to_wishlists_sale_amount":null,"mobile_conversion_achievements_unlocked_post_engagement":null,"mobile_conversion_updates_sale_amount":null,"mobile_conversion_payment_info_additions_order_quantity":null,"mobile_conversion_key_page_views_order_quantity_order_quantity":null,"mobile_conversion_rates_assisted":null,"mobile_conversion_logins_post_view":null,"mobile_conversion_levels_achieved_sale_amount":null,"mobile_conversion_updates_order_quantity":null,"mobile_conversion_re_engages_order_quantity":null,"mobile_conversion_invites_order_quantity":null,"mobile_conversion_logins_post_engagement":2,"mobile_conversion_key_page_views_sale_amount":null,"mobile_conversion_content_views_post_engagement":null,"mobile_conversion_re_engages_post_view":null,"mobile_conversion_add_to_wishlists_post_engagement":null,"mobile_conversion_add_to_carts_post_view":null,"mobile_conversion_tutorials_completed_sale_amount":null,"mobile_conversion_spent_credits_sale_amount":null,"mobile_conversion_payment_info_additions_post_view":null,"mobile_conversion_logins_sale_amount":null,"mobile_conversion_installs_assisted":2,"mobile_conversion_re_engages_post_engagement":2,"mobile_conversion_shares_sale_amount":null,"mobile_conversion_installs_post_engagement":2,"mobile_conversion_reservations_order_quantity":null,"mobile_conversion_add_to_wishlists_order_quantity":null,"mobile_conversion_add_to_wishlists_post_view":null,"mobile_conversion_searches_post_view":null,"mobile_conversion_invites_sale_amount":null,"mobile_conversion_achievements_unlocked_assisted":null,"mobile_conversion_achievements_unlocked_post_view":null,"mobile_conversion_invites_assisted":null,"mobile_conversion_levels_achieved_post_engagement":null,"mobile_conversion_add_to_carts_order_quantity":null,"mobile_conversion_levels_achieved_assisted":null,"mobile_conversion_spent_credits_assisted":null,"mobile_conversion_spent_credits_post_view":null,"mobile_conversion_installs_sale_amount":null,"mobile_conversion_updates_assisted":null,"mobile_conversion_installs_post_view":null,"mobile_conversion_searches_sale_amount":null,"mobile_conversion_checkouts_initiated_post_engagement":null,"mobile_conversion_rates_post_view":null,"mobile_conversion_levels_achieved_post_view":null,"mobile_conversion_reservations_sale_amount":null,"mobile_conversion_tutorials_completed_post_engagement":null,"mobile_conversion_logins_order_quantity":null,"mobile_conversion_re_engages_assisted":2,"mobile_conversion_re_engages_sale_amount":null,"mobile_conversion_checkouts_initiated_sale_amount":null,"mobile_conversion_checkouts_initiated_assisted":null,"mobile_conversion_rates_sale_amount":null,"mobile_conversion_updates_post_view":null,"mobile_conversion_invites_post_engagement":null,"mobile_conversion_payment_info_additions_post_engagement":null,"mobile_conversion_invites_post_view":null,"mobile_conversion_searches_post_engagement":null}
58
+ video ( json) : {"video_views_75":2,"video_total_views":2,"video_mrc_views":2,"video_3s100pct_views":2,"video_cta_clicks":null,"video_views_100":2,"video_views_50":2,"video_views_25":2,"video_content_starts":2}
59
+ web_conversion ( json) : {"conversion_site_visits_order_quantity_engagement":null,"conversion_downloads_post_view":null,"conversion_purchases_order_quantity":null,"conversion_purchases_metric":2,"conversion_sign_ups_metric":null,"conversion_site_visits_post_view":null,"conversion_custom_sale_amount":null,"conversion_custom_post_view":null,"conversion_downloads_order_quantity_engagement":null,"conversion_sign_ups_post_view":null,"conversion_custom_sale_amount_engagement":null,"conversion_sign_ups_sale_amount_view":null,"conversion_sign_ups_assisted":null,"conversion_custom_order_quantity_engagement":null,"conversion_custom_order_quantity":null,"conversion_purchases_assisted":2,"conversion_sign_ups_order_quantity_view":null,"conversion_sign_ups_sale_amount":null,"conversion_downloads_post_engagement":null,"conversion_site_visits_assisted":null,"conversion_downloads_sale_amount_engagement":null,"conversion_sign_ups_order_quantity_engagement":null,"conversion_purchases_post_engagement":2,"conversion_sign_ups_order_quantity":null,"conversion_custom_order_quantity_view":null,"conversion_purchases_sale_amount_view":null,"conversion_custom_post_engagement":null,"conversion_site_visits_order_quantity_view":null,"conversion_site_visits_sale_amount_view":null,"conversion_downloads_assisted":null,"conversion_downloads_metric":null,"conversion_purchases_post_view":null,"conversion_downloads_sale_amount":null,"conversion_downloads_sale_amount_view":null,"conversion_site_visits_sale_amount_engagement":null,"conversion_site_visits_sale_amount":null,"conversion_site_visits_metric":2,"conversion_purchases_sale_amount_engagement":null,"conversion_custom_assisted":null,"conversion_sign_ups_post_engagement":null,"conversion_purchases_order_quantity_view":null,"conversion_downloads_order_quantity":null,"conversion_custom_metric":null,"conversion_custom_sale_amount_view":null,"conversion_site_visits_post_engagement":2,"conversion_purchases_sale_amount":200000000,"conversion_downloads_order_quantity_view":null,"conversion_site_visits_order_quantity":null,"conversion_purchases_order_quantity_engagement":null,"conversion_sign_ups_sale_amount_engagement":null}
60
+ *************************** 3 ***************************
61
+ ....
62
+ ```
63
+
64
+ ## Build
65
+
66
+ ```
67
+ $ ./gradlew gem # -t to watch change of files and rebuild continuously
68
+ ```
69
+
70
+ ## Test
71
+
72
+ ```
73
+ sbt test
74
+ ```
75
+
76
+ ## Acknowledgement
77
+
78
+ I developed this library with reference to [embulk-parser-firebase_avro](https://github.com/smdmts/embulk-parser-firebase_avro)
79
+ Thank you very much.
data/build.gradle ADDED
@@ -0,0 +1,79 @@
1
+ plugins {
2
+ id "com.jfrog.bintray" version "1.1"
3
+ id "com.github.jruby-gradle.base" version "0.1.5"
4
+ id "java"
5
+ id "scala"
6
+ }
7
+ import com.github.jrubygradle.JRubyExec
8
+ repositories {
9
+ mavenCentral()
10
+ jcenter()
11
+ }
12
+ configurations {
13
+ provided
14
+ }
15
+
16
+ version = "0.1.0"
17
+
18
+ sourceCompatibility = 1.7
19
+ targetCompatibility = 1.7
20
+
21
+ dependencies {
22
+ compile "org.embulk:embulk-core:0.8.35"
23
+ provided "org.embulk:embulk-core:0.8.35"
24
+
25
+ compile group: 'org.scala-lang', name: 'scala-library', version: '2.12.3'
26
+ compile group: 'io.spray', name: 'spray-json_2.12', version: '1.3.3'
27
+ }
28
+
29
+ task classpath(type: Copy, dependsOn: ["jar"]) {
30
+ doFirst { file("classpath").deleteDir() }
31
+ from (configurations.runtime - configurations.provided + files(jar.archivePath))
32
+ into "classpath"
33
+ }
34
+ clean { delete "classpath" }
35
+
36
+ task gem(type: JRubyExec, dependsOn: ["gemspec", "classpath"]) {
37
+ jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "build"
38
+ script "${project.name}.gemspec"
39
+ doLast { ant.move(file: "${project.name}-${project.version}.gem", todir: "pkg") }
40
+ }
41
+
42
+ task gemPush(type: JRubyExec, dependsOn: ["gem"]) {
43
+ jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "push"
44
+ script "pkg/${project.name}-${project.version}.gem"
45
+ }
46
+
47
+ task "package"(dependsOn: ["gemspec", "classpath"]) {
48
+ doLast {
49
+ println "> Build succeeded."
50
+ println "> You can run embulk with '-L ${file(".").absolutePath}' argument."
51
+ }
52
+ }
53
+
54
+ task gemspec {
55
+ ext.gemspecFile = file("${project.name}.gemspec")
56
+ inputs.file "build.gradle"
57
+ outputs.file gemspecFile
58
+ doLast { gemspecFile.write($/
59
+ Gem::Specification.new do |spec|
60
+ spec.name = "${project.name}"
61
+ spec.version = "${project.version}"
62
+ spec.authors = ["kimutyam"]
63
+ spec.summary = %[Twitter Ads Stats parser plugin for Embulk]
64
+ spec.description = %[Parses Twitter Ads Stats files read by other file input plugins.]
65
+ spec.email = ["devkimura@gmail.com"]
66
+ spec.licenses = ["MIT"]
67
+ spec.homepage = "https://github.com/kimutyam/embulk-parser-twitter_ads_stats"
68
+ spec.files = `git ls-files`.split("\n") + Dir["classpath/*.jar"]
69
+ spec.test_files = spec.files.grep(%r"^(test|spec)/")
70
+ spec.require_paths = ["lib"]
71
+
72
+ #spec.add_dependency 'YOUR_GEM_DEPENDENCY', ['~> YOUR_GEM_DEPENDENCY_VERSION']
73
+ spec.add_development_dependency 'bundler', ['~> 1.0']
74
+ spec.add_development_dependency 'rake', ['>= 10.0']
75
+ end
76
+ /$)
77
+ }
78
+ }
79
+ clean { delete "${project.name}.gemspec" }
data/build.sbt ADDED
@@ -0,0 +1,15 @@
1
+ lazy val core = (project in file(".")).
2
+ settings(
3
+ inThisBuild(List(
4
+ organization := "jp.co.septeni-original",
5
+ scalaVersion := "2.12.3",
6
+ version := "0.1.0-SNAPSHOT"
7
+ )),
8
+ name := "embulk-parser-twitter_ads_stats"
9
+ )
10
+
11
+ enablePlugins(ScalafmtPlugin)
12
+
13
+ resolvers += Resolver.jcenterRepo
14
+ libraryDependencies ++= Dependencies.value
15
+ scalacOptions += "-Xexperimental"
Binary file
Binary file
Binary file
@@ -0,0 +1,5 @@
1
+ distributionBase=GRADLE_USER_HOME
2
+ distributionPath=wrapper/dists
3
+ zipStoreBase=GRADLE_USER_HOME
4
+ zipStorePath=wrapper/dists
5
+ distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-bin.zip
data/gradlew ADDED
@@ -0,0 +1,172 @@
1
+ #!/usr/bin/env sh
2
+
3
+ ##############################################################################
4
+ ##
5
+ ## Gradle start up script for UN*X
6
+ ##
7
+ ##############################################################################
8
+
9
+ # Attempt to set APP_HOME
10
+ # Resolve links: $0 may be a link
11
+ PRG="$0"
12
+ # Need this for relative symlinks.
13
+ while [ -h "$PRG" ] ; do
14
+ ls=`ls -ld "$PRG"`
15
+ link=`expr "$ls" : '.*-> \(.*\)$'`
16
+ if expr "$link" : '/.*' > /dev/null; then
17
+ PRG="$link"
18
+ else
19
+ PRG=`dirname "$PRG"`"/$link"
20
+ fi
21
+ done
22
+ SAVED="`pwd`"
23
+ cd "`dirname \"$PRG\"`/" >/dev/null
24
+ APP_HOME="`pwd -P`"
25
+ cd "$SAVED" >/dev/null
26
+
27
+ APP_NAME="Gradle"
28
+ APP_BASE_NAME=`basename "$0"`
29
+
30
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31
+ DEFAULT_JVM_OPTS=""
32
+
33
+ # Use the maximum available, or set MAX_FD != -1 to use that value.
34
+ MAX_FD="maximum"
35
+
36
+ warn () {
37
+ echo "$*"
38
+ }
39
+
40
+ die () {
41
+ echo
42
+ echo "$*"
43
+ echo
44
+ exit 1
45
+ }
46
+
47
+ # OS specific support (must be 'true' or 'false').
48
+ cygwin=false
49
+ msys=false
50
+ darwin=false
51
+ nonstop=false
52
+ case "`uname`" in
53
+ CYGWIN* )
54
+ cygwin=true
55
+ ;;
56
+ Darwin* )
57
+ darwin=true
58
+ ;;
59
+ MINGW* )
60
+ msys=true
61
+ ;;
62
+ NONSTOP* )
63
+ nonstop=true
64
+ ;;
65
+ esac
66
+
67
+ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68
+
69
+ # Determine the Java command to use to start the JVM.
70
+ if [ -n "$JAVA_HOME" ] ; then
71
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72
+ # IBM's JDK on AIX uses strange locations for the executables
73
+ JAVACMD="$JAVA_HOME/jre/sh/java"
74
+ else
75
+ JAVACMD="$JAVA_HOME/bin/java"
76
+ fi
77
+ if [ ! -x "$JAVACMD" ] ; then
78
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79
+
80
+ Please set the JAVA_HOME variable in your environment to match the
81
+ location of your Java installation."
82
+ fi
83
+ else
84
+ JAVACMD="java"
85
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86
+
87
+ Please set the JAVA_HOME variable in your environment to match the
88
+ location of your Java installation."
89
+ fi
90
+
91
+ # Increase the maximum file descriptors if we can.
92
+ if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93
+ MAX_FD_LIMIT=`ulimit -H -n`
94
+ if [ $? -eq 0 ] ; then
95
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96
+ MAX_FD="$MAX_FD_LIMIT"
97
+ fi
98
+ ulimit -n $MAX_FD
99
+ if [ $? -ne 0 ] ; then
100
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
101
+ fi
102
+ else
103
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104
+ fi
105
+ fi
106
+
107
+ # For Darwin, add options to specify how the application appears in the dock
108
+ if $darwin; then
109
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110
+ fi
111
+
112
+ # For Cygwin, switch paths to Windows format before running java
113
+ if $cygwin ; then
114
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116
+ JAVACMD=`cygpath --unix "$JAVACMD"`
117
+
118
+ # We build the pattern for arguments to be converted via cygpath
119
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120
+ SEP=""
121
+ for dir in $ROOTDIRSRAW ; do
122
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
123
+ SEP="|"
124
+ done
125
+ OURCYGPATTERN="(^($ROOTDIRS))"
126
+ # Add a user-defined pattern to the cygpath arguments
127
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129
+ fi
130
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
131
+ i=0
132
+ for arg in "$@" ; do
133
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135
+
136
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138
+ else
139
+ eval `echo args$i`="\"$arg\""
140
+ fi
141
+ i=$((i+1))
142
+ done
143
+ case $i in
144
+ (0) set -- ;;
145
+ (1) set -- "$args0" ;;
146
+ (2) set -- "$args0" "$args1" ;;
147
+ (3) set -- "$args0" "$args1" "$args2" ;;
148
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154
+ esac
155
+ fi
156
+
157
+ # Escape application args
158
+ save () {
159
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160
+ echo " "
161
+ }
162
+ APP_ARGS=$(save "$@")
163
+
164
+ # Collect all arguments for the java command, following the shell quoting and substitution rules
165
+ eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166
+
167
+ # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168
+ if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169
+ cd "$(dirname "$0")"
170
+ fi
171
+
172
+ exec "$JAVACMD" "$@"
data/gradlew.bat ADDED
@@ -0,0 +1,84 @@
1
+ @if "%DEBUG%" == "" @echo off
2
+ @rem ##########################################################################
3
+ @rem
4
+ @rem Gradle startup script for Windows
5
+ @rem
6
+ @rem ##########################################################################
7
+
8
+ @rem Set local scope for the variables with windows NT shell
9
+ if "%OS%"=="Windows_NT" setlocal
10
+
11
+ set DIRNAME=%~dp0
12
+ if "%DIRNAME%" == "" set DIRNAME=.
13
+ set APP_BASE_NAME=%~n0
14
+ set APP_HOME=%DIRNAME%
15
+
16
+ @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17
+ set DEFAULT_JVM_OPTS=
18
+
19
+ @rem Find java.exe
20
+ if defined JAVA_HOME goto findJavaFromJavaHome
21
+
22
+ set JAVA_EXE=java.exe
23
+ %JAVA_EXE% -version >NUL 2>&1
24
+ if "%ERRORLEVEL%" == "0" goto init
25
+
26
+ echo.
27
+ echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28
+ echo.
29
+ echo Please set the JAVA_HOME variable in your environment to match the
30
+ echo location of your Java installation.
31
+
32
+ goto fail
33
+
34
+ :findJavaFromJavaHome
35
+ set JAVA_HOME=%JAVA_HOME:"=%
36
+ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37
+
38
+ if exist "%JAVA_EXE%" goto init
39
+
40
+ echo.
41
+ echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42
+ echo.
43
+ echo Please set the JAVA_HOME variable in your environment to match the
44
+ echo location of your Java installation.
45
+
46
+ goto fail
47
+
48
+ :init
49
+ @rem Get command-line arguments, handling Windows variants
50
+
51
+ if not "%OS%" == "Windows_NT" goto win9xME_args
52
+
53
+ :win9xME_args
54
+ @rem Slurp the command line arguments.
55
+ set CMD_LINE_ARGS=
56
+ set _SKIP=2
57
+
58
+ :win9xME_args_slurp
59
+ if "x%~1" == "x" goto execute
60
+
61
+ set CMD_LINE_ARGS=%*
62
+
63
+ :execute
64
+ @rem Setup the command line
65
+
66
+ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67
+
68
+ @rem Execute Gradle
69
+ "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70
+
71
+ :end
72
+ @rem End local scope for the variables with windows NT shell
73
+ if "%ERRORLEVEL%"=="0" goto mainEnd
74
+
75
+ :fail
76
+ rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77
+ rem the _cmd.exe /c_ return code!
78
+ if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79
+ exit /b 1
80
+
81
+ :mainEnd
82
+ if "%OS%"=="Windows_NT" endlocal
83
+
84
+ :omega