{"id":15586385,"url":"https://github.com/afomera/fathom_api","last_synced_at":"2025-04-24T04:43:53.868Z","repository":{"id":39743304,"uuid":"396960175","full_name":"afomera/fathom_api","owner":"afomera","description":"A ruby gem for using the https://usefathom.com api","archived":false,"fork":false,"pushed_at":"2022-05-26T16:54:33.000Z","size":41,"stargazers_count":18,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-24T04:43:46.568Z","etag":null,"topics":["hacktoberfest","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/afomera.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-16T20:26:25.000Z","updated_at":"2023-05-30T03:08:29.000Z","dependencies_parsed_at":"2022-09-15T08:31:34.387Z","dependency_job_id":null,"html_url":"https://github.com/afomera/fathom_api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afomera%2Ffathom_api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afomera%2Ffathom_api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afomera%2Ffathom_api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afomera%2Ffathom_api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/afomera","download_url":"https://codeload.github.com/afomera/fathom_api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250566441,"owners_count":21451229,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","ruby"],"created_at":"2024-10-02T21:22:09.241Z","updated_at":"2025-04-24T04:43:53.847Z","avatar_url":"https://github.com/afomera.png","language":"Ruby","readme":"# Fathom API\n\n### 🛠 An easy to use client with the Fathom API\n\nYou'll need a usefathom.com account to use the API, if you don't have one [click here to sign up](https://usefathom.com/ref/CVNWHD).\n\nAs of August 17th, 2021 the API was still early-access, so some endpoints may be different than in production. Feel free to submit a PR or issue. Contributions are welcome!\n\n[![Build Status](https://github.com/afomera/fathom_api/workflows/Tests/badge.svg)](https://github.com/afomera/fathom_api/actions) [![Gem Version](https://badge.fury.io/rb/fathom_api.svg)](https://badge.fury.io/rb/fathom_api)\n\n## Installation\n\nAdd `fathom_api` to your application's Gemfile:\n\n```bash\nbundle add fathom_api\n\n# OR in the Gemfile\ngem \"fathom_api\"\n```\n\n## Usage\n\nCreate a client to get started, passing an `api_key` you generate in your Fathom API settings.\n\n```ruby\nclient = Fathom::Client.new(api_key: ENV['FATHOM_API_KEY'])\n```\n\n### Fetch account details\n\n```ruby\n# Get account details\nclient.account.info\n# =\u003e Fathom::Account\n```\n\nResponses are wrapped in an object that dynamically allows you to call the attributes as if they are an OpenStruct... IE\n\n```ruby\nresponse = client.account.info\n# =\u003e #\u003cFathom::Account:0x00007fee844068c8 @attributes=#\u003cOpenStruct id=12345, name=\"Your account name\", email=\"you@starfleet.org\", object=\"account\"\u003e\u003e\n\nresponse.name\n# =\u003e \"Your account name\"\nresponse.email\n# =\u003e \"you@starfleet.org\"\n```\n\n### Pagination\n\nWhen 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.\n\n```ruby\nlist = client.sites.list(limit: 1)\n# =\u003e Fathom::List\n\n# We provide two helper methods to allow you to get the first or last id from the data response\nlist.first_id\nlist.last_id\n\n# check if the list has more after it with\nlist.has_more?\n# =\u003e true\n\n# use the next page cursor in your next response\nlist2 = client.sites.list(limit: 1, starting_after: list.last_id)\n```\n\n### Sites\n\n```ruby\nclient.sites.list\n# Optionally, pass params in to filter / limit responses\n# Limit can be between 1 and 100\nclient.sites.list(limit: 1, starting_after: \"SITE_ID\")\n# =\u003e Fathom::List\n\nclient.sites.retrieve(site_id: site_id)\nclient.sites.create({}) # Include `name` and other params\nclient.sites.update(site_id: site_id, {}) # Params being updated\nclient.sites.delete(site_id: site_id)\nclient.sites.wipe(site_id: site_id)\n# All return\n# =\u003e Fathom::Site\n```\n\n### Events\n\n```ruby\nclient.events.list(site_id: site_id)\n# =\u003e Fathom::List\n# Optionally, pass params in to filter / limit responses\n# Limit can be between 1 and 100\nclient.events.list(site_id: site_id, limit: 10, starting_after: \"EVENT_ID\")\n# =\u003e Fathom::List\n\nclient.events.retrieve(site_id: site_id, event_id: event_id)\nclient.events.create(site_id: site_id, {}) # Attributes for event\nclient.events.update(site_id: site_id, {}) # Attributes being updated\nclient.events.delete(site_id: site_id, event_id: event_id)\nclient.events.wipe(site_id: site_id, event_id: event_id)\n# All return\n# Fathom::Event\n```\n\n### Current Visitors\n\n```ruby\nclient.current_visitors(site_id: site_id, {}) # Can add detailed: true for a more detailed report\n```\n\n### Aggregation\n\n```ruby\nclient.aggregations.list(entity_id: entity_id, entity: entity, aggregates: aggregates, **params)\n```\n\nYou can find all the available parameters in the [official Fathom docs](https://usefathom.com/api#introduction)\n\n## 🙏 Contributing\n\nThis 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).\n\n## Code of Conduct\n\nEveryone interacting in the FathomApi project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/afomera/fathom_api/blob/main/CODE_OF_CONDUCT.md).\n\n## 📝 License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafomera%2Ffathom_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fafomera%2Ffathom_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafomera%2Ffathom_api/lists"}