hisui 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hisui/response/ga_data.rb +16 -1
- data/lib/hisui/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c845d0f033304d8d16bc9635dcd9e476541682381d4121169ed73e3306a07652
|
4
|
+
data.tar.gz: d985aa41ebf2f9887921c9285666010cf1eb739d99990148cc955ad603843887
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8d0a4aa11eef1f71c832a913dafbfa7c1356b49a39e0e25c3c24c9b722dd2f44c486b1ae76cb222a0d028d82bd7e703a1ce3b05c31c376b7ef901bd24c05ddb
|
7
|
+
data.tar.gz: 7b2a3f7d2a615e910241aad2424ce5ddd4b60ca4c493a56b95f01430ee69d93a9d76a879f75938b9c35d9bfc342c1f327c0c7e37c09e8fc54a441cd49dd4913e
|
@@ -4,6 +4,7 @@ module Hisui
|
|
4
4
|
attr_reader :response, :date_ranges
|
5
5
|
|
6
6
|
DATE_DIMENSIONS = %w[ga:date ga:dateHour ga:dateHourMinute].freeze
|
7
|
+
MONTH_DIMENSIONS = %w[ga:yearMonth].freeze
|
7
8
|
|
8
9
|
def initialize(response:, request:)
|
9
10
|
@response = response
|
@@ -15,6 +16,8 @@ module Hisui
|
|
15
16
|
|
16
17
|
data.try(:rows).try(:each_with_object, []) do |row, arr|
|
17
18
|
next if date_indices.present? && date_indices.all? { |index| date_ranges.try(ordinal.to_sym).exclude?(row.dimensions[index].in_time_zone) }
|
19
|
+
next if month_indices.present? && month_indices.all? { |index| date_ranges.try(ordinal.to_sym).exclude?("#{row.dimensions[index]}01".in_time_zone) }
|
20
|
+
|
18
21
|
row_data = []
|
19
22
|
row.dimensions.each do |dimension|
|
20
23
|
row_data << dimension
|
@@ -101,7 +104,7 @@ module Hisui
|
|
101
104
|
end
|
102
105
|
end
|
103
106
|
|
104
|
-
# NOTE: When dimensions include DATE_DIMENSIONS, Google Analytics data has data to include primary and comparing date range.
|
107
|
+
# NOTE: When dimensions include DATE_DIMENSIONS, Google Analytics data has data to include both primary and comparing date range.
|
105
108
|
# This is a method to filter only primary or comparing data.
|
106
109
|
def date_indices
|
107
110
|
@date_indices ||= begin
|
@@ -113,6 +116,18 @@ module Hisui
|
|
113
116
|
end
|
114
117
|
end
|
115
118
|
|
119
|
+
# NOTE: When dimensions include MONTH_DIMENSIONS, Google Analytics data has data to include both primary and comparing date range.
|
120
|
+
# This is a method to filter only primary or comparing data.
|
121
|
+
def month_indices
|
122
|
+
@month_indices ||= begin
|
123
|
+
used_date_dimensions = MONTH_DIMENSIONS & column_header.dimensions
|
124
|
+
|
125
|
+
used_date_dimensions.each_with_object([]) do |dimension, arr|
|
126
|
+
arr << column_header.dimensions.index(dimension)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
116
131
|
def data
|
117
132
|
@data ||= response.reports.first.data
|
118
133
|
end
|
data/lib/hisui/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hisui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ikepon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -194,8 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
194
|
- !ruby/object:Gem::Version
|
195
195
|
version: '0'
|
196
196
|
requirements: []
|
197
|
-
|
198
|
-
rubygems_version: 2.7.6
|
197
|
+
rubygems_version: 3.0.1
|
199
198
|
signing_key:
|
200
199
|
specification_version: 4
|
201
200
|
summary: Access the Google Analytics Reporting API v4 On Rails
|