embulk-input-zendesk 0.2.11 → 0.2.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4bbd52d83f9670fdf5c7bad8bb916bbce2d2539c
4
- data.tar.gz: 3ede177aa9ffe5d102a6bb68e62a256a209c68d6
3
+ metadata.gz: 873a74eb71d079359c4e2134e08bd0b9972477a6
4
+ data.tar.gz: 6a8c70921ab79299a8e10d77dd9bcb034033384c
5
5
  SHA512:
6
- metadata.gz: 8fe16f902ee028b8f13237f4bd8784ded62e96df33527da4459cd59044212193d1994b8d8129b8a008e7bb76ec099e04a69e8fc8fd7e4134889c65593f53fb13
7
- data.tar.gz: 08d9ada788c89cb5eb1beabd3462b7a1731965e2ecd4171b4bc781de3621a1ac95ab7d4fa1b5b935a5d678b63346f37be46b83950a555f14fc885044cff45a44
6
+ metadata.gz: baa602ab6ed0a7c33ee34fe7d200f9ea2680c1a41f5c2503ea94fc0e32f69b14571f2e45e7e85a548c06741daa63ccffa227953502add3e2503d76cbb9813f4d
7
+ data.tar.gz: 6aae5b2d71285613c3e89bba77244385b2854afe60c4e12104f098954f7ad82ba30cd2604fa77f0e8483391fd996cc3094ccaaf89627495b00cf459a49b57a09
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.2.12 - 2019-01-04
2
+ * [enhancement] Fix performance issue [#47](https://github.com/treasure-data/embulk-input-zendesk/pull/47)
3
+
1
4
  ## 0.2.11 - 2018-15-26
2
5
  * [enhancement] Rate limit is fail fast instead of retry for guess/preview mode
3
6
 
@@ -1,7 +1,7 @@
1
1
 
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = "embulk-input-zendesk"
4
- spec.version = "0.2.11"
4
+ spec.version = "0.2.12"
5
5
  spec.authors = ["uu59", "muga", "sakama"]
6
6
  spec.summary = "Zendesk input plugin for Embulk"
7
7
  spec.description = "Loads records from Zendesk."
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.add_dependency 'httpclient'
18
18
  spec.add_dependency 'concurrent-ruby'
19
19
  spec.add_development_dependency 'embulk', ['~> 0.8.1']
20
- spec.add_development_dependency 'bundler', ['~> 1.0']
20
+ spec.add_development_dependency 'bundler', ['~> 1.0', '< 2.0']
21
21
  spec.add_development_dependency 'rake', ['>= 10.0']
22
22
  spec.add_development_dependency 'pry'
23
23
  spec.add_development_dependency 'test-unit', '~> 3.1.5'
@@ -1,6 +1,7 @@
1
1
  require "strscan"
2
2
  require "httpclient"
3
3
  require 'concurrent'
4
+ require 'set'
4
5
 
5
6
  module Embulk
6
7
  module Input
@@ -83,7 +84,7 @@ module Embulk
83
84
  %w(tickets ticket_events users organizations).each do |target|
84
85
  define_method(target) do |partial = true, start_time = 0, &block|
85
86
  # Always use incremental_export. There is some difference between incremental_export and export.
86
- incremental_export("/api/v2/incremental/#{target}.json", target, start_time, [], partial, &block)
87
+ incremental_export("/api/v2/incremental/#{target}.json", target, start_time, Set.new, partial, &block)
87
88
  end
88
89
  end
89
90
 
@@ -97,7 +98,7 @@ module Embulk
97
98
  # Since partial is only use for preview and guess so this should be fine
98
99
  export('/api/v2/ticket_metrics.json', 'ticket_metrics', &block)
99
100
  else
100
- incremental_export('/api/v2/incremental/tickets.json', 'metric_sets', start_time, [], partial, { include: 'metric_sets' }, &block)
101
+ incremental_export('/api/v2/incremental/tickets.json', 'metric_sets', start_time, Set.new, partial, { include: 'metric_sets' }, &block)
101
102
  end
102
103
  end
103
104
 
@@ -174,7 +175,7 @@ module Embulk
174
175
  end
175
176
  end
176
177
 
177
- def incremental_export(path, key, start_time = 0, known_ids = [], partial = true, query = {}, &block)
178
+ def incremental_export(path, key, start_time = 0, known_ids = Set.new, partial = true, query = {}, &block)
178
179
  if partial
179
180
  records = request_partial(path, query.merge(start_time: start_time)).first(5)
180
181
  records.uniq{|r| r["id"]}.each do |record|
@@ -1,6 +1,7 @@
1
1
  require "embulk"
2
2
  Embulk.setup
3
3
 
4
+ require "set"
4
5
  require "yaml"
5
6
  require "embulk/input/zendesk"
6
7
  require "override_assert_raise"
@@ -258,12 +259,12 @@ module Embulk
258
259
 
259
260
  sub_test_case "ticket_events" do
260
261
  test "invoke incremental_export when partial=true" do
261
- mock(client).incremental_export(anything, "ticket_events", anything, [], true)
262
+ mock(client).incremental_export(anything, "ticket_events", anything, Set.new, true)
262
263
  client.ticket_events(true)
263
264
  end
264
265
 
265
266
  test "invoke incremental_export when partial=false" do
266
- mock(client).incremental_export(anything, "ticket_events", anything, [], false)
267
+ mock(client).incremental_export(anything, "ticket_events", anything, Set.new, false)
267
268
  client.ticket_events(false)
268
269
  end
269
270
  end
@@ -379,7 +379,7 @@ module Embulk
379
379
 
380
380
  test "call ticket_all method instead of tickets" do
381
381
  mock(@client).export.never
382
- mock(@client).incremental_export(anything, "tickets", 0, [], false) { [] }
382
+ mock(@client).incremental_export(anything, "tickets", 0, Set.new, false) { [] }
383
383
  mock(page_builder).finish
384
384
 
385
385
  @plugin.run
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-zendesk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.11
4
+ version: 0.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - uu59
@@ -74,6 +74,9 @@ dependencies:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
76
  version: '1.0'
77
+ - - "<"
78
+ - !ruby/object:Gem::Version
79
+ version: '2.0'
77
80
  name: bundler
78
81
  prerelease: false
79
82
  type: :development
@@ -82,6 +85,9 @@ dependencies:
82
85
  - - "~>"
83
86
  - !ruby/object:Gem::Version
84
87
  version: '1.0'
88
+ - - "<"
89
+ - !ruby/object:Gem::Version
90
+ version: '2.0'
85
91
  - !ruby/object:Gem::Dependency
86
92
  requirement: !ruby/object:Gem::Requirement
87
93
  requirements: