fathom_api 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b56f8631f9278d0a5e8631b168d07b807ef191896284e69711fac634da46efe
4
- data.tar.gz: c66e9928e9c6ebff67d46fbe7479220bdbf13489a070c9e390a6f096294a3782
3
+ metadata.gz: 2f5fb64e963c720488054fef8bb3f7ed01bc0773546215f36a5d70189ac3272b
4
+ data.tar.gz: af494ca88974437fbd5b1e7c821ac41d75775b713d8f515b86148c46859adf4c
5
5
  SHA512:
6
- metadata.gz: 3b0bb564ab470ae7e84af648dfd9d16ba792bee3366e54dd1ea4308d30b0457c6e46967fafcd3fe03af8ab5f04c7dd0a59936eec8f24bc853904e0b2b8511e20
7
- data.tar.gz: be65304241b52804ed71a5830a75d06aa6be83a0d9015a1d4ccc04ad24de4977ff5058cee0db14b6b6b588a025f72d2499291f097aa923bed95b5d3e1438b3db
6
+ metadata.gz: ef334d4d5856b8cb7f5b069ff34474bf87a95d002541c99f3edfc91e486aef3b46d65f17ccf77037a3bace841233498a005f16809763c89168f64dabca48d145
7
+ data.tar.gz: 9d2d3ae828fdfdd91d3f33bcfe1f131ad8c63e96d5c687465376f5188dea485d9dc797b04b0c6fb7f3bc360cdef51bba2b8f2a7e30af3d7c37c4cc338a3445ad
data/CHANGELOG.md ADDED
@@ -0,0 +1,20 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.2.0] - 2022-05-26
10
+
11
+ ### Changed
12
+
13
+ - Update the Aggregations endpoint to automatically call `.to_json` when using Filters if needed. Thanks @joemasilotti!
14
+ - Bump version to 0.2.0
15
+
16
+ ## [0.1.2] - 2021-08-23
17
+
18
+ ### Added
19
+
20
+ - Previous stable release of the ruby gem for the Fathom API.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fathom_api (0.1.0)
4
+ fathom_api (0.2.0)
5
5
  faraday (~> 1.7)
6
6
  faraday_middleware (~> 1.1)
7
7
 
@@ -9,26 +9,30 @@ GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
11
  ast (2.4.2)
12
- faraday (1.7.0)
12
+ faraday (1.10.0)
13
13
  faraday-em_http (~> 1.0)
14
14
  faraday-em_synchrony (~> 1.0)
15
15
  faraday-excon (~> 1.1)
16
- faraday-httpclient (~> 1.0.1)
16
+ faraday-httpclient (~> 1.0)
17
+ faraday-multipart (~> 1.0)
17
18
  faraday-net_http (~> 1.0)
18
- faraday-net_http_persistent (~> 1.1)
19
+ faraday-net_http_persistent (~> 1.0)
19
20
  faraday-patron (~> 1.0)
20
21
  faraday-rack (~> 1.0)
21
- multipart-post (>= 1.2, < 3)
22
+ faraday-retry (~> 1.0)
22
23
  ruby2_keywords (>= 0.0.4)
23
24
  faraday-em_http (1.0.0)
24
25
  faraday-em_synchrony (1.0.0)
25
26
  faraday-excon (1.1.0)
26
27
  faraday-httpclient (1.0.1)
28
+ faraday-multipart (1.0.3)
29
+ multipart-post (>= 1.2, < 3)
27
30
  faraday-net_http (1.0.1)
28
31
  faraday-net_http_persistent (1.2.0)
29
32
  faraday-patron (1.0.0)
30
33
  faraday-rack (1.0.0)
31
- faraday_middleware (1.1.0)
34
+ faraday-retry (1.0.3)
35
+ faraday_middleware (1.2.0)
32
36
  faraday (~> 1.0)
33
37
  minitest (5.14.4)
34
38
  multipart-post (2.1.1)
@@ -62,6 +66,7 @@ GEM
62
66
 
63
67
  PLATFORMS
64
68
  x86_64-darwin-20
69
+ x86_64-darwin-21
65
70
  x86_64-linux
66
71
 
67
72
  DEPENDENCIES
@@ -71,4 +76,4 @@ DEPENDENCIES
71
76
  standard
72
77
 
73
78
  BUNDLED WITH
74
- 2.2.3
79
+ 2.2.33
data/README.md CHANGED
@@ -1,5 +1,3 @@
1
- ### Hello there! This gem is a placeholder and will be updated and working soon. Please do not install it yet.
2
-
3
1
  # Fathom API
4
2
 
5
3
  ### 🛠 An easy to use client with the Fathom API
@@ -49,21 +47,24 @@ response.email
49
47
  # => "you@starfleet.org"
50
48
  ```
51
49
 
52
- ### A note on Fathom::List objects
50
+ ### Pagination
53
51
 
54
52
  When an API's response comes back with a object of "list", we automatically wrap that to attempt to provide some helper methods to ease your implementations.
55
53
 
56
54
  ```ruby
57
- list = client.sites.list
55
+ list = client.sites.list(limit: 1)
58
56
  # => Fathom::List
59
57
 
60
- # get the cursor you can pass to the next request's starting_after param
61
- list.next_page
62
- # or get the ending_before param's cursor
63
- list.prev_page
58
+ # We provide two helper methods to allow you to get the first or last id from the data response
59
+ list.first_id
60
+ list.last_id
64
61
 
65
62
  # check if the list has more after it with
66
63
  list.has_more?
64
+ # => true
65
+
66
+ # use the next page cursor in your next response
67
+ list2 = client.sites.list(limit: 1, starting_after: list.last_id)
67
68
  ```
68
69
 
69
70
  ### Sites
@@ -112,9 +113,11 @@ client.current_visitors(site_id: site_id, {}) # Can add detailed: true for a mor
112
113
  ### Aggregation
113
114
 
114
115
  ```ruby
115
- client.aggregations.list(entity_id: entity_id, entity_type: entity_type, aggregates: aggregates, **params)
116
+ client.aggregations.list(entity_id: entity_id, entity: entity, aggregates: aggregates, **params)
116
117
  ```
117
118
 
119
+ You can find all the available parameters in the [official Fathom docs](https://usefathom.com/api#introduction)
120
+
118
121
  ## 🙏 Contributing
119
122
 
120
123
  This project uses Standard for formatting Ruby code. Please make sure to run standardrb before submitting pull requests. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/afomera/fathom_api/blob/main/CODE_OF_CONDUCT.md).
@@ -11,11 +11,11 @@ module Fathom
11
11
  @attributes["has_more"]
12
12
  end
13
13
 
14
- def next_page
14
+ def last_id
15
15
  @attributes["data"].last.id
16
16
  end
17
17
 
18
- def prev_page
18
+ def first_id
19
19
  @attributes["data"].first.id
20
20
  end
21
21
  end
@@ -1,9 +1,18 @@
1
1
  module Fathom
2
2
  class AggregationsResource < Resource
3
3
  # TODO: Ensure this works properly
4
- def list(entity_id:, entity_type:, aggregates:, **params)
5
- get_request("aggregations", params: params.merge(entity_id: entity_id,
6
- entity_type: entity_type, aggregates: aggregates))
4
+ def list(entity_id:, entity:, aggregates:, **params)
5
+ filters = params.delete(:filters) || {}
6
+ filters = filters.to_json if filters.is_a?(Hash)
7
+
8
+ params.merge!(
9
+ entity_id: entity_id,
10
+ entity: entity,
11
+ aggregates: aggregates,
12
+ filters: filters
13
+ )
14
+
15
+ get_request("aggregations", params: params)
7
16
  end
8
17
  end
9
18
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fathom
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fathom_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrea Fomera
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-18 00:00:00.000000000 Z
11
+ date: 2022-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -47,6 +47,7 @@ extra_rdoc_files: []
47
47
  files:
48
48
  - ".github/workflows/main.yml"
49
49
  - ".gitignore"
50
+ - CHANGELOG.md
50
51
  - CODE_OF_CONDUCT.md
51
52
  - Gemfile
52
53
  - Gemfile.lock
@@ -92,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
93
  - !ruby/object:Gem::Version
93
94
  version: '0'
94
95
  requirements: []
95
- rubygems_version: 3.2.3
96
+ rubygems_version: 3.2.32
96
97
  signing_key:
97
98
  specification_version: 4
98
99
  summary: A gem for using the Fathom API