embulk-input-zendesk 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +3 -0
  3. data/README.md +32 -2
  4. data/build.gradle +1 -1
  5. data/src/main/java/org/embulk/input/zendesk/RecordImporter.java +134 -0
  6. data/src/main/java/org/embulk/input/zendesk/ZendeskInputPlugin.java +182 -202
  7. data/src/main/java/org/embulk/input/zendesk/clients/ZendeskRestClient.java +54 -52
  8. data/src/main/java/org/embulk/input/zendesk/models/Target.java +3 -3
  9. data/src/main/java/org/embulk/input/zendesk/models/ZendeskException.java +1 -1
  10. data/src/main/java/org/embulk/input/zendesk/services/ZendeskCustomObjectService.java +110 -0
  11. data/src/main/java/org/embulk/input/zendesk/services/ZendeskNPSService.java +30 -0
  12. data/src/main/java/org/embulk/input/zendesk/services/ZendeskNormalServices.java +239 -0
  13. data/src/main/java/org/embulk/input/zendesk/services/ZendeskService.java +14 -0
  14. data/src/main/java/org/embulk/input/zendesk/services/ZendeskSupportAPIService.java +25 -83
  15. data/src/main/java/org/embulk/input/zendesk/services/ZendeskUserEventService.java +158 -0
  16. data/src/main/java/org/embulk/input/zendesk/stream/PagingSpliterator.java +40 -0
  17. data/src/main/java/org/embulk/input/zendesk/stream/paginator/sunshine/CustomObjectSpliterator.java +42 -0
  18. data/src/main/java/org/embulk/input/zendesk/stream/paginator/sunshine/SunshineSpliterator.java +66 -0
  19. data/src/main/java/org/embulk/input/zendesk/stream/paginator/sunshine/UserEventSpliterator.java +35 -0
  20. data/src/main/java/org/embulk/input/zendesk/stream/paginator/support/OrganizationSpliterator.java +13 -0
  21. data/src/main/java/org/embulk/input/zendesk/stream/paginator/support/SupportSpliterator.java +44 -0
  22. data/src/main/java/org/embulk/input/zendesk/stream/paginator/support/UserSpliterator.java +13 -0
  23. data/src/main/java/org/embulk/input/zendesk/utils/ZendeskConstants.java +13 -1
  24. data/src/main/java/org/embulk/input/zendesk/utils/ZendeskDateUtils.java +22 -11
  25. data/src/main/java/org/embulk/input/zendesk/utils/ZendeskUtils.java +52 -114
  26. data/src/test/java/org/embulk/input/zendesk/TestRecordImporter.java +114 -0
  27. data/src/test/java/org/embulk/input/zendesk/TestZendeskInputPlugin.java +184 -99
  28. data/src/test/java/org/embulk/input/zendesk/clients/TestZendeskRestClient.java +6 -20
  29. data/src/test/java/org/embulk/input/zendesk/services/TestZendeskCustomObjectService.java +161 -0
  30. data/src/test/java/org/embulk/input/zendesk/services/TestZendeskNPSService.java +56 -0
  31. data/src/test/java/org/embulk/input/zendesk/services/TestZendeskNormalService.java +189 -0
  32. data/src/test/java/org/embulk/input/zendesk/services/TestZendeskSupportAPIService.java +18 -60
  33. data/src/test/java/org/embulk/input/zendesk/services/TestZendeskUserEventService.java +158 -0
  34. data/src/test/java/org/embulk/input/zendesk/utils/TestZendeskDateUtils.java +50 -2
  35. data/src/test/java/org/embulk/input/zendesk/utils/TestZendeskUtil.java +0 -138
  36. data/src/test/java/org/embulk/input/zendesk/utils/ZendeskTestHelper.java +16 -0
  37. data/src/test/resources/config/nps.yml +29 -0
  38. data/src/test/resources/config/object_records.yml +24 -0
  39. data/src/test/resources/config/relationship_records.yml +23 -0
  40. data/src/test/resources/config/user_events.yml +29 -0
  41. data/src/test/resources/data/duplicate_user.json +0 -0
  42. data/src/test/resources/data/empty_result.json +7 -0
  43. data/src/test/resources/data/expected/user_events_column.json +40 -0
  44. data/src/test/resources/data/object_records.json +30 -0
  45. data/src/test/resources/data/organization.json +39 -0
  46. data/src/test/resources/data/relationship_records.json +57 -0
  47. data/src/test/resources/data/scores.json +21 -0
  48. data/src/test/resources/data/scores_share_same_time_with_next_page.json +35 -0
  49. data/src/test/resources/data/scores_share_same_time_without_next_page.json +35 -0
  50. data/src/test/resources/data/simple_organization.json +23 -0
  51. data/src/test/resources/data/simple_user.json +50 -0
  52. data/src/test/resources/data/simple_user_event.json +19 -0
  53. data/src/test/resources/data/ticket_events_share_same_time_with_next_page.json +279 -0
  54. data/src/test/resources/data/ticket_events_share_same_time_without_next_page.json +279 -0
  55. data/src/test/resources/data/ticket_events_updated_by_system_records.json +279 -0
  56. data/src/test/resources/data/ticket_share_same_time_with_next_page.json +232 -0
  57. data/src/test/resources/data/ticket_share_same_time_without_next_page.json +232 -0
  58. data/src/test/resources/data/ticket_with_updated_by_system_records.json +187 -0
  59. data/src/test/resources/data/user_event.json +19 -0
  60. data/src/test/resources/data/user_event_contain_latter_create_at.json +19 -0
  61. data/src/test/resources/data/user_event_multiple.json +33 -0
  62. metadata +46 -5
  63. data/src/main/java/org/embulk/input/zendesk/utils/ZendeskValidatorUtils.java +0 -79
  64. data/src/test/java/org/embulk/input/zendesk/utils/TestZendeskValidatorUtils.java +0 -130
@@ -0,0 +1,279 @@
1
+ {
2
+ "ticket_events": [
3
+ {
4
+ "child_events": [
5
+ {
6
+ "id": 614323587494,
7
+ "via": "Sample Ticket",
8
+ "via_reference_id": null,
9
+ "comment_present": true,
10
+ "comment_public": true,
11
+ "event_type": "Comment"
12
+ },
13
+ {
14
+ "id": 614323587594,
15
+ "via": "Sample Ticket",
16
+ "via_reference_id": null,
17
+ "assignee_id": 374673563333,
18
+ "event_type": "Create"
19
+ },
20
+ {
21
+ "id": 614323587674,
22
+ "via": "Sample Ticket",
23
+ "via_reference_id": null,
24
+ "subject": "Sample ticket: Meet the ticket",
25
+ "event_type": "Create"
26
+ },
27
+ {
28
+ "id": 614323587694,
29
+ "via": "Sample Ticket",
30
+ "via_reference_id": null,
31
+ "tags": [
32
+ "sample",
33
+ "support",
34
+ "zendesk"
35
+ ],
36
+ "added_tags": [
37
+ "sample",
38
+ "support",
39
+ "zendesk"
40
+ ],
41
+ "removed_tags": [],
42
+ "event_type": "Create"
43
+ },
44
+ {
45
+ "id": 614323587734,
46
+ "via": "Sample Ticket",
47
+ "via_reference_id": null,
48
+ "group_id": 360003235353,
49
+ "event_type": "Create"
50
+ },
51
+ {
52
+ "id": 614323587774,
53
+ "via": "Sample Ticket",
54
+ "via_reference_id": null,
55
+ "status": "open",
56
+ "event_type": "Create"
57
+ },
58
+ {
59
+ "id": 614323587794,
60
+ "via": "Sample Ticket",
61
+ "via_reference_id": null,
62
+ "requester_id": 374737473854,
63
+ "event_type": "Create"
64
+ }
65
+ ],
66
+ "id": 614323587394,
67
+ "ticket_id": 1,
68
+ "timestamp": 1550645443,
69
+ "created_at": "2019-02-20T06:50:45Z",
70
+ "updater_id": 374737473854,
71
+ "via": "Sample Ticket",
72
+ "system": {
73
+ "client": null,
74
+ "location": null,
75
+ "latitude": null,
76
+ "longitude": null
77
+ },
78
+ "event_type": "Audit"
79
+ },
80
+ {
81
+ "child_events": [
82
+ {
83
+ "id": 614323589934,
84
+ "via": "Sample Ticket",
85
+ "via_reference_id": null,
86
+ "type": "incident",
87
+ "event_type": "Change",
88
+ "previous_value": "0"
89
+ },
90
+ {
91
+ "id": 614323589954,
92
+ "via": "Sample Ticket",
93
+ "via_reference_id": null,
94
+ "priority": "normal",
95
+ "event_type": "Change",
96
+ "previous_value": "0"
97
+ }
98
+ ],
99
+ "id": 614323589894,
100
+ "ticket_id": 1,
101
+ "timestamp": 1550645443,
102
+ "created_at": "2019-02-20T06:50:45Z",
103
+ "updater_id": 374673563333,
104
+ "via": "Sample Ticket",
105
+ "system": {
106
+ "client": null,
107
+ "location": null,
108
+ "latitude": null,
109
+ "longitude": null
110
+ },
111
+ "event_type": "Audit"
112
+ },
113
+ {
114
+ "child_events": [
115
+ {
116
+ "id": 613784741493,
117
+ "via": "Web form",
118
+ "via_reference_id": null,
119
+ "comment_present": true,
120
+ "comment_public": true,
121
+ "event_type": "Comment"
122
+ },
123
+ {
124
+ "id": 613784741673,
125
+ "via": "Web form",
126
+ "via_reference_id": null,
127
+ "subject": "ticket1",
128
+ "event_type": "Create"
129
+ },
130
+ {
131
+ "id": 613784741713,
132
+ "via": "Web form",
133
+ "via_reference_id": null,
134
+ "requester_id": 374673563333,
135
+ "event_type": "Create"
136
+ },
137
+ {
138
+ "id": 613784741753,
139
+ "via": "Web form",
140
+ "via_reference_id": null,
141
+ "status": "open",
142
+ "event_type": "Create"
143
+ },
144
+ {
145
+ "id": 613784741773,
146
+ "via": "Web form",
147
+ "via_reference_id": null,
148
+ "priority": null,
149
+ "event_type": "Create"
150
+ },
151
+ {
152
+ "id": 613784741793,
153
+ "via": "Web form",
154
+ "via_reference_id": null,
155
+ "type": null,
156
+ "event_type": "Create"
157
+ },
158
+ {
159
+ "id": 613784741813,
160
+ "via": "Web form",
161
+ "via_reference_id": null,
162
+ "assignee_id": 374673563333,
163
+ "event_type": "Create"
164
+ },
165
+ {
166
+ "id": 613784741833,
167
+ "via": "Web form",
168
+ "via_reference_id": null,
169
+ "group_id": 360003235353,
170
+ "event_type": "Create"
171
+ },
172
+ {
173
+ "id": 613784741853,
174
+ "via": "Web form",
175
+ "via_reference_id": null,
176
+ "organization_id": "360857467053",
177
+ "event_type": "Create"
178
+ }
179
+ ],
180
+ "id": 613784741453,
181
+ "ticket_id": 2,
182
+ "timestamp": 1550645443,
183
+ "created_at": "2019-02-20T06:51:50Z",
184
+ "updater_id": 374673563333,
185
+ "via": "Web form",
186
+ "system": {
187
+ "client": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36",
188
+ "location": "Quang Ngai, 63, Vietnam",
189
+ "latitude": 15.116700000000009,
190
+ "longitude": 108.80000000000001
191
+ },
192
+ "event_type": "Audit"
193
+ },
194
+ {
195
+ "child_events": [
196
+ {
197
+ "id": 613784845113,
198
+ "via": "Web form",
199
+ "via_reference_id": null,
200
+ "comment_present": true,
201
+ "comment_public": true,
202
+ "event_type": "Comment"
203
+ },
204
+ {
205
+ "id": 613784845173,
206
+ "via": "Web form",
207
+ "via_reference_id": null,
208
+ "subject": "ticket2",
209
+ "event_type": "Create"
210
+ },
211
+ {
212
+ "id": 613784845193,
213
+ "via": "Web form",
214
+ "via_reference_id": null,
215
+ "requester_id": 374673563333,
216
+ "event_type": "Create"
217
+ },
218
+ {
219
+ "id": 613784845233,
220
+ "via": "Web form",
221
+ "via_reference_id": null,
222
+ "status": "open",
223
+ "event_type": "Create"
224
+ },
225
+ {
226
+ "id": 613784845253,
227
+ "via": "Web form",
228
+ "via_reference_id": null,
229
+ "priority": null,
230
+ "event_type": "Create"
231
+ },
232
+ {
233
+ "id": 613784845293,
234
+ "via": "Web form",
235
+ "via_reference_id": null,
236
+ "type": null,
237
+ "event_type": "Create"
238
+ },
239
+ {
240
+ "id": 613784845353,
241
+ "via": "Web form",
242
+ "via_reference_id": null,
243
+ "assignee_id": 374673563333,
244
+ "event_type": "Create"
245
+ },
246
+ {
247
+ "id": 613784845393,
248
+ "via": "Web form",
249
+ "via_reference_id": null,
250
+ "group_id": 360003235353,
251
+ "event_type": "Create"
252
+ },
253
+ {
254
+ "id": 613784845433,
255
+ "via": "Web form",
256
+ "via_reference_id": null,
257
+ "organization_id": "360857467053",
258
+ "event_type": "Create"
259
+ }
260
+ ],
261
+ "id": 613784845093,
262
+ "ticket_id": 3,
263
+ "timestamp": 1550645443,
264
+ "created_at": "2019-02-20T06:52:02Z",
265
+ "updater_id": 374673563333,
266
+ "via": "Web form",
267
+ "system": {
268
+ "client": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36",
269
+ "location": "Quang Ngai, 63, Vietnam",
270
+ "latitude": 15.116700000000009,
271
+ "longitude": 108.80000000000001
272
+ },
273
+ "event_type": "Audit"
274
+ }
275
+ ],
276
+ "count": 1000,
277
+ "next_page": "https://abc.zendesk.com/api/v2/incremental/ticket_events.json?sort_by=updated_at&start_time=1550645443",
278
+ "end_time": 1550645443
279
+ }
@@ -0,0 +1,279 @@
1
+ {
2
+ "ticket_events": [
3
+ {
4
+ "child_events": [
5
+ {
6
+ "id": 614323587494,
7
+ "via": "Sample Ticket",
8
+ "via_reference_id": null,
9
+ "comment_present": true,
10
+ "comment_public": true,
11
+ "event_type": "Comment"
12
+ },
13
+ {
14
+ "id": 614323587594,
15
+ "via": "Sample Ticket",
16
+ "via_reference_id": null,
17
+ "assignee_id": 374673563333,
18
+ "event_type": "Create"
19
+ },
20
+ {
21
+ "id": 614323587674,
22
+ "via": "Sample Ticket",
23
+ "via_reference_id": null,
24
+ "subject": "Sample ticket: Meet the ticket",
25
+ "event_type": "Create"
26
+ },
27
+ {
28
+ "id": 614323587694,
29
+ "via": "Sample Ticket",
30
+ "via_reference_id": null,
31
+ "tags": [
32
+ "sample",
33
+ "support",
34
+ "zendesk"
35
+ ],
36
+ "added_tags": [
37
+ "sample",
38
+ "support",
39
+ "zendesk"
40
+ ],
41
+ "removed_tags": [],
42
+ "event_type": "Create"
43
+ },
44
+ {
45
+ "id": 614323587734,
46
+ "via": "Sample Ticket",
47
+ "via_reference_id": null,
48
+ "group_id": 360003235353,
49
+ "event_type": "Create"
50
+ },
51
+ {
52
+ "id": 614323587774,
53
+ "via": "Sample Ticket",
54
+ "via_reference_id": null,
55
+ "status": "open",
56
+ "event_type": "Create"
57
+ },
58
+ {
59
+ "id": 614323587794,
60
+ "via": "Sample Ticket",
61
+ "via_reference_id": null,
62
+ "requester_id": 374737473854,
63
+ "event_type": "Create"
64
+ }
65
+ ],
66
+ "id": 614323587394,
67
+ "ticket_id": 1,
68
+ "timestamp": 1550645443,
69
+ "created_at": "2019-02-20T06:50:45Z",
70
+ "updater_id": 374737473854,
71
+ "via": "Sample Ticket",
72
+ "system": {
73
+ "client": null,
74
+ "location": null,
75
+ "latitude": null,
76
+ "longitude": null
77
+ },
78
+ "event_type": "Audit"
79
+ },
80
+ {
81
+ "child_events": [
82
+ {
83
+ "id": 614323589934,
84
+ "via": "Sample Ticket",
85
+ "via_reference_id": null,
86
+ "type": "incident",
87
+ "event_type": "Change",
88
+ "previous_value": "0"
89
+ },
90
+ {
91
+ "id": 614323589954,
92
+ "via": "Sample Ticket",
93
+ "via_reference_id": null,
94
+ "priority": "normal",
95
+ "event_type": "Change",
96
+ "previous_value": "0"
97
+ }
98
+ ],
99
+ "id": 614323589894,
100
+ "ticket_id": 1,
101
+ "timestamp": 1550645445,
102
+ "created_at": "2019-02-20T06:50:45Z",
103
+ "updater_id": 374673563333,
104
+ "via": "Sample Ticket",
105
+ "system": {
106
+ "client": null,
107
+ "location": null,
108
+ "latitude": null,
109
+ "longitude": null
110
+ },
111
+ "event_type": "Audit"
112
+ },
113
+ {
114
+ "child_events": [
115
+ {
116
+ "id": 613784741493,
117
+ "via": "Web form",
118
+ "via_reference_id": null,
119
+ "comment_present": true,
120
+ "comment_public": true,
121
+ "event_type": "Comment"
122
+ },
123
+ {
124
+ "id": 613784741673,
125
+ "via": "Web form",
126
+ "via_reference_id": null,
127
+ "subject": "ticket1",
128
+ "event_type": "Create"
129
+ },
130
+ {
131
+ "id": 613784741713,
132
+ "via": "Web form",
133
+ "via_reference_id": null,
134
+ "requester_id": 374673563333,
135
+ "event_type": "Create"
136
+ },
137
+ {
138
+ "id": 613784741753,
139
+ "via": "Web form",
140
+ "via_reference_id": null,
141
+ "status": "open",
142
+ "event_type": "Create"
143
+ },
144
+ {
145
+ "id": 613784741773,
146
+ "via": "Web form",
147
+ "via_reference_id": null,
148
+ "priority": null,
149
+ "event_type": "Create"
150
+ },
151
+ {
152
+ "id": 613784741793,
153
+ "via": "Web form",
154
+ "via_reference_id": null,
155
+ "type": null,
156
+ "event_type": "Create"
157
+ },
158
+ {
159
+ "id": 613784741813,
160
+ "via": "Web form",
161
+ "via_reference_id": null,
162
+ "assignee_id": 374673563333,
163
+ "event_type": "Create"
164
+ },
165
+ {
166
+ "id": 613784741833,
167
+ "via": "Web form",
168
+ "via_reference_id": null,
169
+ "group_id": 360003235353,
170
+ "event_type": "Create"
171
+ },
172
+ {
173
+ "id": 613784741853,
174
+ "via": "Web form",
175
+ "via_reference_id": null,
176
+ "organization_id": "360857467053",
177
+ "event_type": "Create"
178
+ }
179
+ ],
180
+ "id": 613784741453,
181
+ "ticket_id": 2,
182
+ "timestamp": 1550645443,
183
+ "created_at": "2019-02-20T06:51:50Z",
184
+ "updater_id": 374673563333,
185
+ "via": "Web form",
186
+ "system": {
187
+ "client": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36",
188
+ "location": "Quang Ngai, 63, Vietnam",
189
+ "latitude": 15.116700000000009,
190
+ "longitude": 108.80000000000001
191
+ },
192
+ "event_type": "Audit"
193
+ },
194
+ {
195
+ "child_events": [
196
+ {
197
+ "id": 613784845113,
198
+ "via": "Web form",
199
+ "via_reference_id": null,
200
+ "comment_present": true,
201
+ "comment_public": true,
202
+ "event_type": "Comment"
203
+ },
204
+ {
205
+ "id": 613784845173,
206
+ "via": "Web form",
207
+ "via_reference_id": null,
208
+ "subject": "ticket2",
209
+ "event_type": "Create"
210
+ },
211
+ {
212
+ "id": 613784845193,
213
+ "via": "Web form",
214
+ "via_reference_id": null,
215
+ "requester_id": 374673563333,
216
+ "event_type": "Create"
217
+ },
218
+ {
219
+ "id": 613784845233,
220
+ "via": "Web form",
221
+ "via_reference_id": null,
222
+ "status": "open",
223
+ "event_type": "Create"
224
+ },
225
+ {
226
+ "id": 613784845253,
227
+ "via": "Web form",
228
+ "via_reference_id": null,
229
+ "priority": null,
230
+ "event_type": "Create"
231
+ },
232
+ {
233
+ "id": 613784845293,
234
+ "via": "Web form",
235
+ "via_reference_id": null,
236
+ "type": null,
237
+ "event_type": "Create"
238
+ },
239
+ {
240
+ "id": 613784845353,
241
+ "via": "Web form",
242
+ "via_reference_id": null,
243
+ "assignee_id": 374673563333,
244
+ "event_type": "Create"
245
+ },
246
+ {
247
+ "id": 613784845393,
248
+ "via": "Web form",
249
+ "via_reference_id": null,
250
+ "group_id": 360003235353,
251
+ "event_type": "Create"
252
+ },
253
+ {
254
+ "id": 613784845433,
255
+ "via": "Web form",
256
+ "via_reference_id": null,
257
+ "organization_id": "360857467053",
258
+ "event_type": "Create"
259
+ }
260
+ ],
261
+ "id": 613784845093,
262
+ "ticket_id": 3,
263
+ "timestamp": 1550645443,
264
+ "created_at": "2019-02-20T06:52:02Z",
265
+ "updater_id": 374673563333,
266
+ "via": "Web form",
267
+ "system": {
268
+ "client": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36",
269
+ "location": "Quang Ngai, 63, Vietnam",
270
+ "latitude": 15.116700000000009,
271
+ "longitude": 108.80000000000001
272
+ },
273
+ "event_type": "Audit"
274
+ }
275
+ ],
276
+ "count": 999,
277
+ "next_page": "https://abc.zendesk.com/api/v2/incremental/ticket_events.json?sort_by=updated_at&start_time=1550645443",
278
+ "end_time": 1550645443
279
+ }