{"id":28355343,"url":"https://github.com/artkirienko/geolocation-api-takehome-assignment","last_synced_at":"2026-05-01T06:32:59.775Z","repository":{"id":210613937,"uuid":"727019152","full_name":"artkirienko/geolocation-api-takehome-assignment","owner":"artkirienko","description":"📝Test assignment for Senior Ruby on Rails Engineer position","archived":false,"fork":false,"pushed_at":"2023-12-04T08:19:01.000Z","size":132,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-20T10:40:09.536Z","etag":null,"topics":["coding-challenge","coding-task","coding-test","home-assignment","home-task","home-test","rails","ruby","ruby-on-rails","take-home-assignment","take-home-project","take-home-test","takehome","test","test-assignment"],"latest_commit_sha":null,"homepage":"","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/artkirienko.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}},"created_at":"2023-12-04T02:28:43.000Z","updated_at":"2025-05-24T16:33:14.000Z","dependencies_parsed_at":"2023-12-04T03:25:59.915Z","dependency_job_id":"4c9191d9-1a8b-4120-bd74-773311f218b6","html_url":"https://github.com/artkirienko/geolocation-api-takehome-assignment","commit_stats":null,"previous_names":["artkirienko/geolocation-api-takehome-assignment"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/artkirienko/geolocation-api-takehome-assignment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artkirienko%2Fgeolocation-api-takehome-assignment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artkirienko%2Fgeolocation-api-takehome-assignment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artkirienko%2Fgeolocation-api-takehome-assignment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artkirienko%2Fgeolocation-api-takehome-assignment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/artkirienko","download_url":"https://codeload.github.com/artkirienko/geolocation-api-takehome-assignment/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artkirienko%2Fgeolocation-api-takehome-assignment/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32487426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["coding-challenge","coding-task","coding-test","home-assignment","home-task","home-test","rails","ruby","ruby-on-rails","take-home-assignment","take-home-project","take-home-test","takehome","test","test-assignment"],"created_at":"2025-05-28T04:10:01.234Z","updated_at":"2026-05-01T06:32:59.769Z","avatar_url":"https://github.com/artkirienko.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/artkirienko/geolocation-api-takehome-assignment/issues)\n[![Ruby on Rails CI](https://github.com/artkirienko/geolocation-api-takehome-assignment/actions/workflows/rubyonrails.yml/badge.svg)](https://github.com/artkirienko/geolocation-api-takehome-assignment/actions/workflows/rubyonrails.yml)\n[![codecov](https://codecov.io/gh/artkirienko/geolocation-api-takehome-assignment/branch/main/graph/badge.svg)](https://codecov.io/gh/artkirienko/geolocation-api-takehome-assignment)\n[![Maintainability](https://api.codeclimate.com/v1/badges/dd4afc9ff1e4fd70f753/maintainability)](https://codeclimate.com/github/artkirienko/geolocation-api-takehome-assignment/maintainability)\n[![SLOC](https://sloc.xyz/github/artkirienko/geolocation-api-takehome-assignment)](https://en.wikipedia.org/wiki/Source_lines_of_code)\n[![Hits-of-Code](https://hitsofcode.com/github/artkirienko/geolocation-api-takehome-assignment?branch=main)](https://hitsofcode.com/github/artkirienko/geolocation-api-takehome-assignment/view?branch=main)\n\n# Testing Task - Ruby API - Geolocation with external integration\n\nNeed to write a simple API backed by any kind of database. The application should be able to store geolocation data in the database, based on IP address or URL. You can use [ipstack.com](https://ipstack.com/) as a service provider for geolocation data. The API should be able to add, delete or provide geolocation data on the base of ip address or URL. [Original document](./docs/RoR%20Test%20Task.pdf)\n\n### Application specification:\n\n- It should be a RESTful API\n- Keep it mind that the geolocation module should be written in the way that in the future it should be easy to change the service provider.\n- It is preferable that the API operates using JSON (for both input and output). Ideally it should follow JSON API standard.\n- The solution should also include base specs/tests coverage. If you don’t have enough time, write complete specs for selected endpoint or module.\n- As a bonus you can make all endpoints secure, not available to public.\n\n### How to submit: Create a public Git repository and share the link with us\n\n### Notes:\n\n- Pay special attention to handling errors and edge cases. We will test the behavior of the system under various “unfortunate” conditions.\n- We will run the application on our local machines for testing purposes. This implies that the solution should provide a quick and easy way to get the system up and running, including test data (hint: you can add Docker support so we can run it easily)\n\n### Requirements\n\nRuby 3.2.2, PostgreSQL 14.10, Redis 7.2.3 or **Docker**\n\n### Run with Docker\n\n```bash\ndocker-compose up\n```\n\n### Run test suite\n\n```bash\ndocker-compose exec -e RAILS_ENV=test rails bundle exec rspec\n```\n\n## !Important\n\n### My assumptions\n\nMy assumptions are as follows regarding the user story for this service:\n\n- user creates a location record via our API by providing an IP address\n- a record is enriched with geolocation data if available for this IP address\n- user can retrieve information for a single location from our API by providing the location ID\n- user can read all location records from our API by iterating through pagination\n- user can update a location record via our API by providing a new IP address and location ID\n- user can delete a single location from our API by providing the location ID\n\nI assume that the service is not write-intensivve, but is read-intensive. The strategy to manage the read load includes:\n\n- Implementation of proper indexes as we use PostgreSQL database\n- Adoption of pagination to prevent resource-intensive queries that fetch all records, followed by serialization and JSON response generation\n- Integration of caching using Redis\n- Implementation of endpoint security to ensure that only verified users can access our API\n- Utilization of the [rack-attack](https://github.com/rack/rack-attack) rack middleware to block and throttle abusive requests\n- Incorporation of load balancing measures during deployment to production\n- Deployment of read-only replicas of the database in a production environment\n\n### Requests examples\n\n- List all locations paginated\n  ```bash\n  curl --location 'http://localhost:3000/api/v1/locations/'\n  ```\n- Iterate through paginated list of all locations\n  ```bash\n  curl --location 'http://localhost:3000/api/v1/locations?page[number]=2'\n  ```\n- Show single location by id\n  ```bash\n  curl --location 'http://localhost:3000/api/v1/locations/1'\n  ```\n- Create a location using IP address\n  ```bash\n  curl --location 'http://localhost:3000/api/v1/locations' \\\n  --header 'Content-Type: application/vnd.api+json' \\\n  --header 'Accept: application/vnd.api+json' \\\n  --data '{\n    \"data\": {\n      \"type\": \"locations\",\n      \"attributes\": {\n        \"ip\": \"173.13.2.11\"\n      }\n    }\n  }'\n  ```\n- Update a location using id and new IP address\n  ```bash\n  curl --location --request PATCH 'http://localhost:3000/api/v1/locations/5' \\\n  --header 'Content-Type: application/vnd.api+json' \\\n  --header 'Accept: application/vnd.api+json' \\\n  --data '{\n    \"data\": {\n      \"type\": \"locations\",\n      \"attributes\": {\n        \"ip\": \"172.56.10.74\"\n      }\n    }\n  }'\n  ```\n- Delete a location by id\n  ```bash\n  curl --location --request DELETE 'http://localhost:3000/api/v1/locations/7'\n  ```\n\n### References\n\n[FAANG System Design Interview: Design A Location Based Service (Yelp, Google Places)](https://www.youtube.com/watch?v=M4lR_Va97cQ)\n\n[PostGIS vs. Geocoder in Rails](https://pganalyze.com/blog/postgis-rails-geocoder)\n\n### TODO\n\n- Query URL with [GeoIP Gem](https://github.com/cjheath/geoip)\n- Use [JSONAPI::Resources Gem](https://jsonapi-resources.com/) instead of [jsonapi-serializer](https://github.com/jsonapi-serializer/jsonapi-serializer) and [jsonapi.rb](https://github.com/stas/jsonapi.rb)\n- Add JWT authentication\n- Use Redis for caching\n- Add [rack-attack](https://github.com/rack/rack-attack) rack middleware for blocking \u0026 throttling abusive requests\n- Add code documentation with [yard](https://github.com/lsegal/yard)\n- Add PostGIS if fast nearby locations search needed\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartkirienko%2Fgeolocation-api-takehome-assignment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartkirienko%2Fgeolocation-api-takehome-assignment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartkirienko%2Fgeolocation-api-takehome-assignment/lists"}