fathom_analytics 0.1.0 → 1.0

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: de3640f6afe2af9c5e9e12266d119800c30d53f96fee9c78b70f5659b331b5ee
4
+ data.tar.gz: 8b6653976e6600373a1527ad1ff31de70cd7b665cc72f92fef7f541c620a8df3
5
5
  SHA512:
6
- metadata.gz: c6f208079f8edc3f493fccd1ebbed879ee8f8d2b643b36a677475daea1c330d6c869f5ba25237341ad1534b921c62311c2477fcc4cf1b53a49f68495fe69f9d6
7
- data.tar.gz: 9bbb5d5d912008aef6b401bfec5af3e2ec88924532b7e10e393055e0ab6a2201850bb03c51319034088aa86863f214b49ebc101376dc8ec0293af442a127c396
6
+ metadata.gz: bdd60a6046b643a4ab67416d6e5d2089ec1fb6c32c11fb7385aa453bbf2287ffa6c555040c3ab1483bac4e55e769fc45e388fc39942058c7203890f1ad426461
7
+ data.tar.gz: 18b93739efc595afbe17330e0d01f2fd2eccf9e25da4033534806f1a902bb6fc7ee157c4805658f414b862d0b30dd2aaf07dc7e7c34ce89e726f33f04125b883
data/.env.example CHANGED
@@ -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
@@ -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.6
23
- uses: actions/setup-ruby@v1
22
+ - name: Set up Ruby 2.7
23
+ uses: ruby/setup-ruby@v1
24
24
  with:
25
- ruby-version: 2.6.x
25
+ ruby-version: 2.7
26
26
 
27
27
  - name: Install dependencies
28
28
  run: |
data/.gitignore CHANGED
@@ -11,3 +11,4 @@
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
13
  .env
14
+ .gem
data/Gemfile.lock CHANGED
@@ -1,55 +1,57 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fathom_analytics (0.1.0)
5
- faraday (~> 1.0, >= 1.0.1)
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.7.0)
11
- public_suffix (>= 2.0.2, < 5.0)
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.3)
15
- safe_yaml (~> 1.0.0)
16
- diff-lcs (1.4.3)
17
- dotenv (2.7.5)
18
- faraday (1.0.1)
19
- multipart-post (>= 1.2, < 3)
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
- multipart-post (2.1.1)
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.9.0)
27
+ pry-byebug (3.10.1)
27
28
  byebug (~> 11.0)
28
- pry (~> 0.13.0)
29
- public_suffix (4.0.5)
29
+ pry (>= 0.13, < 0.15)
30
+ public_suffix (5.0.3)
30
31
  rake (12.3.3)
31
- rspec (3.9.0)
32
- rspec-core (~> 3.9.0)
33
- rspec-expectations (~> 3.9.0)
34
- rspec-mocks (~> 3.9.0)
35
- rspec-core (3.9.2)
36
- rspec-support (~> 3.9.3)
37
- rspec-expectations (3.9.2)
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.9.0)
40
- rspec-mocks (3.9.1)
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.9.0)
43
- rspec-support (3.9.3)
44
- safe_yaml (1.0.5)
45
- vcr (6.0.0)
46
- webmock (3.8.3)
47
- addressable (>= 2.3.6)
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
- ruby
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.1.4
67
+ 2.3.7
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
@@ -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.3.0")
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', '~> 1.0', '>= 1.0.1'
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'
@@ -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 = "1.0"
3
3
  end
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: 0.1.0
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: 2020-07-01 00:00:00.000000000 Z
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: '1.0'
19
+ version: '2.7'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 1.0.1
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: '1.0'
29
+ version: '2.7'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 1.0.1
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.3.0
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.0.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.