embulk-input-zendesk 0.2.14 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +9 -3
  3. data/.travis.yml +5 -44
  4. data/CHANGELOG.md +3 -0
  5. data/README.md +5 -5
  6. data/build.gradle +123 -0
  7. data/classpath/commons-codec-1.10.jar +0 -0
  8. data/classpath/commons-logging-1.2.jar +0 -0
  9. data/classpath/embulk-input-zendesk-0.3.0.jar +0 -0
  10. data/classpath/httpclient-4.5.6.jar +0 -0
  11. data/classpath/httpcore-4.4.10.jar +0 -0
  12. data/config/checkstyle/checkstyle.xml +128 -0
  13. data/config/checkstyle/default.xml +108 -0
  14. data/gradle/wrapper/gradle-wrapper.jar +0 -0
  15. data/gradle/wrapper/gradle-wrapper.properties +5 -0
  16. data/gradlew +172 -0
  17. data/gradlew.bat +84 -0
  18. data/lib/embulk/guess/zendesk.rb +21 -0
  19. data/lib/embulk/input/zendesk.rb +3 -9
  20. data/src/main/java/org/embulk/input/zendesk/ZendeskInputPlugin.java +471 -0
  21. data/src/main/java/org/embulk/input/zendesk/clients/ZendeskRestClient.java +268 -0
  22. data/src/main/java/org/embulk/input/zendesk/models/AuthenticationMethod.java +23 -0
  23. data/src/main/java/org/embulk/input/zendesk/models/Target.java +46 -0
  24. data/src/main/java/org/embulk/input/zendesk/models/ZendeskException.java +25 -0
  25. data/src/main/java/org/embulk/input/zendesk/services/ZendeskSupportAPIService.java +109 -0
  26. data/src/main/java/org/embulk/input/zendesk/utils/ZendeskConstants.java +61 -0
  27. data/src/main/java/org/embulk/input/zendesk/utils/ZendeskDateUtils.java +51 -0
  28. data/src/main/java/org/embulk/input/zendesk/utils/ZendeskUtils.java +150 -0
  29. data/src/main/java/org/embulk/input/zendesk/utils/ZendeskValidatorUtils.java +92 -0
  30. data/src/test/java/org/embulk/input/zendesk/TestZendeskInputPlugin.java +232 -0
  31. data/src/test/java/org/embulk/input/zendesk/clients/TestZendeskRestClient.java +351 -0
  32. data/src/test/java/org/embulk/input/zendesk/services/TestZendeskSupportAPIService.java +172 -0
  33. data/src/test/java/org/embulk/input/zendesk/utils/TestZendeskDateUtils.java +36 -0
  34. data/src/test/java/org/embulk/input/zendesk/utils/TestZendeskUtil.java +160 -0
  35. data/src/test/java/org/embulk/input/zendesk/utils/TestZendeskValidatorUtils.java +138 -0
  36. data/src/test/java/org/embulk/input/zendesk/utils/ZendeskPluginTestRuntime.java +133 -0
  37. data/src/test/java/org/embulk/input/zendesk/utils/ZendeskTestHelper.java +63 -0
  38. data/src/test/resources/config/base.yml +14 -0
  39. data/src/test/resources/config/base_validator.yml +48 -0
  40. data/src/test/resources/config/incremental.yml +54 -0
  41. data/src/test/resources/config/non-incremental.yml +39 -0
  42. data/src/test/resources/config/util.yml +18 -0
  43. data/src/test/resources/data/client.json +293 -0
  44. data/src/test/resources/data/error_data.json +187 -0
  45. data/src/test/resources/data/expected/ticket_column.json +148 -0
  46. data/src/test/resources/data/expected/ticket_column_with_related_objects.json +152 -0
  47. data/src/test/resources/data/expected/ticket_fields_column.json +92 -0
  48. data/src/test/resources/data/expected/ticket_metrics_column.json +98 -0
  49. data/src/test/resources/data/ticket_fields.json +225 -0
  50. data/src/test/resources/data/ticket_metrics.json +397 -0
  51. data/src/test/resources/data/ticket_with_related_objects.json +67 -0
  52. data/src/test/resources/data/tickets.json +232 -0
  53. data/src/test/resources/data/tickets_continue.json +52 -0
  54. data/src/test/resources/data/util.json +19 -0
  55. data/src/test/resources/data/util_page.json +227 -0
  56. metadata +65 -221
  57. data/.ruby-version +0 -1
  58. data/.travis.yml.erb +0 -43
  59. data/Gemfile +0 -2
  60. data/Rakefile +0 -21
  61. data/embulk-input-zendesk.gemspec +0 -29
  62. data/gemfiles/embulk-0.8.0-latest +0 -4
  63. data/gemfiles/embulk-0.8.1 +0 -4
  64. data/gemfiles/embulk-latest +0 -4
  65. data/gemfiles/template.erb +0 -4
  66. data/lib/embulk/input/zendesk/client.rb +0 -434
  67. data/lib/embulk/input/zendesk/plugin.rb +0 -199
  68. data/test/capture_io.rb +0 -45
  69. data/test/embulk/input/zendesk/test_client.rb +0 -722
  70. data/test/embulk/input/zendesk/test_plugin.rb +0 -628
  71. data/test/fixture_helper.rb +0 -11
  72. data/test/fixtures/invalid_app_marketplace_lack_one_property.yml +0 -13
  73. data/test/fixtures/invalid_app_marketplace_lack_two_property.yml +0 -12
  74. data/test/fixtures/invalid_lack_username.yml +0 -9
  75. data/test/fixtures/invalid_unknown_auth.yml +0 -9
  76. data/test/fixtures/tickets.json +0 -44
  77. data/test/fixtures/valid_app_marketplace.yml +0 -14
  78. data/test/fixtures/valid_auth_basic.yml +0 -11
  79. data/test/fixtures/valid_auth_oauth.yml +0 -10
  80. data/test/fixtures/valid_auth_token.yml +0 -11
  81. data/test/override_assert_raise.rb +0 -21
  82. data/test/run-test.rb +0 -26
@@ -1,11 +0,0 @@
1
- require "pathname"
2
-
3
- module FixtureHelper
4
- def fixture_dir
5
- Pathname.new(__FILE__).dirname.join("fixtures")
6
- end
7
-
8
- def fixture_load(name)
9
- fixture_dir.join(name).read
10
- end
11
- end
@@ -1,13 +0,0 @@
1
- in:
2
- type: zendesk
3
- login_url: "https://example.zendesk.com/"
4
- auth_method: basic
5
- target: tickets
6
- username: foo@example.com
7
- password: password
8
- app_marketplace_integration_name: App Name for Zendesk
9
- app_marketplace_org_id: 12345
10
- columns:
11
- - {name: id, type: string}
12
- out:
13
- type: "null"
@@ -1,12 +0,0 @@
1
- in:
2
- type: zendesk
3
- login_url: "https://example.zendesk.com/"
4
- auth_method: basic
5
- target: tickets
6
- username: foo@example.com
7
- password: password
8
- app_marketplace_integration_name: App Name for Zendesk
9
- columns:
10
- - {name: id, type: string}
11
- out:
12
- type: "null"
@@ -1,9 +0,0 @@
1
- in:
2
- type: zendesk
3
- login_url: "https://example.zendesk.com/"
4
- auth_method: basic
5
- password: password
6
- columns:
7
- - {name: id, type: string}
8
- out:
9
- type: "null"
@@ -1,9 +0,0 @@
1
- in:
2
- type: zendesk
3
- login_url: "https://example.zendesk.com/"
4
- auth_method: blah
5
- password: password
6
- columns:
7
- - {name: id, type: string}
8
- out:
9
- type: "null"
@@ -1,44 +0,0 @@
1
- {"tickets":[{
2
- "id": 35436,
3
- "url": "https://company.zendesk.com/api/v2/tickets/35436.json",
4
- "external_id": "ahg35h3jh",
5
- "created_at": "2009-07-20T22:55:29Z",
6
- "updated_at": "2011-05-05T10:38:52Z",
7
- "type": "incident",
8
- "subject": "Help, my printer is on fire!",
9
- "raw_subject": "{{dc.printer_on_fire}} }{",
10
- "description": "The fire is very colorful.",
11
- "priority": "high",
12
- "status": "open",
13
- "recipient": "support@company.com",
14
- "requester_id": 20978392,
15
- "submitter_id": 76872,
16
- "assignee_id": 235323,
17
- "organization_id": 509974,
18
- "group_id": 21031998,
19
- "collaborator_ids": [35334, 234],
20
- "forum_topic_id": 72648221,
21
- "problem_id": 9873764,
22
- "has_incidents": false,
23
- "due_at": null,
24
- "tags": ["enterprise", "other_tag"],
25
- "via": {
26
- "channel": "web"
27
- },
28
- "custom_fields": [
29
- {
30
- "id": 27642,
31
- "value": "745"
32
- },
33
- {
34
- "id": 27648,
35
- "value": "yes"
36
- }
37
- ],
38
- "satisfaction_rating": {
39
- "id": 1234,
40
- "score": "good",
41
- "comment": "Great support!"
42
- },
43
- "sharing_agreement_ids": [84432]
44
- }]}
@@ -1,14 +0,0 @@
1
- in:
2
- type: zendesk
3
- login_url: "https://example.zendesk.com/"
4
- auth_method: basic
5
- target: tickets
6
- username: foo@example.com
7
- password: password
8
- app_marketplace_integration_name: App Name for Zendesk
9
- app_marketplace_org_id: 12345
10
- app_marketplace_app_id: 99999
11
- columns:
12
- - {name: id, type: string}
13
- out:
14
- type: "null"
@@ -1,11 +0,0 @@
1
- in:
2
- type: zendesk
3
- login_url: "https://example.zendesk.com/"
4
- auth_method: basic
5
- target: tickets
6
- username: foo@example.com
7
- password: password
8
- columns:
9
- - {name: id, type: string}
10
- out:
11
- type: "null"
@@ -1,10 +0,0 @@
1
- in:
2
- type: zendesk
3
- login_url: "https://example.zendesk.com/"
4
- auth_method: oauth
5
- target: tickets
6
- access_token: oauth_token
7
- columns:
8
- - {name: id, type: string}
9
- out:
10
- type: "null"
@@ -1,11 +0,0 @@
1
- in:
2
- type: zendesk
3
- login_url: "https://example.zendesk.com/"
4
- auth_method: token
5
- target: tickets
6
- username: foo@example.com
7
- token: token
8
- columns:
9
- - {name: id, type: string}
10
- out:
11
- type: "null"
@@ -1,21 +0,0 @@
1
- module OverrideAssertRaise
2
- # NOTE: Embulk 0.7.1+ required to raise ConfigError to do as `ConfigError.new("message")`,
3
- # original `assert_raise` method can't catch that, but `begin .. rescue` can.
4
- # So we override assert_raise as below.
5
- def assert_raise(expected_class = StandardError, &block)
6
- begin
7
- block.call
8
- assert_equal expected_class, nil
9
- rescue ::Test::Unit::AssertionFailedError => e
10
- # failed assert raises this Error and that extends StandardError, so rescue it first
11
- raise e
12
- rescue expected_class.class => e
13
- # https://github.com/test-unit/test-unit/issues/94
14
- assert_equal e.message, expected_class.message
15
- rescue expected_class
16
- assert true # passed
17
- rescue => e
18
- assert_equal(expected_class, e.class) # not expected one raised
19
- end
20
- end
21
- end
data/test/run-test.rb DELETED
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- base_dir = File.expand_path(File.join(File.dirname(__FILE__), ".."))
4
- lib_dir = File.join(base_dir, "lib")
5
- test_dir = File.join(base_dir, "test")
6
-
7
- require "test-unit"
8
- require "test/unit/rr"
9
-
10
- $LOAD_PATH.unshift(lib_dir)
11
- $LOAD_PATH.unshift(test_dir)
12
-
13
- ENV["TEST_UNIT_MAX_DIFF_TARGET_STRING_SIZE"] ||= "5000"
14
-
15
- if ENV["COVERAGE"]
16
- if ENV["CI"]
17
- require "codeclimate-test-reporter"
18
- CodeClimate::TestReporter.start
19
- else
20
- require 'simplecov'
21
- SimpleCov.start 'test_frameworks'
22
- end
23
- end
24
-
25
- exit Test::Unit::AutoRunner.run(true, test_dir)
26
-