analytics-psw 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/lib/tasks/analytics.rake +61 -0
- metadata +24 -23
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NGE5ZWM5MWE2YmEzODdiOGJlMDAzYzU2NzNkNjk3MGQ3MjNjMDQ5Yg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bd280c2c3f9b9ca6dbb9deece3998f3bccf748f8
|
4
|
+
data.tar.gz: da2ade09287d2bacbe5a3436c46a1169571c61b4
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MjA0MWY2NWRjN2VkMmJkNjJkODRhZjkwMjRiMjNjNDUwNzgyMTdlNTY3YzMz
|
11
|
-
MjI2MjJlY2JmODZmMmIwNzViY2ViOWM0NDIyMWZiYjE1ZTg0Y2Q=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
OTk1ZTlhYjJmYjkwMTQxNjQzZTFmY2MzNTY1MWU5OGY2ZmRiYjQwOTk0Y2Y2
|
14
|
-
ZWUyMWU2OTgwZmVhMmMxZDc0ZjUzMzM5NjhjMDIxNzlhZTU2OWRjZTA0YWI5
|
15
|
-
OGIwZDIwMDViMzgxNGE3MzdhNzJjZTFiNjA1ZDgyMmYyMmRmZTE=
|
6
|
+
metadata.gz: 2d71d2c479aa0eaad9c3cf4b0f7ab8a2f15a1eb262742c738b54de3a0708778c0bf377826b5c6817448a4dd4089e7f2c8829944c9f29861c7efb304ea32f7579
|
7
|
+
data.tar.gz: 03e673c04dbaf3215a23f746ab41676788259397851f01693fa4ef5472a81b8db47b89686da0071bd8219ea64817a713e7ec7c17c8884adce0373eab0c826723
|
@@ -0,0 +1,61 @@
|
|
1
|
+
namespace :analytics do
|
2
|
+
def dump_report(event_type, report)
|
3
|
+
if report.rows.count == 0
|
4
|
+
puts "Report has no rows"
|
5
|
+
return
|
6
|
+
end
|
7
|
+
|
8
|
+
header_columns = report.rows.first.keys.map { |k| k == event_type.to_sym ? 'count' : k }
|
9
|
+
rows = report.rows.map do |report_row|
|
10
|
+
row = report_row.map do |key, analytics_report_field|
|
11
|
+
if analytics_report_field.value.is_a?(Hash)
|
12
|
+
analytics_report_field.value['sum']
|
13
|
+
else
|
14
|
+
analytics_report_field.value.inspect
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
puts header_columns.join("\t")
|
20
|
+
rows.each do |row|
|
21
|
+
puts row.join("\t")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
task :group_by do |t, args|
|
26
|
+
analytics, event_type, key = *args
|
27
|
+
begin_date ||= ENV['begin_date'] || 1.week.ago.to_date
|
28
|
+
end_date ||= ENV['end_date'] || Date.today
|
29
|
+
puts "Group by #{key}:"
|
30
|
+
opts = {
|
31
|
+
sum: event_type,
|
32
|
+
}
|
33
|
+
if %w(hour day month year).include?(key)
|
34
|
+
opts[:iterate_by] = key.upcase
|
35
|
+
else
|
36
|
+
opts[:fields] = key
|
37
|
+
opts[:group_by] = key
|
38
|
+
opts[:order_by] = "#{event_type} descending"
|
39
|
+
end
|
40
|
+
opts[:where] = [
|
41
|
+
"event_time gte #{begin_date}",
|
42
|
+
"event_time lte #{end_date}",
|
43
|
+
]
|
44
|
+
dump_report(event_type, analytics.query_analytics(opts))
|
45
|
+
puts ""
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def analytics_define_group_by_tasks(analytics, event_type, dimensions)
|
50
|
+
namespace :analytics do
|
51
|
+
(dimensions.map { |hsh| hsh.map { |key, _type| key } } + %w(hour day month year)).flatten.each do |key|
|
52
|
+
desc "Display analytics report grouped by #{key}"
|
53
|
+
task "group_by_#{key}" do
|
54
|
+
task("analytics:group_by").execute([analytics, event_type, key])
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
desc "Display all analytics reports"
|
59
|
+
task all: Rake.application.tasks.select { |t| t.scope.path == "analytics" && t.name != 'analytics:group_by' }.map(&:name)
|
60
|
+
end
|
61
|
+
end
|
metadata
CHANGED
@@ -1,139 +1,139 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: analytics-psw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lexmark International Technology S.A
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec-core
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 2.14.8
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 2.14.8
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 2.14.1
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 2.14.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: simplecov
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: faraday
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: eventmachine
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: em-http-request
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: activemodel
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
description: Analytics-psw is a wrapper providing access to the Perceptive Cloud Platform
|
@@ -159,6 +159,7 @@ files:
|
|
159
159
|
- lib/analytics-psw/utilities.rb
|
160
160
|
- lib/analytics_report.rb
|
161
161
|
- lib/analytics_report_field.rb
|
162
|
+
- lib/tasks/analytics.rake
|
162
163
|
homepage:
|
163
164
|
licenses:
|
164
165
|
- 3-Clause BSD
|
@@ -169,17 +170,17 @@ require_paths:
|
|
169
170
|
- lib
|
170
171
|
required_ruby_version: !ruby/object:Gem::Requirement
|
171
172
|
requirements:
|
172
|
-
- -
|
173
|
+
- - ">="
|
173
174
|
- !ruby/object:Gem::Version
|
174
175
|
version: '0'
|
175
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
177
|
requirements:
|
177
|
-
- -
|
178
|
+
- - ">="
|
178
179
|
- !ruby/object:Gem::Version
|
179
180
|
version: '0'
|
180
181
|
requirements: []
|
181
182
|
rubyforge_project:
|
182
|
-
rubygems_version: 2.4.
|
183
|
+
rubygems_version: 2.4.3
|
183
184
|
signing_key:
|
184
185
|
specification_version: 4
|
185
186
|
summary: Perceptive Cloud Platform Analytics Service Wrapper
|