fathom_analytics 0.1.0 → 1.0
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/.env.example +1 -0
- data/.github/workflows/ci.yml +3 -3
- data/.gitignore +1 -0
- data/Gemfile.lock +34 -32
- data/README.md +19 -2
- data/fathom_analytics.gemspec +2 -2
- data/lib/fathom_analytics/api.rb +2 -2
- data/lib/fathom_analytics/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: de3640f6afe2af9c5e9e12266d119800c30d53f96fee9c78b70f5659b331b5ee
|
|
4
|
+
data.tar.gz: 8b6653976e6600373a1527ad1ff31de70cd7b665cc72f92fef7f541c620a8df3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bdd60a6046b643a4ab67416d6e5d2089ec1fb6c32c11fb7385aa453bbf2287ffa6c555040c3ab1483bac4e55e769fc45e388fc39942058c7203890f1ad426461
|
|
7
|
+
data.tar.gz: 18b93739efc595afbe17330e0d01f2fd2eccf9e25da4033534806f1a902bb6fc7ee157c4805658f414b862d0b30dd2aaf07dc7e7c34ce89e726f33f04125b883
|
data/.env.example
CHANGED
data/.github/workflows/ci.yml
CHANGED
|
@@ -19,10 +19,10 @@ jobs:
|
|
|
19
19
|
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
|
20
20
|
restore-keys: |
|
|
21
21
|
${{ runner.os }}-gems-
|
|
22
|
-
- name: Set up Ruby 2.
|
|
23
|
-
uses:
|
|
22
|
+
- name: Set up Ruby 2.7
|
|
23
|
+
uses: ruby/setup-ruby@v1
|
|
24
24
|
with:
|
|
25
|
-
ruby-version: 2.
|
|
25
|
+
ruby-version: 2.7
|
|
26
26
|
|
|
27
27
|
- name: Install dependencies
|
|
28
28
|
run: |
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,55 +1,57 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
fathom_analytics (
|
|
5
|
-
faraday (~>
|
|
4
|
+
fathom_analytics (1.0)
|
|
5
|
+
faraday (~> 2.7, >= 2.7.10)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
addressable (2.
|
|
11
|
-
public_suffix (>= 2.0.2, <
|
|
10
|
+
addressable (2.8.5)
|
|
11
|
+
public_suffix (>= 2.0.2, < 6.0)
|
|
12
12
|
byebug (11.1.3)
|
|
13
13
|
coderay (1.1.3)
|
|
14
|
-
crack (0.4.
|
|
15
|
-
|
|
16
|
-
diff-lcs (1.
|
|
17
|
-
dotenv (2.
|
|
18
|
-
faraday (
|
|
19
|
-
|
|
14
|
+
crack (0.4.5)
|
|
15
|
+
rexml
|
|
16
|
+
diff-lcs (1.5.0)
|
|
17
|
+
dotenv (2.8.1)
|
|
18
|
+
faraday (2.7.10)
|
|
19
|
+
faraday-net_http (>= 2.0, < 3.1)
|
|
20
|
+
ruby2_keywords (>= 0.0.4)
|
|
21
|
+
faraday-net_http (3.0.2)
|
|
20
22
|
hashdiff (1.0.1)
|
|
21
23
|
method_source (1.0.0)
|
|
22
|
-
|
|
23
|
-
pry (0.13.1)
|
|
24
|
+
pry (0.14.2)
|
|
24
25
|
coderay (~> 1.1)
|
|
25
26
|
method_source (~> 1.0)
|
|
26
|
-
pry-byebug (3.
|
|
27
|
+
pry-byebug (3.10.1)
|
|
27
28
|
byebug (~> 11.0)
|
|
28
|
-
pry (
|
|
29
|
-
public_suffix (
|
|
29
|
+
pry (>= 0.13, < 0.15)
|
|
30
|
+
public_suffix (5.0.3)
|
|
30
31
|
rake (12.3.3)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
rspec-
|
|
34
|
-
rspec-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
rexml (3.2.6)
|
|
33
|
+
rspec (3.12.0)
|
|
34
|
+
rspec-core (~> 3.12.0)
|
|
35
|
+
rspec-expectations (~> 3.12.0)
|
|
36
|
+
rspec-mocks (~> 3.12.0)
|
|
37
|
+
rspec-core (3.12.2)
|
|
38
|
+
rspec-support (~> 3.12.0)
|
|
39
|
+
rspec-expectations (3.12.3)
|
|
38
40
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
39
|
-
rspec-support (~> 3.
|
|
40
|
-
rspec-mocks (3.
|
|
41
|
+
rspec-support (~> 3.12.0)
|
|
42
|
+
rspec-mocks (3.12.6)
|
|
41
43
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
42
|
-
rspec-support (~> 3.
|
|
43
|
-
rspec-support (3.
|
|
44
|
-
|
|
45
|
-
vcr (6.
|
|
46
|
-
webmock (3.
|
|
47
|
-
addressable (>= 2.
|
|
44
|
+
rspec-support (~> 3.12.0)
|
|
45
|
+
rspec-support (3.12.1)
|
|
46
|
+
ruby2_keywords (0.0.5)
|
|
47
|
+
vcr (6.2.0)
|
|
48
|
+
webmock (3.18.1)
|
|
49
|
+
addressable (>= 2.8.0)
|
|
48
50
|
crack (>= 0.3.2)
|
|
49
51
|
hashdiff (>= 0.4.0, < 2.0.0)
|
|
50
52
|
|
|
51
53
|
PLATFORMS
|
|
52
|
-
|
|
54
|
+
x86_64-darwin-21
|
|
53
55
|
|
|
54
56
|
DEPENDENCIES
|
|
55
57
|
byebug (~> 11.1, >= 11.1.3)
|
|
@@ -62,4 +64,4 @@ DEPENDENCIES
|
|
|
62
64
|
webmock (~> 3.8, >= 3.8.3)
|
|
63
65
|
|
|
64
66
|
BUNDLED WITH
|
|
65
|
-
2.
|
|
67
|
+
2.3.7
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-

|
|
1
|
+
 [](https://badge.fury.io/rb/fathom_analytics)
|
|
2
2
|
# Fathom Analytics Ruby Client
|
|
3
3
|
|
|
4
4
|
A Ruby interface to [Fathom Analytics server](https://github.com/usefathom/fathom).
|
|
@@ -27,6 +27,12 @@ Or install it yourself as:
|
|
|
27
27
|
api = FathomAnalytics::Api.new(url: 'https://example.com', email: '', password: '')
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
#### Authentication:
|
|
31
|
+
``` ruby
|
|
32
|
+
api.authenticate
|
|
33
|
+
```
|
|
34
|
+
Note: Any other api call without prior authentication will implicitly call `authenticate`.
|
|
35
|
+
|
|
30
36
|
#### Get all sites:
|
|
31
37
|
``` ruby
|
|
32
38
|
api.sites
|
|
@@ -81,12 +87,23 @@ api.referrer_agg_page_views_stats(id: 1, from: 1577862000, to: 1609484399)
|
|
|
81
87
|
|
|
82
88
|
Pagination is supported through `offset` and `limit` params.
|
|
83
89
|
``` ruby
|
|
84
|
-
api.
|
|
90
|
+
api.page_agg_page_views_stats(id: 1, from: 1577862000, to: 1609484399, offset: 10, limit: 10) # Second page
|
|
85
91
|
```
|
|
86
92
|
The default values for paginations params are as follows:
|
|
87
93
|
1. `limit` = 50
|
|
88
94
|
2. `offset` = 0
|
|
89
95
|
|
|
96
|
+
#### Handling API Errors
|
|
97
|
+
|
|
98
|
+
The api call will raise an error `FathomAnalytics::Error` when it fails.
|
|
99
|
+
``` ruby
|
|
100
|
+
begin
|
|
101
|
+
api.authenticate
|
|
102
|
+
rescue FathomAnalytics::Error => e
|
|
103
|
+
# Log and handle the error
|
|
104
|
+
end
|
|
105
|
+
```
|
|
106
|
+
|
|
90
107
|
## Contributing
|
|
91
108
|
|
|
92
109
|
1. Fork it
|
data/fathom_analytics.gemspec
CHANGED
|
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
|
9
9
|
spec.summary = %q{Ruby client for Fathom Analytics server.}
|
|
10
10
|
spec.homepage = "https://github.com/gpoisoned/fathom_analytics"
|
|
11
11
|
spec.license = "MIT"
|
|
12
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
|
12
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.7")
|
|
13
13
|
|
|
14
14
|
spec.metadata["homepage_uri"] = spec.homepage
|
|
15
15
|
spec.metadata["source_code_uri"] = "https://github.com/gpoisoned/fathom_analytics"
|
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
|
24
24
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
25
25
|
spec.require_paths = ["lib"]
|
|
26
26
|
|
|
27
|
-
spec.add_dependency 'faraday', '~>
|
|
27
|
+
spec.add_dependency 'faraday', '~> 2.7', '>= 2.7.10'
|
|
28
28
|
|
|
29
29
|
spec.add_development_dependency 'rake', '~> 12.0'
|
|
30
30
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
data/lib/fathom_analytics/api.rb
CHANGED
|
@@ -43,7 +43,7 @@ module FathomAnalytics
|
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
def page_agg_page_views_stats(id:, from:, to:, limit: LIMIT, offset: 0)
|
|
46
|
-
path = "/api/sites/#{id}/stats/pages/
|
|
46
|
+
path = "/api/sites/#{id}/stats/pages/agg/pageviews"
|
|
47
47
|
get_request(path: path, before: to, after: from, limit: limit, offset: offset)
|
|
48
48
|
end
|
|
49
49
|
|
|
@@ -53,7 +53,7 @@ module FathomAnalytics
|
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
def referrer_agg_page_views_stats(id:, from:, to:, limit: LIMIT, offset: 0)
|
|
56
|
-
path = "/api/sites/#{id}/stats/referrers/
|
|
56
|
+
path = "/api/sites/#{id}/stats/referrers/agg/pageviews"
|
|
57
57
|
get_request(path: path, before: to, after: from, limit: limit, offset: offset)
|
|
58
58
|
end
|
|
59
59
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fathom_analytics
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: '1.0'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sunny Rana
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-08-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -16,20 +16,20 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
19
|
+
version: '2.7'
|
|
20
20
|
- - ">="
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
|
-
version:
|
|
22
|
+
version: 2.7.10
|
|
23
23
|
type: :runtime
|
|
24
24
|
prerelease: false
|
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
26
|
requirements:
|
|
27
27
|
- - "~>"
|
|
28
28
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: '
|
|
29
|
+
version: '2.7'
|
|
30
30
|
- - ">="
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version:
|
|
32
|
+
version: 2.7.10
|
|
33
33
|
- !ruby/object:Gem::Dependency
|
|
34
34
|
name: rake
|
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -186,14 +186,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
186
186
|
requirements:
|
|
187
187
|
- - ">="
|
|
188
188
|
- !ruby/object:Gem::Version
|
|
189
|
-
version: 2.
|
|
189
|
+
version: '2.7'
|
|
190
190
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
191
191
|
requirements:
|
|
192
192
|
- - ">="
|
|
193
193
|
- !ruby/object:Gem::Version
|
|
194
194
|
version: '0'
|
|
195
195
|
requirements: []
|
|
196
|
-
rubygems_version: 3.
|
|
196
|
+
rubygems_version: 3.2.32
|
|
197
197
|
signing_key:
|
|
198
198
|
specification_version: 4
|
|
199
199
|
summary: Ruby client for Fathom Analytics server.
|