action_tracker_client 0.1.3 → 0.1.4
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 +4 -4
- data/.rubocop.yml +0 -8
- data/Gemfile.lock +12 -10
- data/lib/action_tracker.rb +3 -2
- data/lib/action_tracker/models/statistic_record.rb +27 -0
- data/lib/action_tracker/models/transition_record.rb +13 -25
- data/lib/action_tracker/utils/collection_proxy.rb +1 -1
- data/lib/action_tracker/utils/http_gateway.rb +23 -0
- data/lib/action_tracker/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96e3a4be249df05d4ee1422b65d7812b559657b0a4d0f8faa8b64b3b31cf68b4
|
4
|
+
data.tar.gz: abb42792b81c98b9c56553f564dd1f3f08a3787763b4a9a2eb456601891430cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8fe4c30e5c17ede01292ce6e206089cb4f5005284f0b8d34e99bfd04f0d0271669c94666716d522131d62b1985f37f0bf8693129201904e53b22c1433f4f265
|
7
|
+
data.tar.gz: d9e1369bbeaca0b385bf275bd963a4924fc91517ec845d38136394fec67dc064fdd143686fdffb11e39f68c1860af07900d40076d7944f3f06857de8e5e2dd6f
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
action_tracker_client (0.1.
|
4
|
+
action_tracker_client (0.1.3)
|
5
5
|
activemodel (>= 4.0)
|
6
6
|
activesupport (>= 4.0)
|
7
7
|
api_signature (~> 0.1.5)
|
@@ -12,13 +12,14 @@ PATH
|
|
12
12
|
GEM
|
13
13
|
remote: https://rubygems.org/
|
14
14
|
specs:
|
15
|
-
activemodel (
|
16
|
-
activesupport (=
|
17
|
-
activesupport (
|
15
|
+
activemodel (6.0.1)
|
16
|
+
activesupport (= 6.0.1)
|
17
|
+
activesupport (6.0.1)
|
18
18
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
19
19
|
i18n (>= 0.7, < 2)
|
20
20
|
minitest (~> 5.1)
|
21
21
|
tzinfo (~> 1.1)
|
22
|
+
zeitwerk (~> 2.2)
|
22
23
|
addressable (2.6.0)
|
23
24
|
public_suffix (>= 2.0.2, < 4.0)
|
24
25
|
api_signature (0.1.5)
|
@@ -56,10 +57,10 @@ GEM
|
|
56
57
|
guard-compat (~> 1.1)
|
57
58
|
rspec (>= 2.99.0, < 4.0)
|
58
59
|
hashdiff (0.3.9)
|
59
|
-
httparty (0.17.
|
60
|
+
httparty (0.17.1)
|
60
61
|
mime-types (~> 3.0)
|
61
62
|
multi_xml (>= 0.5.2)
|
62
|
-
i18n (1.
|
63
|
+
i18n (1.7.0)
|
63
64
|
concurrent-ruby (~> 1.0)
|
64
65
|
ice_nine (0.11.2)
|
65
66
|
listen (3.1.5)
|
@@ -68,10 +69,10 @@ GEM
|
|
68
69
|
ruby_dep (~> 1.2)
|
69
70
|
lumberjack (1.0.13)
|
70
71
|
method_source (0.9.2)
|
71
|
-
mime-types (3.
|
72
|
+
mime-types (3.3)
|
72
73
|
mime-types-data (~> 3.2015)
|
73
|
-
mime-types-data (3.2019.
|
74
|
-
minitest (5.
|
74
|
+
mime-types-data (3.2019.1009)
|
75
|
+
minitest (5.13.0)
|
75
76
|
model_auditor (0.0.2)
|
76
77
|
multi_xml (0.6.0)
|
77
78
|
nenv (0.3.0)
|
@@ -119,6 +120,7 @@ GEM
|
|
119
120
|
addressable (>= 2.3.6)
|
120
121
|
crack (>= 0.3.2)
|
121
122
|
hashdiff
|
123
|
+
zeitwerk (2.2.1)
|
122
124
|
|
123
125
|
PLATFORMS
|
124
126
|
ruby
|
@@ -133,4 +135,4 @@ DEPENDENCIES
|
|
133
135
|
webmock (~> 3.5, >= 3.5.1)
|
134
136
|
|
135
137
|
BUNDLED WITH
|
136
|
-
1.
|
138
|
+
1.17.3
|
data/lib/action_tracker.rb
CHANGED
@@ -8,18 +8,19 @@ require 'active_support/core_ext/object'
|
|
8
8
|
|
9
9
|
module ActionTracker
|
10
10
|
autoload :Config, 'action_tracker/config'
|
11
|
+
autoload :Recorder, 'action_tracker/recorder'
|
11
12
|
|
12
13
|
autoload :CollectionProxy, 'action_tracker/utils/collection_proxy'
|
13
14
|
autoload :Connection, 'action_tracker/utils/connection'
|
14
15
|
autoload :Pagination, 'action_tracker/utils/pagination'
|
15
16
|
autoload :RecordsCollection, 'action_tracker/utils/records_collection'
|
16
17
|
autoload :SignedRequest, 'action_tracker/utils/signed_request'
|
17
|
-
|
18
|
-
autoload :Recorder, 'action_tracker/recorder'
|
18
|
+
autoload :HttpGateway, 'action_tracker/utils/http_gateway'
|
19
19
|
|
20
20
|
module Models
|
21
21
|
autoload :ApplicationRecord, 'action_tracker/models/application_record'
|
22
22
|
autoload :TransitionRecord, 'action_tracker/models/transition_record'
|
23
|
+
autoload :StatisticRecord, 'action_tracker/models/statistic_record'
|
23
24
|
autoload :Payload, 'action_tracker/models/payload'
|
24
25
|
autoload :User, 'action_tracker/models/user'
|
25
26
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal :true
|
2
|
+
|
3
|
+
module ActionTracker
|
4
|
+
module Models
|
5
|
+
class StatisticRecord < ActionTracker::Models::ApplicationRecord
|
6
|
+
include ActionTracker::HttpGateway
|
7
|
+
|
8
|
+
attribute :user_id, Integer
|
9
|
+
attribute :report_date, String
|
10
|
+
attribute :total_count, Integer
|
11
|
+
attribute :targets, Hash
|
12
|
+
|
13
|
+
def count(params = {})
|
14
|
+
request processed_path(collection_path, params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def daily(params = {})
|
18
|
+
path = processed_path("#{collection_path}/daily", params)
|
19
|
+
parse_response request(path)
|
20
|
+
end
|
21
|
+
|
22
|
+
def collection_path
|
23
|
+
'statistics'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -3,6 +3,8 @@
|
|
3
3
|
module ActionTracker
|
4
4
|
module Models
|
5
5
|
class TransitionRecord < ActionTracker::Models::ApplicationRecord
|
6
|
+
include ActionTracker::HttpGateway
|
7
|
+
|
6
8
|
mimic 'transition'
|
7
9
|
|
8
10
|
attribute :target_id, Integer
|
@@ -31,29 +33,19 @@ module ActionTracker
|
|
31
33
|
end
|
32
34
|
|
33
35
|
def index(params = {})
|
34
|
-
|
35
|
-
|
36
|
-
parse_response
|
36
|
+
parse_response request(processed_path(collection_path, params))
|
37
37
|
end
|
38
38
|
|
39
39
|
def filtered_by_users(params = {})
|
40
|
-
|
40
|
+
path = processed_path(users(params[:user_id]), params.except(:user_id))
|
41
41
|
|
42
|
-
parse_response
|
42
|
+
parse_response request(path)
|
43
43
|
end
|
44
44
|
|
45
45
|
def filtered_by_users_count(params = {})
|
46
|
-
|
47
|
-
|
48
|
-
response
|
49
|
-
end
|
50
|
-
|
51
|
-
def collection_path
|
52
|
-
'transitions'
|
53
|
-
end
|
46
|
+
path = processed_path(users(params[:user_id]) + '/count', params.except(:user_id))
|
54
47
|
|
55
|
-
|
56
|
-
"users/#{user_id}"
|
48
|
+
request(path)
|
57
49
|
end
|
58
50
|
|
59
51
|
def payload
|
@@ -68,25 +60,21 @@ module ActionTracker
|
|
68
60
|
[event, content].reject(&:blank?).compact.join(': ')
|
69
61
|
end
|
70
62
|
|
71
|
-
|
72
|
-
|
73
|
-
def parse_response
|
74
|
-
ActionTracker::CollectionProxy.new response, self.class.model_name
|
63
|
+
def collection_path
|
64
|
+
'transitions'
|
75
65
|
end
|
76
66
|
|
77
|
-
def
|
78
|
-
|
67
|
+
def users(user_id)
|
68
|
+
"users/#{user_id}"
|
79
69
|
end
|
80
70
|
|
71
|
+
private
|
72
|
+
|
81
73
|
def check_payload
|
82
74
|
return if payload.valid?
|
83
75
|
|
84
76
|
errors.add(:payload, :invalid)
|
85
77
|
end
|
86
|
-
|
87
|
-
def processed_path(collection_name, params)
|
88
|
-
[collection_name, params.to_query].reject(&:blank?).compact.join('?')
|
89
|
-
end
|
90
78
|
end
|
91
79
|
end
|
92
80
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActionTracker
|
4
|
+
module HttpGateway
|
5
|
+
protected
|
6
|
+
|
7
|
+
def request(path)
|
8
|
+
Connection.new.get(path)
|
9
|
+
end
|
10
|
+
|
11
|
+
def response
|
12
|
+
@response ||= Connection.new.get(@path)
|
13
|
+
end
|
14
|
+
|
15
|
+
def processed_path(collection_name, params)
|
16
|
+
[collection_name, params.to_query].reject(&:blank?).compact.join('?')
|
17
|
+
end
|
18
|
+
|
19
|
+
def parse_response(response)
|
20
|
+
ActionTracker::CollectionProxy.new response, self.class.model_name
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action_tracker_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Malinovskiy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -221,6 +221,7 @@ files:
|
|
221
221
|
- lib/action_tracker/config.rb
|
222
222
|
- lib/action_tracker/models/application_record.rb
|
223
223
|
- lib/action_tracker/models/payload.rb
|
224
|
+
- lib/action_tracker/models/statistic_record.rb
|
224
225
|
- lib/action_tracker/models/transition_record.rb
|
225
226
|
- lib/action_tracker/models/user.rb
|
226
227
|
- lib/action_tracker/recorder.rb
|
@@ -230,6 +231,7 @@ files:
|
|
230
231
|
- lib/action_tracker/templates/update.rb
|
231
232
|
- lib/action_tracker/utils/collection_proxy.rb
|
232
233
|
- lib/action_tracker/utils/connection.rb
|
234
|
+
- lib/action_tracker/utils/http_gateway.rb
|
233
235
|
- lib/action_tracker/utils/pagination.rb
|
234
236
|
- lib/action_tracker/utils/records_collection.rb
|
235
237
|
- lib/action_tracker/utils/signed_request.rb
|