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": 1550645445,
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": 1550645510,
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": 1550645522,
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": 100,
277
+ "next_page": "https://abc.zendesk.com/api/v2/incremental/ticket_events.json?sort_by=updated_at&start_time=1550645522",
278
+ "end_time": 1550645522
279
+ }
@@ -0,0 +1,232 @@
1
+ {
2
+ "tickets": [
3
+ {
4
+ "url": "https://abc.zendesk.com/api/v2/tickets/2.json",
5
+ "id": 2,
6
+ "external_id": null,
7
+ "via": {
8
+ "channel": "web",
9
+ "source": {
10
+ "from": {},
11
+ "to": {},
12
+ "rel": null
13
+ }
14
+ },
15
+ "created_at": "2019-02-20T06:51:50Z",
16
+ "updated_at": "2019-02-20T06:51:50Z",
17
+ "type": null,
18
+ "subject": "ticket1",
19
+ "raw_subject": "ticket1",
20
+ "description": "ticket1",
21
+ "priority": null,
22
+ "status": "open",
23
+ "recipient": null,
24
+ "requester_id": 374673563333,
25
+ "submitter_id": 374673563333,
26
+ "assignee_id": 374673563333,
27
+ "organization_id": 360857467053,
28
+ "group_id": 360003235353,
29
+ "collaborator_ids": [],
30
+ "follower_ids": [],
31
+ "email_cc_ids": [],
32
+ "forum_topic_id": null,
33
+ "problem_id": null,
34
+ "has_incidents": false,
35
+ "is_public": true,
36
+ "due_at": null,
37
+ "tags": [],
38
+ "custom_fields": [],
39
+ "satisfaction_rating": null,
40
+ "sharing_agreement_ids": [],
41
+ "fields": [],
42
+ "followup_ids": [],
43
+ "brand_id": 360001998013,
44
+ "allow_channelback": false,
45
+ "allow_attachments": true,
46
+ "generated_timestamp": 1551019519
47
+ },
48
+ {
49
+ "url": "https://abc.zendesk.com/api/v2/tickets/3.json",
50
+ "id": 3,
51
+ "external_id": null,
52
+ "via": {
53
+ "channel": "web",
54
+ "source": {
55
+ "from": {},
56
+ "to": {},
57
+ "rel": null
58
+ }
59
+ },
60
+ "created_at": "2019-02-20T06:50:02Z",
61
+ "updated_at": "2019-02-20T06:51:50Z",
62
+ "type": null,
63
+ "subject": "ticket2",
64
+ "raw_subject": "ticket2",
65
+ "description": "ticket2",
66
+ "priority": null,
67
+ "status": "open",
68
+ "recipient": null,
69
+ "requester_id": 374673563333,
70
+ "submitter_id": 374673563333,
71
+ "assignee_id": 374673563333,
72
+ "organization_id": 360857467053,
73
+ "group_id": 360003235353,
74
+ "collaborator_ids": [],
75
+ "follower_ids": [],
76
+ "email_cc_ids": [],
77
+ "forum_topic_id": null,
78
+ "problem_id": null,
79
+ "has_incidents": false,
80
+ "is_public": true,
81
+ "due_at": null,
82
+ "tags": [],
83
+ "custom_fields": [],
84
+ "satisfaction_rating": null,
85
+ "sharing_agreement_ids": [],
86
+ "fields": [],
87
+ "followup_ids": [],
88
+ "brand_id": 360001998013,
89
+ "allow_channelback": false,
90
+ "allow_attachments": true,
91
+ "generated_timestamp": 1551409519
92
+ },
93
+ {
94
+ "url": "https://abc.zendesk.com/api/v2/tickets/4.json",
95
+ "id": 4,
96
+ "external_id": null,
97
+ "via": {
98
+ "channel": "web",
99
+ "source": {
100
+ "from": {},
101
+ "to": {},
102
+ "rel": null
103
+ }
104
+ },
105
+ "created_at": "2019-02-20T06:50:12Z",
106
+ "updated_at": "2019-02-20T06:51:50Z",
107
+ "type": null,
108
+ "subject": "ticket3",
109
+ "raw_subject": "ticket3",
110
+ "description": "ticket3",
111
+ "priority": null,
112
+ "status": "open",
113
+ "recipient": null,
114
+ "requester_id": 374673563333,
115
+ "submitter_id": 374673563333,
116
+ "assignee_id": 374673563333,
117
+ "organization_id": 360857467053,
118
+ "group_id": 360003235353,
119
+ "collaborator_ids": [],
120
+ "follower_ids": [],
121
+ "email_cc_ids": [],
122
+ "forum_topic_id": null,
123
+ "problem_id": null,
124
+ "has_incidents": false,
125
+ "is_public": true,
126
+ "due_at": null,
127
+ "tags": [],
128
+ "custom_fields": [],
129
+ "satisfaction_rating": null,
130
+ "sharing_agreement_ids": [],
131
+ "fields": [],
132
+ "followup_ids": [],
133
+ "brand_id": 360001998013,
134
+ "allow_channelback": false,
135
+ "allow_attachments": true,
136
+ "generated_timestamp": 1551409519
137
+ },
138
+ {
139
+ "url": "https://abc.zendesk.com/api/v2/tickets/1002.json",
140
+ "id": 1002,
141
+ "external_id": null,
142
+ "via": {
143
+ "channel": "api",
144
+ "source": {
145
+ "from": {},
146
+ "to": {},
147
+ "rel": null
148
+ }
149
+ },
150
+ "created_at": "2019-02-20T06:17:33Z",
151
+ "updated_at": "2019-02-20T06:51:50Z",
152
+ "type": null,
153
+ "subject": "Help!",
154
+ "raw_subject": "Help!",
155
+ "description": "Help I need somebody.",
156
+ "priority": null,
157
+ "status": "open",
158
+ "recipient": null,
159
+ "requester_id": 374673563333,
160
+ "submitter_id": 374673563333,
161
+ "assignee_id": 374673563333,
162
+ "organization_id": 360857467053,
163
+ "group_id": 360003235353,
164
+ "collaborator_ids": [],
165
+ "follower_ids": [],
166
+ "email_cc_ids": [],
167
+ "forum_topic_id": null,
168
+ "problem_id": null,
169
+ "has_incidents": false,
170
+ "is_public": true,
171
+ "due_at": null,
172
+ "tags": [],
173
+ "custom_fields": [],
174
+ "satisfaction_rating": null,
175
+ "sharing_agreement_ids": [],
176
+ "fields": [],
177
+ "followup_ids": [],
178
+ "brand_id": 360001998013,
179
+ "allow_channelback": false,
180
+ "allow_attachments": true,
181
+ "generated_timestamp": 1551319519
182
+ },
183
+ {
184
+ "url": "https://abc.zendesk.com/api/v2/tickets/1002.json",
185
+ "id": 1002,
186
+ "external_id": null,
187
+ "via": {
188
+ "channel": "api",
189
+ "source": {
190
+ "from": {},
191
+ "to": {},
192
+ "rel": null
193
+ }
194
+ },
195
+ "created_at": "2019-02-20T06:17:33Z",
196
+ "updated_at": "2019-02-20T06:51:50Z",
197
+ "type": null,
198
+ "subject": "Help!",
199
+ "raw_subject": "Help!",
200
+ "description": "Help I need somebody.",
201
+ "priority": null,
202
+ "status": "open",
203
+ "recipient": null,
204
+ "requester_id": 374673563333,
205
+ "submitter_id": 374673563333,
206
+ "assignee_id": 374673563333,
207
+ "organization_id": 360857467053,
208
+ "group_id": 360003235353,
209
+ "collaborator_ids": [],
210
+ "follower_ids": [],
211
+ "email_cc_ids": [],
212
+ "forum_topic_id": null,
213
+ "problem_id": null,
214
+ "has_incidents": false,
215
+ "is_public": true,
216
+ "due_at": null,
217
+ "tags": [],
218
+ "custom_fields": [],
219
+ "satisfaction_rating": null,
220
+ "sharing_agreement_ids": [],
221
+ "fields": [],
222
+ "followup_ids": [],
223
+ "brand_id": 360001998013,
224
+ "allow_channelback": false,
225
+ "allow_attachments": true,
226
+ "generated_timestamp": 1551419419
227
+ }
228
+ ],
229
+ "count": 1001,
230
+ "next_page": "https://abc.zendesk.com/api/v2/incremental/tickets.json?sort_by=updated_at&start_time=1551419519",
231
+ "end_time": 1551419519
232
+ }