embulk-input-google_analytics 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cf6819cbdb38173f44900cba3223c59a9176d6e
|
4
|
+
data.tar.gz: 62e041ee887e632aad22de0375b395b42636d0ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b68652c6e70c2e5b281f7fa7b44d7e24da9c51ffe494915bd90992f0ab28b8bef924ae2d8129e9aae87829705c252d1910ac45498982504ff94d468a4800481
|
7
|
+
data.tar.gz: 57a3ee3ec80110c89f4b17cb6b87e8f2f80fae2da1f69862e11eece4bab571d1bbf5ca3e457488f31a9f96171bc7ff053e6e57f9837e19c156716e75ca36834b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
## 0.1.9 - 2016-11-22
|
2
|
+
* Support 'foobarXX' column names [#16](https://github.com/treasure-data/embulk-input-google_analytics/pull/16)
|
3
|
+
|
1
4
|
## 0.1.8 - 2016-11-09
|
2
5
|
* TIME column should be double, not timestamp. e.g. sessionDuration (thx @kazuya030) [#13](https://github.com/treasure-data/embulk-input-google_analytics/pull/13) [#15](https://github.com/treasure-data/embulk-input-google_analytics/pull/15)
|
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.
|
4
|
+
spec.version = "0.1.9"
|
5
5
|
spec.authors = ["uu59"]
|
6
6
|
spec.summary = "Google Analytics input plugin for Embulk"
|
7
7
|
spec.description = "Loads records from Google Analytics."
|
@@ -122,7 +122,35 @@ module Embulk
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def get_columns_list
|
125
|
-
get_custom_dimensions + get_metadata_columns
|
125
|
+
columns = get_custom_dimensions + get_metadata_columns
|
126
|
+
canonical_column_names(columns)
|
127
|
+
end
|
128
|
+
|
129
|
+
def canonical_column_names(columns)
|
130
|
+
result = []
|
131
|
+
columns.each do |col|
|
132
|
+
if col[:id].match(/XX$/)
|
133
|
+
# for such columns:
|
134
|
+
# https://developers.google.com/analytics/devguides/reporting/core/dimsmets#view=detail&group=content_grouping
|
135
|
+
# https://developers.google.com/analytics/devguides/reporting/metadata/v3/devguide#attributes
|
136
|
+
min = [
|
137
|
+
col[:attributes][:minTemplateIndex],
|
138
|
+
col[:attributes][:premiumMinTemplateIndex],
|
139
|
+
].compact.min
|
140
|
+
max = [
|
141
|
+
col[:attributes][:maxTemplateIndex],
|
142
|
+
col[:attributes][:premiumMaxTemplateIndex],
|
143
|
+
].compact.max
|
144
|
+
|
145
|
+
min.upto(max) do |n|
|
146
|
+
actual_id = col[:id].gsub(/XX$/, n.to_s)
|
147
|
+
result << col.merge(id: actual_id)
|
148
|
+
end
|
149
|
+
else
|
150
|
+
result << col
|
151
|
+
end
|
152
|
+
end
|
153
|
+
result
|
126
154
|
end
|
127
155
|
|
128
156
|
def get_metadata_columns
|
@@ -12,6 +12,28 @@ module Embulk
|
|
12
12
|
include OverrideAssertRaise
|
13
13
|
include FixtureHelper
|
14
14
|
|
15
|
+
sub_test_case "canonical_column_names" do
|
16
|
+
setup do
|
17
|
+
conf = valid_config["in"]
|
18
|
+
@task = task(embulk_config(conf))
|
19
|
+
@client = Client.new(@task)
|
20
|
+
end
|
21
|
+
|
22
|
+
test "XX column names should be expanded" do
|
23
|
+
columns = @client.canonical_column_names([
|
24
|
+
{id: "foo"},
|
25
|
+
{id: "barXX", attributes: {minTemplateIndex: 1, maxTemplateIndex: 3}},
|
26
|
+
{id: "bazXX", attributes: {minTemplateIndex: 1, maxTemplateIndex: 3, premiumMinTemplateIndex: 1, premiumMaxTemplateIndex: 5}},
|
27
|
+
])
|
28
|
+
expected_names = %w(
|
29
|
+
foo bar1 bar2 bar3
|
30
|
+
baz1 baz2 baz3 baz4 baz5
|
31
|
+
)
|
32
|
+
|
33
|
+
assert_equal expected_names, columns.map{|col| col[:id]}
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
15
37
|
sub_test_case "get_profile" do
|
16
38
|
setup do
|
17
39
|
conf = valid_config["in"]
|
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.
|
4
|
+
version: 0.1.9
|
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-
|
11
|
+
date: 2016-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|