{"id":15561931,"url":"https://github.com/ebyrds/restaurants","last_synced_at":"2025-03-29T04:43:21.547Z","repository":{"id":158106008,"uuid":"151866385","full_name":"EByrdS/restaurants","owner":"EByrdS","description":"REST API with usefull information about restaurants.","archived":false,"fork":false,"pushed_at":"2018-10-11T13:14:33.000Z","size":60,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-03T14:32:40.947Z","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/EByrdS.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":"2018-10-06T17:48:59.000Z","updated_at":"2018-10-11T13:14:34.000Z","dependencies_parsed_at":"2024-08-14T15:45:20.153Z","dependency_job_id":null,"html_url":"https://github.com/EByrdS/restaurants","commit_stats":{"total_commits":27,"total_committers":2,"mean_commits":13.5,"dds":0.03703703703703709,"last_synced_commit":"b9db12391d33874db502b0bc80cb6249c278ebe2"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EByrdS%2Frestaurants","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EByrdS%2Frestaurants/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EByrdS%2Frestaurants/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EByrdS%2Frestaurants/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EByrdS","download_url":"https://codeload.github.com/EByrdS/restaurants/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246140541,"owners_count":20729797,"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-10-02T16:10:44.688Z","updated_at":"2025-03-29T04:43:21.524Z","avatar_url":"https://github.com/EByrdS.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# README\n\nThis proyect is a REST API with CRUD operations on restaurants.\nThis API responds in JSON and ignores the requested format if provided.\n\nBehavior Driven Development is guided with `guard`.\nTesting with `rspec`.\nRuby style guide with `rubocop`.\n\nServer running with `rails` as an\n[API](https://guides.rubyonrails.org/api_app.html),\nusing `postgresql-9.5` database.\n\nDeployment App is in [Heroku](https://melp-restaurants.herokuapp.com/)\n\n## Database\nData validation on database-level is austere as its requirements were not\nspecified.\n\n* Latitude `lat` can't be empty.\n* Longitude `lng` can't be empty.\n* `local_id` can't be empty and has to be unique.\n\nValidation on Rails::ActiveRecord model will check for the presence of\n`lat`, `lng` and `local_id`.\nIt will also validate that the rating is between 0 and 4 inclusive.\n\nBefore the record is saved, a `POINT` is created using `lat` and `lng` if they\nwere changed. (It will happen on creation aswell as they chage from being empty).\n\nThe scope `within` was added to class Restaurant to easier find records within\na certain distance of one point, given in latitude, longitude and distance.\n\nThe attributes of the table `restaurants` (and thus the model `Restaurant`) are:\n* `id`: **PK**, integer (As default by Rails)\n* `rating`: integer\n* `local_id`: string, index: true, unique: true\n* `name`: string\n* `site`: string\n* `email`: string\n* `phone`: string\n* `street`: string\n* `city`: string\n* `state`: string\n* `lat`: float, null: false\n* `lng`: float, null: false\n* `created_at` datetime, null: false (As default by Rails)\n* `updated_at` datetime, null: false (As deault by Rails)\n* `lonlat`: st_point, srid: 4326, geographic: true (Datatype provided by PostGIS)\n\n### PostGIS\nPostGIS is used to make spatial queries. To use it, an extension on\nPostgreSQL is needed. This extension may be created manually or using\nthe command `rails db:gis:setup` after\nthe gem `activerecord-postgis-adapter` is installed.\n\nThe function `ST_Distance` used to calculate the distance between two points\nuses *meters* as the distance unit by default.\n\n### Routes\nAll responses are in JSON format.\n\nAvailable routes are:\n\n* `GET /restaurants` will show all available restaurants\n* `GET /restaurants/:local_id` will show all the attributes of the restaurat\nmatching that local\\_id.\n* `POST /restaurants` will expect parameters named exactly as the restaurant\nattributes and create a new restaurant.\n* `PATCH/PUT /restaurants/:local_id` will update that restaurant with new data.\nNote that the parameter `local_id` in the new data will be ignored\nso that attribute will remain unchanged.\n* `DELETE /restaurants/:local_id` will delete the restaurant from the database.\n* `GET /restaurants/statistics` receives the\nparameters: `longitude`, `latitude` and `radius` to return how many restaurants\nare in that area, and the average \u0026 standard deviation of their ratings.\n* The root `/` redirects to `/restaurants`\n\n### Specs\n`ffaker` gem is use to create random data for columns like city and email.\nThis random data is sent to `FactoryBot` to build restaurants using the model\n`Restaurant` class.\n\nController Specs assert correct response format, and changes in database.\n\nModel Specs assert validity of records.\n\nRouting Specs assert correct matching of url with controller actions.\n\nRequest Specs were eliminated as there is no need for complex user flows to assert.\n\nFor documentation on specific functionality refer to each spec.\n\n### Details\nEach restaurant record will have its own id in this database, as an incrementing integer.\nThis is used to separate database managing from data itself. This local_id must be unique\nand has an index on the table `restaurants`.\n\n`rubocop` is used as the style guide enforcer. All code in master is expected\nto compel to its rules as long as Specs are still green.\n\nDatabase configuration is not in this repo, as specified in the `.gitignore` file.\nA local `config/database.yml` file may be required.\n\n#### Known Issues\nThe column `lonlat` should be eliminated and introduce the attributes `lng`\nand `lat` to create that point on each query.\n\nThe email should be validated to have a correct format in `Restaurant` class.\n\nThe telephone should be validated to have a correct format in `Restaurant` class.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Febyrds%2Frestaurants","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Febyrds%2Frestaurants","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Febyrds%2Frestaurants/lists"}