{"id":48102160,"url":"https://github.com/ibalosh/pet_tracker","last_synced_at":"2026-04-04T15:45:09.471Z","repository":{"id":305656969,"uuid":"1023080315","full_name":"ibalosh/pet_tracker","owner":"ibalosh","description":null,"archived":false,"fork":false,"pushed_at":"2025-10-29T08:44:24.000Z","size":122,"stargazers_count":0,"open_issues_count":10,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-29T10:33:24.511Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ibalosh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-20T13:39:26.000Z","updated_at":"2025-10-29T08:43:21.000Z","dependencies_parsed_at":"2025-10-29T10:24:03.012Z","dependency_job_id":"ab2215ad-1040-45c5-aa85-a0a0ff63fac5","html_url":"https://github.com/ibalosh/pet_tracker","commit_stats":null,"previous_names":["ibalosh/pet_tracker"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ibalosh/pet_tracker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibalosh%2Fpet_tracker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibalosh%2Fpet_tracker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibalosh%2Fpet_tracker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibalosh%2Fpet_tracker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ibalosh","download_url":"https://codeload.github.com/ibalosh/pet_tracker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibalosh%2Fpet_tracker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31403961,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2026-04-04T15:45:08.675Z","updated_at":"2026-04-04T15:45:09.448Z","avatar_url":"https://github.com/ibalosh.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🐾 Pet Tracker API\n\n[![CI](https://github.com/ibalosh/pet_tracker/actions/workflows/ci.yml/badge.svg)](https://github.com/ibalosh/pet_tracker/actions/workflows/ci.yml)\n\nRuby on Rails API-only app that tracks pets using various types of trackers and reports how many are currently outside the \npower saving zone grouped by pet type and tracker type. The system supports both data ingestion and querying via a REST API.\n\n## Getting Started\n\n### Requirements\n- Ruby version in `.ruby-version` file \n- Rails 7+\n- Bundler\n- SQLite (in-memory, no setup needed)\n\n### Setup\n\n1. Clone the repository \n2. Execute the below commands, in root folder of the Rails app, to install gem, loads the schema and seeds example data\n\n```bash\nbundle install\nbin/rails db:setup\n```\n\nOnce the setup is complete, you can start the Rails server:\n\n```bash\nbin/rails server\n```\n\n`db/seeds.rb` creates a few example records for testing purposes.\n\n## Running Tests\n\nTo run the test suite, execute the following command in the root folder\n\n```bash\nbundle exec rspec\n```\n\n## API Notes\n\nDetailed API usage and endpoints are documented in [API_REFERENCE.md](API_REFERENCE.md)\n\n### Design Notes\n\n- Normalized db schema\n- In-memory SQLite for easy testing \u0026 setup \u0026 swapping\n- API endpoints for data ingestion and querying, with pagination\n  - in order to paginate use `?page=X` query parameter\n\n#### Assumptions\n\n- `in_zone` is **not calculated dynamically**, but a stored boolean field in the `trackers` table\n- The `lost_tracker` attribute:\n    - Is only valid for **cats**\n    - Enforced via a model validation on trackers\n    - if tracker is lost, we don't count that entry containing it in in_zone=true/false calculation since we can't know whether Pet is in zone\n- The `tracker_type` can only have one type of category per species:\n  - category `small` can be created only once for `dog`\n- The `/tracker_summaries` endpoint applies filters as follows:\n    - If the `in_zone` filter is **not provided**, it's used by default value `false`\n    - Only **trackers with `lost_tracker: false`** are included in the summary\n    - Filtering by `pet_type` (e.g. `\"Dog\"` or `\"Cat\"`) and `tracker_type` (e.g. `\"small\"`, `\"medium\"`) is optional\n    - If no filters are provided, all trackers are included in the summary\n- The summary data is grouped by:\n    - `species_id` (i.e. pet type)\n    - `tracker_type_id` (i.e. tracker type)\n- Pet can have multiple trackers\n\n### Postman Collection\n\nA Postman collection with all requests is included in the repo as `postman_collection.json` in **docs** folder.\n\n### Quick API Demo with `curl`\n\nYou can use the following `curl` commands to manually create and retrieve data, verifying the main \nfunctionality without relying on seed data.\n\n### 1. Create Species\n\n```bash\ncurl -X POST http://localhost:3000/species \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"name\": \"Cat\"}'\n\ncurl -X POST http://localhost:3000/species \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"name\": \"Dog\"}'\n```\n### 2. Create Tracker Types\n\n```bash\ncurl -X POST http://localhost:3000/tracker_types \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"category\": \"medium\", \"species_id\": 1}'\n```\n### 3. Create Owners and Pets\n\n```bash\ncurl -X POST http://localhost:3000/owners \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"name\": \"Alice\", \"email\": \"alice@example.com\"}'\n\ncurl -X POST http://localhost:3000/pets \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"name\": \"Whiskers\",\n    \"owner_id\": 1,\n    \"species_id\": 1\n  }'\n```\n\n### 4. Create Trackers and Trackers Summaries\n\nWith no filter set, `in_zone` filter will be set to false.\n\n```bash\ncurl -X POST http://localhost:3000/trackers \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"pet_id\": 1,\n    \"tracker_type_id\": 1,\n    \"in_zone\": false\n  }'\n\ncurl -X GET \"http://localhost:3000/tracker_summaries\"\ncurl -X GET \"http://localhost:3000/tracker_summaries?in_zone=false\u0026pet_type=Cat\u0026tracker_type=medium\"\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibalosh%2Fpet_tracker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fibalosh%2Fpet_tracker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibalosh%2Fpet_tracker/lists"}