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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ef2617afd279bb381b921c7455379f8ea955c5203b70162680136e0d764778f
4
- data.tar.gz: cf7f4a11afa39c034b3776a363adbc09aac76405c16fde3fdf7e54d6a9d8f6ca
3
+ metadata.gz: fae94452b229dfcf385e437013daee6d9ac2ba8a281bf092266e15c95338e6b5
4
+ data.tar.gz: 8f60219caf13665bcc9f75c6d9017c46eba8c093127058277e58d458b42b45c1
5
5
  SHA512:
6
- metadata.gz: c6f208079f8edc3f493fccd1ebbed879ee8f8d2b643b36a677475daea1c330d6c869f5ba25237341ad1534b921c62311c2477fcc4cf1b53a49f68495fe69f9d6
7
- data.tar.gz: 9bbb5d5d912008aef6b401bfec5af3e2ec88924532b7e10e393055e0ab6a2201850bb03c51319034088aa86863f214b49ebc101376dc8ec0293af442a127c396
6
+ metadata.gz: 790506e138ba86ffcf02fd5ed388174576a960a1425fe193eed74ed71b34ecfef21794ac42f74447ad9e16e3e4e5c4693027615ed88e0e75fd8c1ed5e14911c3
7
+ data.tar.gz: eb3f0783bca0a38eaba66f4a03e1192e5152046c4c0ad73d7739fc31d676176f4233e1c56cd0c64eddd45810f837c7c77f9ec88a5736567c00b7c888a96816e1
@@ -1,3 +1,4 @@
1
1
  TEST_URL=https://example.com
2
2
  TEST_EMAIL=test@example.com
3
3
  TEST_PASSWORD=test
4
+ TEST_INVALID_PASSWORD=invalid
data/.gitignore CHANGED
@@ -11,3 +11,4 @@
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
13
  .env
14
+ .gem
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fathom_analytics (0.1.0)
4
+ fathom_analytics (0.1.1)
5
5
  faraday (~> 1.0, >= 1.0.1)
6
6
 
7
7
  GEM
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.site_stats(id: 1, from: 1577862000, to: 1609484399, offset: 1, limit: 10)
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
@@ -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/page_views"
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/page_views"
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
 
@@ -1,3 +1,3 @@
1
1
  module FathomAnalytics
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fathom_analytics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sunny Rana