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,24 @@
1
+ type: zendesk
2
+ login_url: https://abc.zendesk.com
3
+ auth_method: oauth
4
+ username: dummy
5
+ password: dummy
6
+ token: dummy
7
+ access_token: dummy
8
+ target: object_records
9
+ app_marketplace_integration_name: abc
10
+ app_marketplace_app_id: abc
11
+ app_marketplace_org_id: abc
12
+ incremental: true
13
+ retry_initial_wait_sec: 1
14
+ max_retry_wait_sec: 30
15
+ retry_limit: 2
16
+ object_types: ['account', 'user']
17
+ columns:
18
+ - {name: type, type: string}
19
+ - {name: id, type: long}
20
+ - {name: external_id, type: string}
21
+ - {name: attributes, type: json}
22
+ - {name: created_at, type: timestamp, format: '%Y-%m-%dT%H:%M:%S%z'}
23
+ - {name: updated_at, type: timestamp, format: '%Y-%m-%dT%H:%M:%S%z'}
24
+ - {name: account, type: json}
@@ -0,0 +1,23 @@
1
+ type: zendesk
2
+ login_url: https://abc.zendesk.com
3
+ auth_method: oauth
4
+ username: dummy
5
+ password: dummy
6
+ token: dummy
7
+ access_token: dummy
8
+ target: relationship_records
9
+ app_marketplace_integration_name: abc
10
+ app_marketplace_app_id: abc
11
+ app_marketplace_org_id: abc
12
+ incremental: true
13
+ retry_initial_wait_sec: 1
14
+ max_retry_wait_sec: 30
15
+ retry_limit: 2
16
+ relationship_types: [ticket_to_account]
17
+ columns:
18
+ - {name: id, type: long}
19
+ - {name: relationship_type, type: string}
20
+ - {name: source, type: string}
21
+ - {name: target, type: string}
22
+ - {name: created_at, type: timestamp, format: '%Y-%m-%dT%H:%M:%S%z'}
23
+ - {name: account, type: json}
@@ -0,0 +1,29 @@
1
+ type: zendesk
2
+ login_url: https://abc.zendesk.com
3
+ auth_method: oauth
4
+ username: dummy
5
+ password: dummy
6
+ token: dummy
7
+ access_token: dummy
8
+ target: user_events
9
+ app_marketplace_integration_name: abc
10
+ app_marketplace_app_id: abc
11
+ app_marketplace_org_id: abc
12
+ incremental: true
13
+ retry_initial_wait_sec: 1
14
+ dedup: false
15
+ max_retry_wait_sec: 30
16
+ retry_limit: 2
17
+ profile_source: support
18
+ start_time: '2019-01-20T07:14:50Z'
19
+ end_time: '2019-06-20T07:14:53Z'
20
+ columns:
21
+ - {name: id, type: string}
22
+ - {name: type, type: string}
23
+ - {name: source, type: string}
24
+ - {name: description, type: string}
25
+ - {name: authenticated, type: boolean}
26
+ - {name: created_at, type: timestamp, format: '%Y-%m-%dT%H:%M:%S%z'}
27
+ - {name: received_at, type: timestamp, format: '%Y-%m-%dT%H:%M:%S%z'}
28
+ - {name: properties, type: json}
29
+ - {name: user_id, type: string}
File without changes
@@ -0,0 +1,7 @@
1
+ {
2
+ "tickets": [],
3
+ "count": 0,
4
+ "metric_sets": [],
5
+ "next_page": null,
6
+ "end_time": null
7
+ }
@@ -0,0 +1,40 @@
1
+ [
2
+ {
3
+ "name": "id",
4
+ "type": "string"
5
+ },
6
+ {
7
+ "name": "type",
8
+ "type": "string"
9
+ },
10
+ {
11
+ "name": "source",
12
+ "type": "string"
13
+ },
14
+ {
15
+ "name": "description",
16
+ "type": "string"
17
+ },
18
+ {
19
+ "name": "authenticated",
20
+ "type": "boolean"
21
+ },
22
+ {
23
+ "name": "created_at",
24
+ "type": "timestamp",
25
+ "format": "%Y-%m-%dT%H:%M:%S%z"
26
+ },
27
+ {
28
+ "name": "received_at",
29
+ "type": "timestamp",
30
+ "format": "%Y-%m-%dT%H:%M:%S%z"
31
+ },
32
+ {
33
+ "name": "properties",
34
+ "type": "json"
35
+ },
36
+ {
37
+ "name": "user_id",
38
+ "type": "string"
39
+ }
40
+ ]
@@ -0,0 +1,30 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "type": "account",
5
+ "id": "915a64d3-23d4-11e9-b8c1-9919f66bb73a",
6
+ "external_id": null,
7
+ "attributes": {
8
+ "account_id": 13,
9
+ "account_name": "ABC"
10
+ },
11
+ "created_at": "2019-01-29T14:45:49.017Z",
12
+ "updated_at": "2019-02-12T18:00:03.000Z"
13
+ },
14
+ {
15
+ "type": "account",
16
+ "id": "8e7caeee-2ecd-11e9-843d-27ae307b8995",
17
+ "external_id": null,
18
+ "attributes": {
19
+ "account_id": 13,
20
+ "account_name": "Wish"
21
+ },
22
+ "created_at": "2019-02-12T13:53:20.522Z",
23
+ "updated_at": "2019-02-12T13:53:21.000Z"
24
+ }
25
+ ],
26
+ "links": {
27
+ "previous": null,
28
+ "next": null
29
+ }
30
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "organizations": [
3
+ {
4
+ "url": "https://abc.zendesk.com/api/v2/organizations/360857467053.json",
5
+ "id": 360857467053,
6
+ "name": "asdasd",
7
+ "shared_tickets": false,
8
+ "shared_comments": false,
9
+ "external_id": null,
10
+ "created_at": "2019-02-20T06:50:45Z",
11
+ "updated_at": "2019-02-28T10:33:21Z",
12
+ "domain_names": [],
13
+ "details": "",
14
+ "notes": "",
15
+ "group_id": null,
16
+ "tags": [],
17
+ "organization_fields": {}
18
+ },
19
+ {
20
+ "url": "https://abc.zendesk.com/api/v2/organizations/360857467055.json",
21
+ "id": 360857467055,
22
+ "name": "asdasd",
23
+ "shared_tickets": false,
24
+ "shared_comments": false,
25
+ "external_id": null,
26
+ "created_at": "2019-02-20T06:50:45Z",
27
+ "updated_at": "2019-02-28T10:33:21Z",
28
+ "domain_names": [],
29
+ "details": "",
30
+ "notes": "",
31
+ "group_id": null,
32
+ "tags": [],
33
+ "organization_fields": {}
34
+ }
35
+ ],
36
+ "next_page": null,
37
+ "previous_page": null,
38
+ "count": 2
39
+ }
@@ -0,0 +1,57 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "id": "5f0e0e84-2b9c-11e9-8c61-bd1747d6bf7e",
5
+ "relationship_type": "ticket_to_account",
6
+ "source": "915a64d3-23d4-11e9-b8c1-9919f66bb73a",
7
+ "target": "zen:ticket:31",
8
+ "created_at": "2019-02-08T12:23:42.116Z"
9
+ },
10
+ {
11
+ "id": "4cb9289e-2ba2-11e9-99f5-e365e7236130",
12
+ "relationship_type": "ticket_to_account",
13
+ "source": "915a64d3-23d4-11e9-b8c1-9919f66bb73a",
14
+ "target": "zen:ticket:33",
15
+ "created_at": "2019-02-08T13:06:08.341Z"
16
+ },
17
+ {
18
+ "id": "3fce97e8-2ba6-11e9-8c61-6d534711f65b",
19
+ "relationship_type": "ticket_to_account",
20
+ "source": "915a64d3-23d4-11e9-b8c1-9919f66bb73a",
21
+ "target": "zen:ticket:34",
22
+ "created_at": "2019-02-08T13:34:24.658Z"
23
+ },
24
+ {
25
+ "id": "fe79c804-2ba6-11e9-8c61-b7b361f9963d",
26
+ "relationship_type": "ticket_to_account",
27
+ "source": "915a64d3-23d4-11e9-b8c1-9919f66bb73a",
28
+ "target": "zen:ticket:35",
29
+ "created_at": "2019-02-08T13:39:44.547Z"
30
+ },
31
+ {
32
+ "id": "e55f2ed6-2e12-11e9-8c61-0f7cf5995923",
33
+ "relationship_type": "ticket_to_account",
34
+ "source": "915a64d3-23d4-11e9-b8c1-9919f66bb73a",
35
+ "target": "zen:ticket:36",
36
+ "created_at": "2019-02-11T15:37:10.402Z"
37
+ },
38
+ {
39
+ "id": "6464bc61-2e9c-11e9-99f5-ed731bcb6084",
40
+ "relationship_type": "ticket_to_account",
41
+ "source": "915a64d3-23d4-11e9-b8c1-9919f66bb73a",
42
+ "target": "zen:ticket:37",
43
+ "created_at": "2019-02-12T08:01:24.561Z"
44
+ },
45
+ {
46
+ "id": "9b4a091e-2ecb-11e9-843d-4d0e9472c338",
47
+ "relationship_type": "ticket_to_account",
48
+ "source": "915a64d3-23d4-11e9-b8c1-9919f66bb73a",
49
+ "target": "zen:ticket:39",
50
+ "created_at": "2019-02-12T13:39:23.007Z"
51
+ }
52
+ ],
53
+ "links": {
54
+ "previous": null,
55
+ "next": null
56
+ }
57
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "responses": [
3
+ {
4
+ "id": 360003359234,
5
+ "survey_id": 360000012233,
6
+ "delivery_id": 360000156034,
7
+ "recipient_id": 360061097853,
8
+ "user_id": 378157424634,
9
+ "rating": 9,
10
+ "comment": "testing purpose",
11
+ "delivered_at": "2019-01-16T10:33:35.000Z",
12
+ "rated_at": "2019-01-16T12:47:50.000Z",
13
+ "user_email": "dummy@gmail.com",
14
+ "user_name": "dummy",
15
+ "survey_name": "abc"
16
+ }
17
+ ],
18
+ "next_page": "https://abc.zendesk.com/api/v2/nps/incremental/responses.json?start_time=1555418870",
19
+ "count": 1,
20
+ "end_time": 1555418870
21
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "responses": [
3
+ {
4
+ "id": 360003359233,
5
+ "survey_id": 360000012233,
6
+ "delivery_id": 360000156034,
7
+ "recipient_id": 360061097853,
8
+ "user_id": 378157424634,
9
+ "rating": 9,
10
+ "comment": "testing purpose",
11
+ "delivered_at": "2019-01-16T10:33:35.000Z",
12
+ "rated_at": "2019-01-16T12:47:00.000Z",
13
+ "user_email": "dummy@gmail.com",
14
+ "user_name": "dummy",
15
+ "survey_name": "abc"
16
+ },
17
+ {
18
+ "id": 3600033592335,
19
+ "survey_id": 360000012233,
20
+ "delivery_id": 360000156034,
21
+ "recipient_id": 360061097853,
22
+ "user_id": 378157424634,
23
+ "rating": 9,
24
+ "comment": "testing purpose",
25
+ "delivered_at": "2019-01-16T10:33:35.000Z",
26
+ "rated_at": "2019-01-16T12:47:00.000Z",
27
+ "user_email": "dummy@gmail.com",
28
+ "user_name": "dummy",
29
+ "survey_name": "abc"
30
+ }
31
+ ],
32
+ "next_page": "https://abc.zendesk.com/api/v2/nps/incremental/responses.json?start_time=1555418820",
33
+ "count": 1000,
34
+ "end_time": 1555418820
35
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "responses": [
3
+ {
4
+ "id": 360003359233,
5
+ "survey_id": 360000012233,
6
+ "delivery_id": 360000156034,
7
+ "recipient_id": 360061097853,
8
+ "user_id": 378157424634,
9
+ "rating": 9,
10
+ "comment": "testing purpose",
11
+ "delivered_at": "2019-01-16T10:33:35.000Z",
12
+ "rated_at": "2019-01-16T12:47:00.000Z",
13
+ "user_email": "dummy@gmail.com",
14
+ "user_name": "dummy",
15
+ "survey_name": "abc"
16
+ },
17
+ {
18
+ "id": 3600033592335,
19
+ "survey_id": 360000012233,
20
+ "delivery_id": 360000156034,
21
+ "recipient_id": 360061097853,
22
+ "user_id": 378157424634,
23
+ "rating": 9,
24
+ "comment": "testing purpose",
25
+ "delivered_at": "2019-01-16T10:33:35.000Z",
26
+ "rated_at": "2019-01-16T12:47:00.000Z",
27
+ "user_email": "dummy@gmail.com",
28
+ "user_name": "dummy",
29
+ "survey_name": "abc"
30
+ }
31
+ ],
32
+ "next_page": "https://abc.zendesk.com/api/v2/nps/incremental/responses.json?start_time=1555418820",
33
+ "count": 999,
34
+ "end_time": 1555418820
35
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "organizations": [
3
+ {
4
+ "url": "https://abc.zendesk.com/api/v2/organizations/360857467053.json",
5
+ "id": 360857467053,
6
+ "name": "利用端末�",
7
+ "shared_tickets": false,
8
+ "shared_comments": false,
9
+ "external_id": null,
10
+ "created_at": "2019-02-20T06:50:45Z",
11
+ "updated_at": "2019-02-28T10:33:21Z",
12
+ "domain_names": [],
13
+ "details": "",
14
+ "notes": "",
15
+ "group_id": null,
16
+ "tags": [],
17
+ "organization_fields": {}
18
+ }
19
+ ],
20
+ "next_page": null,
21
+ "previous_page": null,
22
+ "count": 1
23
+ }
@@ -0,0 +1,50 @@
1
+ {
2
+ "users": [
3
+ {
4
+ "id": 1194092277,
5
+ "url": "https://abc.zendesk.com/api/v2/users/1194094177.json",
6
+ "name": "dummy1",
7
+ "email": "dummy1@gmail.com",
8
+ "created_at": "2015-08-11T02:38:14Z",
9
+ "updated_at": "2019-03-11T07:22:57Z",
10
+ "time_zone": "Tokyo",
11
+ "iana_time_zone": "Asia/Tokyo",
12
+ "phone": null,
13
+ "shared_phone_number": null,
14
+ "photo": null,
15
+ "locale_id": 1,
16
+ "locale": "en-US",
17
+ "organization_id": 2277302588,
18
+ "role": "admin",
19
+ "verified": true,
20
+ "external_id": "1",
21
+ "tags": [],
22
+ "alias": null,
23
+ "active": true,
24
+ "shared": false,
25
+ "shared_agent": false,
26
+ "last_login_at": "2018-11-05T21:52:18Z",
27
+ "two_factor_auth_enabled": null,
28
+ "signature": null,
29
+ "details": "",
30
+ "notes": "",
31
+ "role_type": null,
32
+ "custom_role_id": null,
33
+ "moderator": true,
34
+ "ticket_restriction": null,
35
+ "only_private_comments": false,
36
+ "restricted_agent": false,
37
+ "suspended": false,
38
+ "chat_only": false,
39
+ "default_group_id": 26191487,
40
+ "report_csv": true,
41
+ "user_fields": {
42
+ "account_id": null,
43
+ "datacenter_aws": false
44
+ }
45
+ }
46
+ ],
47
+ "next_page": null,
48
+ "previous_page": null,
49
+ "count": 1
50
+ }
@@ -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
+ }