embulk-input-google_analytics 0.1.1 → 0.1.2

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: 122431f951c569688cc1df231944216e766f9356
4
- data.tar.gz: 687477c6f8e0c08853b07e681bd3f3e39e81f876
3
+ metadata.gz: 3ec2cc0b61da3b078e98adbcc7bdfd7376fbfbd5
4
+ data.tar.gz: fd2ab63207a32052d41f5c3b908ca320cb57140c
5
5
  SHA512:
6
- metadata.gz: 226f36d2128a30c5f30da1083c6f9bb63db86bb7cd08a9221c3f55f891fee816bc2e154fcf0e48eadbb9f71c959547ca6c644e3cbebe3fdce5b20fcb5234b9b7
7
- data.tar.gz: 2c1f6b067797788227f46210ba99270d80f6720da43cb97349fa439e7463fadc6b150c05f665ca60e15388cdf57ac4b67d409a5d2da4dc8e9b73e1b55e9f0854
6
+ metadata.gz: cf3075e1127d19fce9594fa56376855e59b2564f654d4a0b1f2bed34539059bdcf0ddf179e273bbcf479cd746eae87a8e563a1daf072b20274c0c68a3e0c8bd9
7
+ data.tar.gz: 2977d85da4a5e3a45894ec48936968c0c825a98a7dc0e9f6ce0c146d1c6f9d6b916b4a9696d6b6fab61c50e3f55fc92267992b6c087a91ce39ab1c05b5ba99e0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.1.2 - 2016-07-13
2
+
3
+ * Fix when `end_date` is nil [#7](https://github.com/treasure-data/embulk-input-google_analytics/pull/7)
4
+
1
5
  ## 0.1.1 - 2016-07-13
2
6
  * Enable scheduled execution [#4](https://github.com/treasure-data/embulk-input-google_analytics/pull/4)
3
7
  * Error handling [#6](https://github.com/treasure-data/embulk-input-google_analytics/pull/6)
@@ -1,7 +1,7 @@
1
1
 
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = "embulk-input-google_analytics"
4
- spec.version = "0.1.1"
4
+ spec.version = "0.1.2"
5
5
  spec.authors = ["uu59"]
6
6
  spec.summary = "Google Analytics input plugin for Embulk"
7
7
  spec.description = "Loads records from Google Analytics."
@@ -120,8 +120,9 @@ module Embulk
120
120
  task_report[:start_date] = fetched_latest_time.strftime("%Y-%m-%d")
121
121
 
122
122
  # if end_date specified as statically YYYY-MM-DD, it will be conflict with start_date (end_date < start_date)
123
- # Modify it as "today" to be safe
124
- if task["end_date"].match(/[0-9]{4}-[0-9]{2}-[0-9]{2}/)
123
+ # Or when end_date is nil, only start_date will be filled on next run but it is illegal API request.
124
+ # Modify end_date as "today" to be safe
125
+ if task["end_date"].nil? || task["end_date"].match(/[0-9]{4}-[0-9]{2}-[0-9]{2}/)
125
126
  task_report[:end_date] = "today" # "today" means now. running at 03:30 AM, will got 3 o'clock data.
126
127
  end
127
128
 
@@ -363,6 +363,24 @@ module Embulk
363
363
  end
364
364
  end
365
365
 
366
+ sub_test_case "end_date is nil" do
367
+ setup do
368
+ @config[:start_date] = nil
369
+ @config[:end_date] = nil
370
+ end
371
+
372
+ test "config_diff will modify" do
373
+ latest_time = Time.parse("2000-01-07")
374
+ plugin = Plugin.new(config, nil, nil, @page_builder)
375
+ expected = {
376
+ start_date: latest_time.strftime("%Y-%m-%d"),
377
+ end_date: "today",
378
+ last_record_time: latest_time.strftime("%Y-%m-%d %H:%M:%S %z"),
379
+ }
380
+ assert_equal expected, plugin.calculate_next_times(latest_time)
381
+ end
382
+ end
383
+
366
384
  sub_test_case "end_date is given as nDaysAgo" do
367
385
  setup do
368
386
  @config[:start_date] = "2000-01-01"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-google_analytics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - uu59