fathom_analytics 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env.example +1 -0
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +19 -2
- data/lib/fathom_analytics/api.rb +2 -2
- data/lib/fathom_analytics/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fae94452b229dfcf385e437013daee6d9ac2ba8a281bf092266e15c95338e6b5
|
4
|
+
data.tar.gz: 8f60219caf13665bcc9f75c6d9017c46eba8c093127058277e58d458b42b45c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 790506e138ba86ffcf02fd5ed388174576a960a1425fe193eed74ed71b34ecfef21794ac42f74447ad9e16e3e4e5c4693027615ed88e0e75fd8c1ed5e14911c3
|
7
|
+
data.tar.gz: eb3f0783bca0a38eaba66f4a03e1192e5152046c4c0ad73d7739fc31d676176f4233e1c56cd0c64eddd45810f837c7c77f9ec88a5736567c00b7c888a96816e1
|
data/.env.example
CHANGED
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
![CI Specs](https://github.com/gpoisoned/fathom_analytics/workflows/CI%20Specs/badge.svg?branch=master)
|
1
|
+
![CI Specs](https://github.com/gpoisoned/fathom_analytics/workflows/CI%20Specs/badge.svg?branch=master) [![Gem Version](https://badge.fury.io/rb/fathom_analytics.svg)](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/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
|
|