{"id":21239637,"url":"https://github.com/mdsrosa/routes_api","last_synced_at":"2025-07-30T04:03:25.235Z","repository":{"id":35809530,"uuid":"40091923","full_name":"mdsrosa/routes_api","owner":"mdsrosa","description":"API to calculate the shortest path and the cost to a given route (origin point and destination point), based on fuel price and vehicle's autonomy.","archived":false,"fork":false,"pushed_at":"2015-11-23T22:09:17.000Z","size":31,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-21T19:26:39.182Z","etag":null,"topics":[],"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/mdsrosa.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}},"created_at":"2015-08-02T20:29:54.000Z","updated_at":"2015-08-04T12:56:42.000Z","dependencies_parsed_at":"2022-09-08T17:52:13.304Z","dependency_job_id":null,"html_url":"https://github.com/mdsrosa/routes_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/mdsrosa%2Froutes_api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsrosa%2Froutes_api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsrosa%2Froutes_api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsrosa%2Froutes_api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdsrosa","download_url":"https://codeload.github.com/mdsrosa/routes_api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243680981,"owners_count":20330155,"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":[],"created_at":"2024-11-21T00:44:38.707Z","updated_at":"2025-03-15T03:41:40.182Z","avatar_url":"https://github.com/mdsrosa.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Routes API\n[![Build Status](https://travis-ci.org/mdsrosa/routes_api.svg?branch=master)](https://travis-ci.org/mdsrosa/routes_api)\n\nAPI to calculate the shortest path and the cost to a given route (origin point and destination point), based on fuel price and vehicle's autonomy.\n\n# Installation\n###### **Considering you already have a ruby development environment setup.**\n\n```bash\ngit clone https://bitbucket.org/mdsrosa/routes_api.git\ncd routes_api\nbundle install\n```\n\n### Running Locally\n```bash\nrackup -p 4567 -s puma\n```\n\n# Endpoints\n\n#### GET /routes\n\nThis endpoint lists all routes in the database.\n\n#### cURL Example\n\n```bash\n$ curl http://routes-api.herokuapp.com/routes\n```\n#### Response Example\n```bash\n[{\"id\":1,\"origin_point\":\"A\",\"destination_point\":\"B\",\"distance\":10},\n {\"id\":2,\"origin_point\":\"A\",\"destination_point\":\"C\",\"distance\":20},\n {\"id\":3,\"origin_point\":\"B\",\"destination_point\":\"D\",\"distance\":15},\n {\"id\":4,\"origin_point\":\"C\",\"destination_point\":\"D\",\"distance\":30},\n {\"id\":5,\"origin_point\":\"B\",\"destination_point\":\"E\",\"distance\":50},\n {\"id\":6,\"origin_point\":\"D\",\"destination_point\":\"E\",\"distance\":30}]\n```\n\n#### POST /routes\nThis endpoint creates a new route.\n\n#### Attributes\n\nName            | Type | Description | Example\n----------------|------|------------ |--------\n**origin_point**| _string_ | The point of origin| `\"A\"`\n**destination_point**| _string_ | The point of destination| `\"D\"`\n**distance**| _integer_ |The vehicle's autonomy| `10`\n\n##### cURL Example\n```bash\n$ curl -X POST http://routes-api.herokuapp.com/routes \\\n-H \"Content-Type: application/json\" \\\n-d '{\"origin_point\": \"A\", \"destination_point\": \"D\", \"distance\": 10}'\n```\n\n##### Response Example\n```bash\n{\"id\":1,\"origin_point\":\"A\",\"destination_point\":\"D\",\"distance\":10}\n```\n\n#### POST /routes/calculate-cost\n\nThis endpoint calculates the cost.\n\n#### Attributes\n\nName            | Type | Description | Example\n----------------|------|------------ |--------\n**origin_point**| _string_ | The point of origin| `\"A\"`\n**destination_point**| _string_ | The point of destination| `\"D\"`\n**autonomy**| _integer_ |The vehicle's autonomy| `10`\n**fuel_price**| _float_ |The fuel price|`2.5`\n\n##### cURL Example\n```bash\n$ curl -X POST http://routes-api.herokuapp.com/routes/calculate-cost \\\n-H \"Content-Type: application/json\" \\\n-d '{\"origin_point\": \"A\", \"destination_point\": \"D\", \"autonomy\": 10, \"fuel_price\": 2.5}'\n```\n##### Response Example\n```json\n{\"cost\":6.25,\"route\":\"A B D\"}\n```\n\n\n# Testing\n```bash\nrake test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdsrosa%2Froutes_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdsrosa%2Froutes_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdsrosa%2Froutes_api/lists"}