embulk-input-google_analytics 0.1.3 → 0.1.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: 5d3324d9256b97a4edd184262d0f2dc3dc2f89de
4
- data.tar.gz: 00702b551777df80b496395274b97a4cd1e21da7
3
+ metadata.gz: 45cf305036e0b44cbd5f8dc0327280406b9f541b
4
+ data.tar.gz: 357797127e74378167f8ef27cf0e10d2a5c4223e
5
5
  SHA512:
6
- metadata.gz: 9caa9caea04f155c084b07339d8f2e1a29c1050c79048115c98ec6db2507b58ae643168140dc0be1cd259692e8c0107994151c84d0798170258082906445edf9
7
- data.tar.gz: edc535541bd7ef54f5335fbda215d4d7efe7bd8176246cf2a1723a6bd32b62b8405b3317660ecca0790620053a42ecd5cc79f5e1fea40c2d85a421e6b07cdee3
6
+ metadata.gz: b5417ea74d3e6a700a0f42edc4558ca7a4fe5e56024aa79f9c49c8122c96acbb7519697805fed62d8fde13989a176dd00dc35bee3337fd9549b3b746bf42ae30
7
+ data.tar.gz: 6fec758e1ee78ca9e4055060bca8caef42ac3be47d97ef0623d7790135c40bf945627618ac92507a16da029a4760043db7cdec41a91507ec390a9dbec7ddf8a9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.1.4 - 2016-08-19
2
+ * Always add `view_id` into records [#9](https://github.com/treasure-data/embulk-input-google_analytics/pull/9)
3
+
1
4
  ## 0.1.3 - 2016-08-15
2
5
  * Use net/http to avoid TLS error [#8](https://github.com/treasure-data/embulk-input-google_analytics/pull/8)
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.3"
4
+ spec.version = "0.1.4"
5
5
  spec.authors = ["uu59"]
6
6
  spec.summary = "Google Analytics input plugin for Embulk"
7
7
  spec.description = "Loads records from Google Analytics."
@@ -54,6 +54,7 @@ module Embulk
54
54
  raw_time = format_row[task["time_series"]]
55
55
  next if too_early_data?(raw_time)
56
56
  format_row[task["time_series"]] = time_parse_with_profile_timezone(raw_time)
57
+ format_row["view_id"] = view_id
57
58
  block.call format_row
58
59
  end
59
60
 
@@ -36,6 +36,8 @@ module Embulk
36
36
  Column.new(nil, canonicalize_column_name(col_name), col_type)
37
37
  end
38
38
 
39
+ columns << Column.new(nil, "view_id", :string)
40
+
39
41
  resume(task, columns, 1, &control)
40
42
  end
41
43
 
@@ -81,7 +83,7 @@ module Embulk
81
83
 
82
84
  def run
83
85
  client = Client.new(task, preview?)
84
- columns = self.class.columns_from_task(task)
86
+ columns = self.class.columns_from_task(task) + ["view_id"]
85
87
 
86
88
  last_record_time = task["last_record_time"] ? Time.parse(task["last_record_time"]) : nil
87
89
 
@@ -271,7 +271,8 @@ module Embulk
271
271
  sub_test_case "each_report_row" do
272
272
  setup do
273
273
  conf = valid_config["in"]
274
- @client = Client.new(task(embulk_config(conf)))
274
+ @task = task(embulk_config(conf))
275
+ @client = Client.new(@task)
275
276
  stub(@client).get_profile { {timezone: "Asia/Tokyo"} }
276
277
  @logger = Logger.new(File::NULL)
277
278
  stub(Embulk).logger { @logger }
@@ -290,18 +291,21 @@ module Embulk
290
291
  "ga:browser" => "curl",
291
292
  "ga:visits" => "1",
292
293
  "ga:pageviews" => "1",
294
+ "view_id" => @task["view_id"],
293
295
  },
294
296
  {
295
297
  "ga:dateHour" => @client.time_parse_with_profile_timezone("2016060121"),
296
298
  "ga:browser" => "curl",
297
299
  "ga:visits" => "2",
298
300
  "ga:pageviews" => "2",
301
+ "view_id" => @task["view_id"],
299
302
  },
300
303
  {
301
304
  "ga:dateHour" => @client.time_parse_with_profile_timezone("2016060122"),
302
305
  "ga:browser" => "curl",
303
306
  "ga:visits" => "3",
304
307
  "ga:pageviews" => "3",
308
+ "view_id" => @task["view_id"],
305
309
  },
306
310
  ]
307
311
  assert_equal expected, fetched_rows
@@ -40,6 +40,7 @@ module Embulk
40
40
  Embulk::Column.new(nil, "browser", :string),
41
41
  Embulk::Column.new(nil, "visits", :long),
42
42
  Embulk::Column.new(nil, "pageviews", :long),
43
+ Embulk::Column.new(nil, "view_id", :string),
43
44
  ]
44
45
  mock(Plugin).resume(anything, columns, 1)
45
46
  Plugin.transaction(embulk_config(valid_config["in"]))
@@ -115,6 +116,7 @@ module Embulk
115
116
  Column.new(nil, "ctr", :double),
116
117
  Column.new(nil, "visits", :long),
117
118
  Column.new(nil, "items_per_purchase", :double),
119
+ Column.new(nil, "view_id", :string),
118
120
  ]
119
121
 
120
122
  mock(Plugin).resume(anything, expected_columns, anything)
@@ -152,7 +154,7 @@ module Embulk
152
154
  end
153
155
  end
154
156
 
155
- mock(@page_builder).add([time, "wget", 3, 4])
157
+ mock(@page_builder).add([time, "wget", 3, 4, nil]) # nil for view_id
156
158
  mock(@page_builder).finish
157
159
  @plugin.run
158
160
  end
@@ -209,7 +211,7 @@ module Embulk
209
211
  end
210
212
  end
211
213
 
212
- mock(@page_builder).add([time, "wget", 3, 4])
214
+ mock(@page_builder).add([time, "wget", 3, 4, nil]) # nil for view_id
213
215
  mock(@page_builder).finish
214
216
  @plugin.run
215
217
  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.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - uu59
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-15 00:00:00.000000000 Z
11
+ date: 2016-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement