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,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": 999,
230
+ "next_page": "https://abc.zendesk.com/api/v2/incremental/tickets.json?sort_by=updated_at&start_time=1551419519",
231
+ "end_time": 1551419519
232
+ }
@@ -0,0 +1,187 @@
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": 1550645510
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:52:02Z",
61
+ "updated_at": "2019-02-20T06:52:02Z",
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": 1550645522
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:52:12Z",
106
+ "updated_at": "2019-02-20T06:52:12Z",
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": 1550645532
137
+ },
138
+ {
139
+ "url": "https://abc.zendesk.com/api/v2/tickets/1001.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": "2011-02-20T07:17:33Z",
151
+ "updated_at": "2011-02-20T07:17:33Z",
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": 1550647060
182
+ }
183
+ ],
184
+ "count": 999,
185
+ "next_page": "https://abc.zendesk.com/api/v2/incremental/tickets.json?sort_by=updated_at&start_time=1550647053",
186
+ "end_time": 1550647053
187
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "id": "5c7f31aef8df240001e60bbf",
5
+ "type": "remove_from_cart",
6
+ "source": "shopify",
7
+ "description": "",
8
+ "authenticated": true,
9
+ "created_at": "2019-03-06T02:34:22Z",
10
+ "received_at": "2019-03-06T02:34:22Z",
11
+ "properties": {
12
+ "model": 221,
13
+ "size": 6
14
+ },
15
+ "user_id": "123123121232"
16
+ }
17
+ ],
18
+ "links": null
19
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "id": "5c7f31aef8df240001e60bbf",
5
+ "type": "remove_from_cart",
6
+ "source": "shopify",
7
+ "description": "",
8
+ "authenticated": true,
9
+ "created_at": "2019-09-06T02:34:22Z",
10
+ "received_at": "2019-09-06T02:34:22Z",
11
+ "properties": {
12
+ "model": 221,
13
+ "size": 6
14
+ },
15
+ "user_id": "123123121232"
16
+ }
17
+ ],
18
+ "links": null
19
+ }