google_analytics_v4_api 0.0.6 → 0.0.8
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59caf5c388661b5687dfb982f3b894e8ebf0ebb82f5453f3afecac7d166c11e9
|
4
|
+
data.tar.gz: bcb9f0a7932d64c8e00c71873bbe0bf87b80b8a13d92c038d97b4cbda4bf1a3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 927a45838b9e8047b1a2b77c5c16a3680a1ba9175116202d36c18723729565b8dc5fbbe5ee4465a11bf619f7959a37b79eaa72108d83465ff2b3df8ef89d5314
|
7
|
+
data.tar.gz: 6d3fdb80e9cfb4bb5b7dc547ae66a5b443f5f7dab1b35b6afde516c08f6506a1414f0b21dc8cfe5bbf80416013cbe7a2945972c51fb68e57e5aeb8fa0513ae88
|
data/Gemfile.lock
CHANGED
@@ -22,7 +22,10 @@ module GoogleAnalyticsV4Api
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.parse_list(client, body)
|
25
|
-
JSON.parse(body)
|
25
|
+
parsed_body = JSON.parse(body)
|
26
|
+
return [] if parsed_body["accounts"].nil?
|
27
|
+
|
28
|
+
parsed_body["accounts"].map do |attrs|
|
26
29
|
GoogleAnalyticsV4Api::Account.new(client, attrs)
|
27
30
|
end
|
28
31
|
end
|
@@ -23,7 +23,10 @@ module GoogleAnalyticsV4Api
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def self.parse_list(client, body)
|
26
|
-
JSON.parse(body)
|
26
|
+
parsed_body = JSON.parse(body)
|
27
|
+
return [] if parsed_body["properties"].nil?
|
28
|
+
|
29
|
+
parsed_body["properties"].map do |attrs|
|
27
30
|
GoogleAnalyticsV4Api::Property.new(client, attrs)
|
28
31
|
end
|
29
32
|
end
|
@@ -7,11 +7,13 @@ module GoogleAnalyticsV4Api
|
|
7
7
|
class Report
|
8
8
|
attr_accessor :date_ranges, :dimensions, :metrics, :dimension_filter
|
9
9
|
|
10
|
-
def initialize(start_date: nil, end_date: nil, dimensions: [], metrics: [], dimension_filter: {})
|
10
|
+
def initialize(start_date: nil, end_date: nil, dimensions: [], metrics: [], dimension_filter: {}, limit: 20, offset: 0)
|
11
11
|
@date_ranges = [{ "startDate": start_date || (Date.today - 30), "endDate": end_date || Date.today }]
|
12
|
-
@dimensions
|
12
|
+
@dimensions = dimensions.map { |dimension| { "name": dimension } }
|
13
13
|
@metrics = metrics.map { |metric| { "name": metric } }
|
14
14
|
@dimension_filter = dimension_filter
|
15
|
+
@limit = limit
|
16
|
+
@offset = offset
|
15
17
|
end
|
16
18
|
|
17
19
|
def to_json
|
@@ -20,6 +22,8 @@ module GoogleAnalyticsV4Api
|
|
20
22
|
output[:dimensions] = @dimensions if !@dimensions.nil? && @dimensions.any?
|
21
23
|
output[:metrics] = @metrics if !@metrics.nil? && @metrics.any?
|
22
24
|
output[:dimensionFilter] = @dimension_filter if !@dimension_filter.nil? && @dimension_filter.any?
|
25
|
+
output[:limit] = @limit unless @limit.nil?
|
26
|
+
output[:offset] = @offset unless @offset.nil?
|
23
27
|
output.to_json
|
24
28
|
end
|
25
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_analytics_v4_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gustavo Garcia
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A very humble wrapper for the Google Analytics V4 API to be used in conjuntion
|
14
14
|
with OAuth2
|