embulk-input-mixpanel 0.5.3 → 0.5.4

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: e5d08021cb9b3e4518546d44eeff78eab3a6e344
4
- data.tar.gz: 55b1de01d58db4f50755996917f7f40fdc0fdd33
3
+ metadata.gz: f5341d3459ab9ebb11548c637781a2e56f8f827d
4
+ data.tar.gz: fddc31638fbfc95d804b140e91a79a880e2fd0c8
5
5
  SHA512:
6
- metadata.gz: 10814321b400f21bfc54acb2005c671265e0fb5a803ab221c7fa5a9dbb02a513a18ea144a1e4dbf9fa92c964b71ca7655f86a2ff866c106df6a5079628b5d3d3
7
- data.tar.gz: 85adb7eeac61dec517c2010300e8fa1a58eb0159c86fbe17d0b34ab12209e774fa15ce4bd425f79d495a087519554b46d0eb07627d03d8e601697b2fa212e275
6
+ metadata.gz: ddd3e72b06554148f5bf7e866823aa3e65004ef317f7a55df269c41499515f8b23b63f4571c565bbe0123871bb1cc0d9451fc25f36939f1f5974737699152730
7
+ data.tar.gz: c59a6e927cb172562d0ecead325d4f8c5359f6bec34f672673abdf9a061b9e7aeecc617f820f99beffed30171fa038a8fa25a917f9bf82e923a49cb9a7405ac8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.5.4 - 2017-08-15
2
+ * [bug] Fix a bug when `fetch_days` is 1 plugin will fetch 2 days instead of 1
3
+
1
4
  ## 0.5.3 - 2017-08-07
2
5
  * [enhancement] Allow user to choose to run incremental or not `incremental` option default to true [#50](https://github.com/treasure-data/embulk-input-mixpanel/pull/50)
3
6
  * [enhancement] Allow user to specify an `incremental_column`, which will be add to the where praramter is API requests[#50](https://github.com/treasure-data/embulk-input-mixpanel/pull/50)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "embulk-input-mixpanel"
3
- spec.version = "0.5.3"
3
+ spec.version = "0.5.4"
4
4
  spec.authors = ["yoshihara", "uu59"]
5
5
  spec.summary = "Mixpanel input plugin for Embulk"
6
6
  spec.description = "Loads records from Mixpanel."
@@ -102,6 +102,7 @@ module Embulk
102
102
  if task[:incremental]
103
103
  task_report = task_reports.first
104
104
  next_to_date = Date.parse(task_report[:to_date])
105
+
105
106
  next_config_diff = {
106
107
  from_date: next_to_date.to_s,
107
108
  latest_fetched_time: task_report[:latest_fetched_time],
@@ -47,7 +47,7 @@ class RangeGenerator
47
47
  end
48
48
 
49
49
  if fetch_days
50
- from_date..(from_date + (fetch_days > 1? fetch_days - 1 : fetch_days))
50
+ from_date..(from_date + fetch_days - 1)
51
51
  else
52
52
  from_date..today
53
53
  end
@@ -314,6 +314,13 @@ module Embulk
314
314
  Mixpanel.transaction(transaction_config(days), &control)
315
315
  end
316
316
 
317
+ def test_next_to_date
318
+ next_config_diff = Mixpanel.resume(transaction_task(1).merge(incremental: true), columns, 1) do
319
+ [{to_date: Date.today.to_s, latest_fetched_time: 1502707247000}]
320
+ end
321
+ assert_equal(Date.today.to_s, next_config_diff[:from_date])
322
+ end
323
+
317
324
  def test_valid_days_with_backfill
318
325
  days = 5
319
326
 
@@ -1,3 +1,4 @@
1
+ require "embulk"
1
2
  module PrepareEmbulk
2
3
  if Embulk.respond_to?(:home)
3
4
  # keep compatibility for Embulk 0.6.x
@@ -7,9 +8,7 @@ module PrepareEmbulk
7
8
  require File.join(classpath_dir, jar)
8
9
  end
9
10
  require "embulk/java/bootstrap"
10
- require "embulk"
11
11
  else
12
- require "embulk"
13
12
  Embulk.setup
14
13
  end
15
14
  end
@@ -30,6 +30,26 @@ class RangeGeneratorTest < Test::Unit::TestCase
30
30
  assert_equal(expected, actual)
31
31
  end
32
32
 
33
+ def test_1_fetch_day
34
+ days = 1
35
+ from = "2017-08-04"
36
+ expected_from = Date.parse(from)
37
+ expected_to = Date.parse("2017-08-04")
38
+ expected = (expected_from..expected_to).to_a.map {|date| date.to_s}
39
+ actual = RangeGenerator.new(from, days).generate_range
40
+ assert_equal(expected, actual)
41
+ end
42
+
43
+ def test_5_fetch_day
44
+ days = 5
45
+ from = "2017-08-04"
46
+ expected_from = Date.parse(from)
47
+ expected_to = Date.parse("2017-08-08")
48
+ expected = (expected_from..expected_to).to_a.map {|date| date.to_s}
49
+ actual = RangeGenerator.new(from, days).generate_range
50
+ assert_equal(expected, actual)
51
+ end
52
+
33
53
  class OverDaysTest < self
34
54
  def setup
35
55
  @from = Date.today - 5
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-mixpanel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - yoshihara
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-08-07 00:00:00.000000000 Z
12
+ date: 2017-08-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: !ruby/object:Gem::Requirement
@@ -224,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
224
224
  version: '0'
225
225
  requirements: []
226
226
  rubyforge_project:
227
- rubygems_version: 2.4.8
227
+ rubygems_version: 2.6.12
228
228
  signing_key:
229
229
  specification_version: 4
230
230
  summary: Mixpanel input plugin for Embulk