embulk-input-zendesk-all 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.travis.yml +5 -0
  4. data/CHANGELOG.md +126 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +91 -0
  7. data/build.gradle +123 -0
  8. data/config/checkstyle/checkstyle.xml +128 -0
  9. data/config/checkstyle/default.xml +108 -0
  10. data/gradle/wrapper/gradle-wrapper.jar +0 -0
  11. data/gradle/wrapper/gradle-wrapper.properties +5 -0
  12. data/gradlew +172 -0
  13. data/gradlew.bat +84 -0
  14. data/lib/embulk/guess/zendesk.rb +21 -0
  15. data/lib/embulk/input/zendesk.rb +3 -0
  16. data/src/main/java/org/embulk/input/zendesk/RecordImporter.java +134 -0
  17. data/src/main/java/org/embulk/input/zendesk/ZendeskInputPlugin.java +513 -0
  18. data/src/main/java/org/embulk/input/zendesk/clients/ZendeskRestClient.java +291 -0
  19. data/src/main/java/org/embulk/input/zendesk/models/AuthenticationMethod.java +23 -0
  20. data/src/main/java/org/embulk/input/zendesk/models/Target.java +47 -0
  21. data/src/main/java/org/embulk/input/zendesk/models/ZendeskException.java +25 -0
  22. data/src/main/java/org/embulk/input/zendesk/services/ZendeskCustomObjectService.java +110 -0
  23. data/src/main/java/org/embulk/input/zendesk/services/ZendeskNPSService.java +30 -0
  24. data/src/main/java/org/embulk/input/zendesk/services/ZendeskNormalServices.java +347 -0
  25. data/src/main/java/org/embulk/input/zendesk/services/ZendeskService.java +14 -0
  26. data/src/main/java/org/embulk/input/zendesk/services/ZendeskSupportAPIService.java +63 -0
  27. data/src/main/java/org/embulk/input/zendesk/services/ZendeskUserEventService.java +158 -0
  28. data/src/main/java/org/embulk/input/zendesk/stream/PagingSpliterator.java +40 -0
  29. data/src/main/java/org/embulk/input/zendesk/stream/paginator/sunshine/CustomObjectSpliterator.java +42 -0
  30. data/src/main/java/org/embulk/input/zendesk/stream/paginator/sunshine/SunshineSpliterator.java +66 -0
  31. data/src/main/java/org/embulk/input/zendesk/stream/paginator/sunshine/UserEventSpliterator.java +35 -0
  32. data/src/main/java/org/embulk/input/zendesk/stream/paginator/support/OrganizationSpliterator.java +13 -0
  33. data/src/main/java/org/embulk/input/zendesk/stream/paginator/support/SupportSpliterator.java +44 -0
  34. data/src/main/java/org/embulk/input/zendesk/stream/paginator/support/UserSpliterator.java +13 -0
  35. data/src/main/java/org/embulk/input/zendesk/utils/ZendeskConstants.java +72 -0
  36. data/src/main/java/org/embulk/input/zendesk/utils/ZendeskDateUtils.java +68 -0
  37. data/src/main/java/org/embulk/input/zendesk/utils/ZendeskUtils.java +92 -0
  38. data/src/test/java/org/embulk/input/zendesk/TestRecordImporter.java +114 -0
  39. data/src/test/java/org/embulk/input/zendesk/TestZendeskInputPlugin.java +402 -0
  40. data/src/test/java/org/embulk/input/zendesk/clients/TestZendeskRestClient.java +337 -0
  41. data/src/test/java/org/embulk/input/zendesk/services/TestZendeskCustomObjectService.java +161 -0
  42. data/src/test/java/org/embulk/input/zendesk/services/TestZendeskNPSService.java +56 -0
  43. data/src/test/java/org/embulk/input/zendesk/services/TestZendeskNormalService.java +261 -0
  44. data/src/test/java/org/embulk/input/zendesk/services/TestZendeskSupportAPIService.java +130 -0
  45. data/src/test/java/org/embulk/input/zendesk/services/TestZendeskUserEventService.java +158 -0
  46. data/src/test/java/org/embulk/input/zendesk/utils/TestZendeskDateUtils.java +87 -0
  47. data/src/test/java/org/embulk/input/zendesk/utils/TestZendeskUtil.java +22 -0
  48. data/src/test/java/org/embulk/input/zendesk/utils/ZendeskPluginTestRuntime.java +133 -0
  49. data/src/test/java/org/embulk/input/zendesk/utils/ZendeskTestHelper.java +92 -0
  50. data/src/test/resources/config/base.yml +14 -0
  51. data/src/test/resources/config/base_validator.yml +48 -0
  52. data/src/test/resources/config/incremental.yml +54 -0
  53. data/src/test/resources/config/non-incremental.yml +39 -0
  54. data/src/test/resources/config/nps.yml +31 -0
  55. data/src/test/resources/config/object_records.yml +24 -0
  56. data/src/test/resources/config/relationship_records.yml +23 -0
  57. data/src/test/resources/config/user_events.yml +29 -0
  58. data/src/test/resources/config/util.yml +18 -0
  59. data/src/test/resources/data/client.json +293 -0
  60. data/src/test/resources/data/duplicate_user.json +0 -0
  61. data/src/test/resources/data/empty_result.json +7 -0
  62. data/src/test/resources/data/error_data.json +187 -0
  63. data/src/test/resources/data/expected/ticket_column.json +148 -0
  64. data/src/test/resources/data/expected/ticket_column_with_related_objects.json +152 -0
  65. data/src/test/resources/data/expected/ticket_fields_column.json +92 -0
  66. data/src/test/resources/data/expected/ticket_metrics_column.json +98 -0
  67. data/src/test/resources/data/expected/user_events_column.json +40 -0
  68. data/src/test/resources/data/object_records.json +30 -0
  69. data/src/test/resources/data/organization.json +39 -0
  70. data/src/test/resources/data/relationship_records.json +57 -0
  71. data/src/test/resources/data/scores.json +21 -0
  72. data/src/test/resources/data/scores_share_same_time_with_next_page.json +35 -0
  73. data/src/test/resources/data/scores_share_same_time_without_next_page.json +35 -0
  74. data/src/test/resources/data/simple_organization.json +23 -0
  75. data/src/test/resources/data/simple_user.json +50 -0
  76. data/src/test/resources/data/simple_user_event.json +19 -0
  77. data/src/test/resources/data/ticket_events_share_same_time_with_next_page.json +279 -0
  78. data/src/test/resources/data/ticket_events_share_same_time_without_next_page.json +279 -0
  79. data/src/test/resources/data/ticket_events_updated_by_system_records.json +279 -0
  80. data/src/test/resources/data/ticket_fields.json +225 -0
  81. data/src/test/resources/data/ticket_metrics.json +397 -0
  82. data/src/test/resources/data/ticket_share_same_time_with_next_page.json +232 -0
  83. data/src/test/resources/data/ticket_share_same_time_without_next_page.json +232 -0
  84. data/src/test/resources/data/ticket_with_related_objects.json +67 -0
  85. data/src/test/resources/data/ticket_with_updated_by_system_records.json +187 -0
  86. data/src/test/resources/data/tickets.json +232 -0
  87. data/src/test/resources/data/tickets_continue.json +52 -0
  88. data/src/test/resources/data/user_event.json +19 -0
  89. data/src/test/resources/data/user_event_contain_latter_create_at.json +19 -0
  90. data/src/test/resources/data/user_event_multiple.json +33 -0
  91. data/src/test/resources/data/util.json +19 -0
  92. data/src/test/resources/data/util_page.json +227 -0
  93. metadata +168 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7d15b4d98fd5c695a53d65d3aaecbd59a5b0ad2f
4
+ data.tar.gz: 6808cac88c9d62c3fe62c6b8deb9c95d0333b387
5
+ SHA512:
6
+ metadata.gz: 51147479e8c1a0c401c7d4bf91e1e3ac87a360806a826274c52da025c9a15b209fe153860e0193fe4898d0c001bb980a2822a8161ff0e196ac7ceab5c024f36a
7
+ data.tar.gz: 1c0898a3b1f6ee5a0f1b5cd88505388f65f2ba60ad55468f11fd20f1927c5e9693915b7de5916b6de90a4a7445ca30d7bb634becd28f578ed535a6512ddf5726
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ *~
2
+ /pkg/
3
+ /tmp/
4
+ *.gemspec
5
+ .gradle/
6
+ /classpath/
7
+ build/
8
+ .idea
9
+ /.settings/
10
+ /.metadata/
11
+ .classpath
12
+ .project
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: java
2
+ jdk:
3
+ - openjdk8
4
+ script:
5
+ - ./gradlew checkstyle test jacocoTestReport
data/CHANGELOG.md ADDED
@@ -0,0 +1,126 @@
1
+ ## 0.3.6 - 2019-07-02
2
+ * [enhancement] Improve error message #61 [#61](https://github.com/treasure-data/embulk-input-zendesk/pull/61)
3
+ * [enhancement] Support `end_time` field for incremental #60 [#60](https://github.com/treasure-data/embulk-input-zendesk/pull/60)
4
+
5
+ ## 0.3.5 - 2019-06-03
6
+ * [enhancement] Add new targets #58 [#58](https://github.com/treasure-data/embulk-input-zendesk/pull/58)
7
+
8
+ ## 0.3.4 - 2019-04-11
9
+ * [enhancement] Add new time format #56 [#56](https://github.com/treasure-data/embulk-input-zendesk/pull/56)
10
+
11
+ ## 0.3.3 - 2019-04-11
12
+ * [fixed] Fix trailing slash #55 [#55](https://github.com/treasure-data/embulk-input-zendesk/pull/55)
13
+
14
+ ## 0.3.2 - 2019-04-10
15
+ * [fixed] Fix generate config diff based on incremental config #54 [#54](https://github.com/treasure-data/embulk-input-zendesk/pull/54)
16
+
17
+ ## 0.3.1 - 2019-04-09
18
+ * [fixed] Fix checking 404 by status code when fetching related objects #52 [#52](https://github.com/treasure-data/embulk-input-zendesk/pull/52)
19
+
20
+ ## 0.3.0 - 2019-04-08
21
+ * [enhancement] Convert embulk-input-zendesk to Java #50 [#50](https://github.com/treasure-data/embulk-input-zendesk/pull/50)
22
+
23
+ ## 0.2.14 - 2019-01-25
24
+ * [fixed] Disable pagination and add `dedup` option for non-incremental targets [#49](https://github.com/treasure-data/embulk-input-zendesk/pull/49)
25
+
26
+ ## 0.2.13 - 2019-01-14
27
+ * [enhancement] Add `dedup` option, in order to avoid OOM when importing large dataset [#48](https://github.com/treasure-data/embulk-input-zendesk/pull/48)
28
+
29
+ ## 0.2.12 - 2019-01-04
30
+ * [enhancement] Fix performance issue [#47](https://github.com/treasure-data/embulk-input-zendesk/pull/47)
31
+
32
+ ## 0.2.11 - 2018-15-26
33
+ * [enhancement] Rate limit is fail fast instead of retry for guess/preview mode
34
+
35
+ ## 0.2.10 - 2018-03-26
36
+ * [enhancement] Add Zendesk market place header
37
+
38
+ ## 0.2.9 - 2017-08-03
39
+ * [fixed] `start_time` is not merged to `query`, causing infinite loop [#42](https://github.com/treasure-data/embulk-input-zendesk/pull/42)
40
+
41
+ ## 0.2.8 - 2017-07-28
42
+ * [fixed] Raise `DataError` instead of `TempError` after giving up for `TempError` [#40](https://github.com/treasure-data/embulk-input-zendesk/pull/40)
43
+ * [enhancement] Only rescue `TempError` when executing thread pool, only create/shutdown pool once during retry, move retry to inside of `execute_thread_pool`
44
+
45
+ ## 0.2.7 - 2017-07-19
46
+ * [fixed] Ensure thread pool is shutdown [#38](https://github.com/treasure-data/embulk-input-zendesk/pull/38)
47
+ * [enhancement] Add retry for temporary error: missing required key from JSON response
48
+
49
+ ## 0.2.6 - 2017-05-23
50
+ * [enhancement] Enable incremental loading for ticket_metrics
51
+
52
+ ## 0.2.5 - 2017-04-21
53
+ * [enhancement] Replace `thread` gem with `concurrent-ruby`, it's more robust and has better queue management [#33](https://github.com/treasure-data/embulk-input-zendesk/pull/33)
54
+
55
+ ## 0.2.4 - 2017-04-20
56
+ * [fixed] Fix thread pool bottleneck [#31](https://github.com/treasure-data/embulk-input-zendesk/pull/31)
57
+
58
+ ## 0.2.3 - 2017-04-18
59
+ * [enhancement] Add flushing to `page_builder` [#29](https://github.com/treasure-data/embulk-input-zendesk/pull/29)
60
+
61
+ ## 0.2.2 - 2017-04-14
62
+ * [enhancement] Improve `httpclient` usage: re-use client instance [#27](https://github.com/treasure-data/embulk-input-zendesk/pull/27)
63
+
64
+ ## 0.2.1 - 2017-04-11
65
+ * [fixed] Mem leak in `export_parallel()` method [#25](https://github.com/treasure-data/embulk-input-zendesk/pull/25)
66
+
67
+ ## 0.2.0 - 2017-04-07
68
+ * [fixed] `time_metrics` is cutoff (archived), need to compare with list of all `tickets` [#23](https://github.com/treasure-data/embulk-input-zendesk/pull/23)
69
+ * [enhancement] Switch to thread pool for `export_parallel()` method [#23](https://github.com/treasure-data/embulk-input-zendesk/pull/23)
70
+
71
+ ## 0.1.15 - 2017-03-30
72
+ * [fixed] Rename JRuby thread, to not expose runtime path [#21](https://github.com/treasure-data/embulk-input-zendesk/pull/21)
73
+
74
+ ## 0.1.14 - 2017-03-28
75
+ * [enhancement] Concurrent fetching base target and related objects [#19](https://github.com/treasure-data/embulk-input-zendesk/pull/19)
76
+
77
+ ## 0.1.13 - 2017-03-23
78
+ * [fixed] Fix to generate config_diff when no data fetched [#18](https://github.com/treasure-data/embulk-input-zendesk/pull/18)
79
+
80
+ ## 0.1.12 - 2016-10-20
81
+ * [fixed] Fix `*_id` columns to be guessed as string. (e.g. external_id) [#17](https://github.com/treasure-data/embulk-input-zendesk/pull/17)
82
+
83
+ ## 0.1.11 - 2016-10-20
84
+ * [fixed] Ignore `updated_at` <= `start_time` record [#16](https://github.com/treasure-data/embulk-input-zendesk/pull/16)
85
+
86
+ ## 0.1.10 - 2016-10-17
87
+ * [fixed] All `*_id` columns should be type:long [#15](https://github.com/treasure-data/embulk-input-zendesk/pull/15)
88
+
89
+ ## 0.1.9 - 2016-08-26
90
+ * [fixed] Ignore '422: Too recent start_time' [#14](https://github.com/treasure-data/embulk-input-zendesk/pull/14)
91
+
92
+ ## 0.1.8 - 2016-07-11
93
+
94
+ * [enhancement] For huge data [#13](https://github.com/treasure-data/embulk-input-zendesk/pull/13)
95
+ * [enhancement] Improvements for non incremental export [#12](https://github.com/treasure-data/embulk-input-zendesk/pull/12)
96
+
97
+ ## 0.1.7 - 2016-06-04
98
+ * [enhancement] Improvements for non incremental export [#12](https://github.com/treasure-data/embulk-input-zendesk/pull/12)
99
+
100
+ ## 0.1.6 - 2016-05-09
101
+ * [fixed] Fix non-incremental export to fetch all records [#11](https://github.com/treasure-data/embulk-input-zendesk/pull/11)
102
+
103
+ ## 0.1.5 - 2016-04-14
104
+ * [enhancement] Mitigate debug pain when many retry then error [#10](https://github.com/treasure-data/embulk-input-zendesk/pull/10)
105
+
106
+ ## 0.1.4 - 2016-04-08
107
+
108
+ * [enhancement] Correct preview data [#9](https://github.com/treasure-data/embulk-input-zendesk/pull/9)
109
+
110
+ ## 0.1.3 - 2016-03-15
111
+
112
+ * [enhancement] Support more targets [#8](https://github.com/treasure-data/embulk-input-zendesk/pull/8)
113
+ * [enhancement] Enable json type [#7](https://github.com/treasure-data/embulk-input-zendesk/pull/7)
114
+
115
+ ## 0.1.2 - 2016-01-29
116
+
117
+ * [maintenance] Add authors @muga and @sakama.
118
+ * [enhancement] Add Incremental option [#6](https://github.com/treasure-data/embulk-input-zendesk/pull/6)
119
+
120
+ ## 0.1.1 - 2016-01-26
121
+
122
+ * [fixed] Fix when null value given.
123
+
124
+ ## 0.1.0 - 2016-01-26
125
+
126
+ The first release!!
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,91 @@
1
+ [![Build Status](https://travis-ci.org/treasure-data/embulk-input-zendesk.svg?branch=master)](https://travis-ci.org/treasure-data/embulk-input-zendesk)
2
+ [![Code Climate](https://codeclimate.com/github/treasure-data/embulk-input-zendesk/badges/gpa.svg)](https://codeclimate.com/github/treasure-data/embulk-input-zendesk)
3
+ [![Test Coverage](https://codeclimate.com/github/treasure-data/embulk-input-zendesk/badges/coverage.svg)](https://codeclimate.com/github/treasure-data/embulk-input-zendesk/coverage)
4
+ [![Gem Version](https://badge.fury.io/rb/embulk-input-zendesk.svg)](https://badge.fury.io/rb/embulk-input-zendesk)
5
+
6
+ # Zendesk input plugin for Embulk
7
+
8
+ Embulk input plugin for loading [Zendesk](https://www.zendesk.com/) records.
9
+
10
+ ## Overview
11
+
12
+ Required Embulk version >= 0.9.6.
13
+
14
+ **NOTE** This plugin don't support JSON type columns e.g. custom fields, tags, etc for now. But they will be supported soon.
15
+
16
+ * **Plugin type**: input
17
+ * **Resume supported**: no
18
+ * **Cleanup supported**: no
19
+ * **Guess supported**: no
20
+
21
+ ## Configuration
22
+
23
+ - **login_url**: Login URL for Zendesk (string, required)
24
+ - **auth_method**: `basic`, `token`, or `oauth`. For more detail on [zendesk document](https://developer.zendesk.com/rest_api/docs/core/introduction#security-and-authentication). (string, required)
25
+ - **target**: Which export Zendesk resource. Currently supported are `tickets`, `ticket_events`, `users`, `organizations`, `ticket_fields`, `ticket_forms`, `ticket_metrics`, `scores`, `recipients`, `object_records`, `relationship_records` or `user_events`. (string, required)
26
+ - **includes**: Will fetch sub resources. For example, ticket has ticket_audits, ticket_comments. See below example config. (array, default: `[]`)
27
+ - **username**: The user name a.k.a. email. Required if `auth_method` is `basic` or `token`. (string, default: `null`)
28
+ - **password**: Password. required if `auth_method` is `basic`. (string, default: `null`)
29
+ - **token**: Token. required if `auth_method` is `token`. (string, default: `null`)
30
+ - **access_token**: OAuth Access Token. required if `auth_method` is `oauth`. (string, default: `null`)
31
+ - **start_time**: Start export from this time if present. (string, default: `null`)
32
+ - **retry_limit**: Try to retry this times (integer, default: 5)
33
+ - **retry_initial_wait_sec**: Wait seconds for exponential backoff initial value (integer, default: 4)
34
+ - **incremental**: If false, `start_time` in next.yml would not be updated that means you always fetch all of data from Zendesk with statically conditions. If true, `start_time` would be updated in next.yml. (bool, default: `true`)
35
+ - **dedup**: Zendesk incremental API is not designed to protect against duplication. In order to de-dup records, plugin has to cache fetched IDs in memory. If you're importing a large dataset (eg. tens of millions of records), it can lead to OOM error, depends on your configured heap size. In such cases, you can set this option to `false`, but keep in mind that result may contain duplicated records. (bool, default: `true`)
36
+ - **app_marketplace_integration_name**: Invisible to user, only requires to be a part of the Zendesk Apps Marketplace. This should be used to name of the integration.
37
+ - **app_marketplace_org_id**: Invisible to user, only requires to be a part of the Zendesk Apps Marketplace. This should be the Organization ID for your organization from the new developer portal.
38
+ - **app_marketplace_app_id**: Invisible to user, only requires to be a part of the Zendesk Apps Marketplace. This is the “App ID” that will be assigned to you when you submit your app.
39
+ - **object_types**: List custom object types, required if `target` is `object_records`.
40
+ - **relationship_types**: List custom relationship types, required if `target` is `relationship_records`.
41
+ - **profile_source**: Profile source of user event, required if `target` is `user_events`.
42
+ - **user_event_source**: Source of user event, required if `target` is `user_events`.
43
+ - **user_event_type**: Type of user event, required if `target` is `user_events`.
44
+
45
+ ## Example
46
+
47
+ ```yaml
48
+ in:
49
+ type: zendesk
50
+ login_url: https://obscura.zendesk.com
51
+ auth_method: token
52
+ username: jdoe@example.com
53
+ token: 6wiIBWbGkBMo1mRDMuVwkw1EPsNkeUj95PIz2akv
54
+ target: tickets
55
+ includes:
56
+ - audits
57
+ - comments
58
+ start_time: "2015-01-01 00:00:00+0000"
59
+ ```
60
+
61
+
62
+ ## Build
63
+
64
+ ```
65
+ $ ./gradlew package
66
+ ```
67
+
68
+
69
+ @Config("object_types")
70
+ @ConfigDefault("[]")
71
+ List<String> getObjectTypes();
72
+
73
+ @Config("relationship_types")
74
+ @ConfigDefault("[]")
75
+ List<String> getRelationshipTypes();
76
+
77
+ @Config("profile_source")
78
+ @ConfigDefault("null")
79
+ Optional<String> getProfileSource();
80
+
81
+ @Config("end_time")
82
+ @ConfigDefault("null")
83
+ Optional<String> getEndTime();
84
+
85
+ @Config("user_event_type")
86
+ @ConfigDefault("null")
87
+ Optional<String> getUserEventType();
88
+
89
+ @Config("user_event_source")
90
+ @ConfigDefault("null")
91
+ Optional<String> getUserEventSource();
data/build.gradle ADDED
@@ -0,0 +1,123 @@
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 "checkstyle"
6
+ id "jacoco"
7
+ id "findbugs"
8
+ }
9
+ import com.github.jrubygradle.JRubyExec
10
+ repositories {
11
+ mavenCentral()
12
+ jcenter()
13
+ }
14
+ configurations {
15
+ provided
16
+ }
17
+
18
+ version = "0.3.7"
19
+
20
+ sourceCompatibility = 1.8
21
+ targetCompatibility = 1.8
22
+
23
+ dependencies {
24
+ compile "org.embulk:embulk-core:0.9.7"
25
+ provided("org.embulk:embulk-core:0.9.7")
26
+ compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.6'
27
+ testCompile "junit:junit:4.+"
28
+ testCompile "org.embulk:embulk-core:0.9.7:tests"
29
+ testCompile "org.embulk:embulk-test:0.9.7"
30
+ testCompile "org.mockito:mockito-core:2.+"
31
+ }
32
+
33
+ task classpath(type: Copy, dependsOn: ["jar"]) {
34
+ doFirst { file("classpath").deleteDir() }
35
+ from (configurations.runtime - configurations.provided + files(jar.archivePath))
36
+ into "classpath"
37
+ }
38
+ clean { delete "classpath" }
39
+
40
+ jacocoTestReport {
41
+ group = "Reporting"
42
+ reports {
43
+ xml.enabled false
44
+ csv.enabled false
45
+ html.destination file("${buildDir}/reports/coverage")
46
+ }
47
+ }
48
+
49
+ tasks.withType(FindBugs) {
50
+ reports {
51
+ xml.enabled = false
52
+ html.enabled = true
53
+ }
54
+ }
55
+
56
+ checkstyle {
57
+ configFile = file("${project.rootDir}/config/checkstyle/checkstyle.xml")
58
+ toolVersion = '6.14.1'
59
+ }
60
+ checkstyleMain {
61
+ configFile = file("${project.rootDir}/config/checkstyle/default.xml")
62
+ ignoreFailures = false
63
+ }
64
+ checkstyleTest {
65
+ configFile = file("${project.rootDir}/config/checkstyle/default.xml")
66
+ ignoreFailures = false
67
+ }
68
+ task checkstyle(type: Checkstyle) {
69
+ classpath = sourceSets.main.output + sourceSets.test.output
70
+ source = sourceSets.main.allJava + sourceSets.test.allJava
71
+ }
72
+
73
+ task gem(type: JRubyExec, dependsOn: ["gemspec", "classpath"]) {
74
+ jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "build"
75
+ script "${project.name}.gemspec"
76
+ doLast { ant.move(file: "${project.name}-${project.version}.gem", todir: "pkg") }
77
+ }
78
+
79
+ task gemPush(type: JRubyExec, dependsOn: ["gem"]) {
80
+ jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "push"
81
+ script "pkg/${project.name}-${project.version}.gem"
82
+ }
83
+
84
+ task "package"(dependsOn: ["gemspec", "classpath"]) {
85
+ doLast {
86
+ println "> Build succeeded."
87
+ println "> You can run embulk with '-L ${file(".").absolutePath}' argument."
88
+ }
89
+ }
90
+
91
+ task gemspec {
92
+ ext.gemspecFile = file("${project.name}.gemspec")
93
+ inputs.file "build.gradle"
94
+ outputs.file gemspecFile
95
+ doLast { gemspecFile.write($/
96
+ Gem::Specification.new do |spec|
97
+ spec.name = "${project.name}"
98
+ spec.version = "${project.version}"
99
+ spec.authors = ["hieu.duong"]
100
+ spec.summary = %[Zendesk input plugin for Embulk]
101
+ spec.description = %[Loads records from Zendesk.]
102
+ spec.email = ["hieu.duong@treasure-data.com"]
103
+ spec.licenses = ["MIT"]
104
+ spec.homepage = "https://github.com/treasure-data/embulk-input-zendesk"
105
+
106
+ spec.files = `git ls-files`.split("\n") + Dir["classpath/*.jar"]
107
+ spec.test_files = spec.files.grep(%r"^(test|spec)/")
108
+ spec.require_paths = ["lib"]
109
+
110
+ #spec.add_dependency 'YOUR_GEM_DEPENDENCY', ['~> YOUR_GEM_DEPENDENCY_VERSION']
111
+ spec.add_development_dependency 'bundler', ['~> 1.0']
112
+ spec.add_development_dependency 'rake', ['~> 12.0']
113
+ end
114
+ /$)
115
+ }
116
+ }
117
+ clean { delete "${project.name}.gemspec" }
118
+
119
+ test {
120
+ testLogging {
121
+ events "passed", "skipped", "failed"
122
+ }
123
+ }
@@ -0,0 +1,128 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE module PUBLIC
3
+ "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
4
+ "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
5
+ <module name="Checker">
6
+ <!-- https://github.com/facebook/presto/blob/master/src/checkstyle/checks.xml -->
7
+ <module name="FileTabCharacter"/>
8
+ <module name="NewlineAtEndOfFile">
9
+ <property name="lineSeparator" value="lf"/>
10
+ </module>
11
+ <module name="RegexpMultiline">
12
+ <property name="format" value="\r"/>
13
+ <property name="message" value="Line contains carriage return"/>
14
+ </module>
15
+ <module name="RegexpMultiline">
16
+ <property name="format" value=" \n"/>
17
+ <property name="message" value="Line has trailing whitespace"/>
18
+ </module>
19
+ <module name="RegexpMultiline">
20
+ <property name="format" value="\{\n\n"/>
21
+ <property name="message" value="Blank line after opening brace"/>
22
+ </module>
23
+ <module name="RegexpMultiline">
24
+ <property name="format" value="\n\n\s*\}"/>
25
+ <property name="message" value="Blank line before closing brace"/>
26
+ </module>
27
+ <module name="RegexpMultiline">
28
+ <property name="format" value="\n\n\n"/>
29
+ <property name="message" value="Multiple consecutive blank lines"/>
30
+ </module>
31
+ <module name="RegexpMultiline">
32
+ <property name="format" value="\n\n\Z"/>
33
+ <property name="message" value="Blank line before end of file"/>
34
+ </module>
35
+ <module name="RegexpMultiline">
36
+ <property name="format" value="Preconditions\.checkNotNull"/>
37
+ <property name="message" value="Use of checkNotNull"/>
38
+ </module>
39
+
40
+ <module name="TreeWalker">
41
+ <module name="EmptyBlock">
42
+ <property name="option" value="text"/>
43
+ <property name="tokens" value="
44
+ LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_IF,
45
+ LITERAL_FOR, LITERAL_TRY, LITERAL_WHILE, INSTANCE_INIT, STATIC_INIT"/>
46
+ </module>
47
+ <module name="EmptyStatement"/>
48
+ <module name="EmptyForInitializerPad"/>
49
+ <module name="EmptyForIteratorPad">
50
+ <property name="option" value="space"/>
51
+ </module>
52
+ <module name="MethodParamPad">
53
+ <property name="allowLineBreaks" value="true"/>
54
+ <property name="option" value="nospace"/>
55
+ </module>
56
+ <module name="ParenPad"/>
57
+ <module name="TypecastParenPad"/>
58
+ <module name="NeedBraces"/>
59
+ <module name="LeftCurly">
60
+ <property name="option" value="nl"/>
61
+ <property name="tokens" value="CLASS_DEF, CTOR_DEF, INTERFACE_DEF, METHOD_DEF"/>
62
+ </module>
63
+ <module name="LeftCurly">
64
+ <property name="option" value="eol"/>
65
+ <property name="tokens" value="
66
+ LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR,
67
+ LITERAL_IF, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE"/>
68
+ </module>
69
+ <module name="RightCurly">
70
+ <property name="option" value="alone"/>
71
+ </module>
72
+ <module name="GenericWhitespace"/>
73
+ <module name="WhitespaceAfter"/>
74
+ <module name="NoWhitespaceBefore"/>
75
+
76
+ <module name="UpperEll"/>
77
+ <module name="DefaultComesLast"/>
78
+ <module name="ArrayTypeStyle"/>
79
+ <module name="MultipleVariableDeclarations"/>
80
+ <module name="ModifierOrder"/>
81
+ <module name="OneStatementPerLine"/>
82
+ <module name="StringLiteralEquality"/>
83
+ <module name="MutableException"/>
84
+ <module name="EqualsHashCode"/>
85
+ <module name="InnerAssignment"/>
86
+ <module name="InterfaceIsType"/>
87
+ <module name="HideUtilityClassConstructor"/>
88
+
89
+ <module name="MemberName"/>
90
+ <module name="LocalVariableName"/>
91
+ <module name="LocalFinalVariableName"/>
92
+ <module name="TypeName"/>
93
+ <module name="PackageName"/>
94
+ <module name="ParameterName"/>
95
+ <module name="StaticVariableName"/>
96
+ <module name="ClassTypeParameterName">
97
+ <property name="format" value="^[A-Z][0-9]?$"/>
98
+ </module>
99
+ <module name="MethodTypeParameterName">
100
+ <property name="format" value="^[A-Z][0-9]?$"/>
101
+ </module>
102
+
103
+ <module name="AvoidStarImport"/>
104
+ <module name="RedundantImport"/>
105
+ <module name="UnusedImports"/>
106
+ <module name="ImportOrder">
107
+ <property name="groups" value="*,javax,java"/>
108
+ <property name="separated" value="true"/>
109
+ <property name="option" value="bottom"/>
110
+ <property name="sortStaticImportsAlphabetically" value="true"/>
111
+ </module>
112
+
113
+ <module name="WhitespaceAround">
114
+ <property name="allowEmptyConstructors" value="true"/>
115
+ <property name="allowEmptyMethods" value="true"/>
116
+ <property name="ignoreEnhancedForColon" value="false"/>
117
+ <property name="tokens" value="
118
+ ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN,
119
+ BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LE,
120
+ LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE,
121
+ LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN,
122
+ LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE,
123
+ LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL,
124
+ PLUS, PLUS_ASSIGN, QUESTION, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN,
125
+ STAR, STAR_ASSIGN, TYPE_EXTENSION_AND"/>
126
+ </module>
127
+ </module>
128
+ </module>