embulk-input-google_analytics 0.1.9 → 0.1.10

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: 0cf6819cbdb38173f44900cba3223c59a9176d6e
4
- data.tar.gz: 62e041ee887e632aad22de0375b395b42636d0ef
3
+ metadata.gz: d129766efe1174a97720a2c9f1d20d41ceade3a9
4
+ data.tar.gz: 20760966f3ec891bd9ed63230a3fd22c85fa36fb
5
5
  SHA512:
6
- metadata.gz: 5b68652c6e70c2e5b281f7fa7b44d7e24da9c51ffe494915bd90992f0ab28b8bef924ae2d8129e9aae87829705c252d1910ac45498982504ff94d468a4800481
7
- data.tar.gz: 57a3ee3ec80110c89f4b17cb6b87e8f2f80fae2da1f69862e11eece4bab571d1bbf5ca3e457488f31a9f96171bc7ff053e6e57f9837e19c156716e75ca36834b
6
+ metadata.gz: de1f2ef838245c407ad699ae49803f5991f51b7e1912adcd78339f030a1060728fa69e99cca40b17d13c5ce2c8972274ae49d30f84b6028059c5ebab474a7d5a
7
+ data.tar.gz: cd42caf65d6b2a8f7bc98e23d5b5bb22b393b4795b4d16089094f68f39a7794b845f6d9b14bd75f38d58881c556709cee1fbd578fe591db80af5d6ad70c2d6e4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.1.10 - 2016-12-08
2
+ * Logging unexpected time string [#17](https://github.com/treasure-data/embulk-input-google_analytics/pull/17)
3
+
1
4
  ## 0.1.9 - 2016-11-22
2
5
  * Support 'foobarXX' column names [#16](https://github.com/treasure-data/embulk-input-google_analytics/pull/16)
3
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.9"
4
+ spec.version = "0.1.10"
5
5
  spec.authors = ["uu59"]
6
6
  spec.summary = "Google Analytics input plugin for Embulk"
7
7
  spec.description = "Loads records from Google Analytics."
@@ -101,6 +101,10 @@ module Embulk
101
101
  "%Y%m%d"
102
102
  end
103
103
  parts = Date._strptime(time_string, date_format)
104
+ unless parts
105
+ # strptime was failed. Google API returns unexpected date string.
106
+ Embulk.logger.warn("Failed to parse #{task["time_series"]} data. The value is '#{time_string}'(#{time_string.class}) and it doesn't match with '#{date_format}'.")
107
+ end
104
108
 
105
109
  swap_time_zone do
106
110
  Time.zone.local(*parts.values_at(:year, :mon, :mday, :hour)).to_time
@@ -172,6 +172,20 @@ module Embulk
172
172
  assert_equal Time.parse("2016-01-01 22:00:00 -08:00"), time
173
173
  end
174
174
 
175
+ sub_test_case "Logging invalid values" do
176
+ setup do
177
+ @logger = Logger.new(File::NULL)
178
+ stub(Embulk).logger { @logger }
179
+ end
180
+
181
+ test "empty" do
182
+ mock(@logger).warn(%Q|Failed to parse ga:dateHour data. The value is ''(String) and it doesn't match with '%Y%m%d%H'.|)
183
+ assert_raise do
184
+ @client.time_parse_with_profile_timezone("")
185
+ end
186
+ end
187
+ end
188
+
175
189
  def time_series
176
190
  "ga:dateHour"
177
191
  end
@@ -192,6 +206,20 @@ module Embulk
192
206
  assert_equal Time.parse("2016-01-01 00:00:00 PST"), time
193
207
  end
194
208
 
209
+ sub_test_case "Logging invalid values" do
210
+ setup do
211
+ @logger = Logger.new(File::NULL)
212
+ stub(Embulk).logger { @logger }
213
+ end
214
+
215
+ test "empty" do
216
+ mock(@logger).warn(%Q|Failed to parse ga:date data. The value is ''(String) and it doesn't match with '%Y%m%d'.|)
217
+ assert_raise do
218
+ @client.time_parse_with_profile_timezone("")
219
+ end
220
+ end
221
+ end
222
+
195
223
  def time_series
196
224
  "ga:date"
197
225
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-google_analytics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - uu59
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-22 00:00:00.000000000 Z
11
+ date: 2016-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement