{"id":13631801,"url":"https://github.com/fredwu/api_taster","last_synced_at":"2025-05-15T17:04:51.537Z","repository":{"id":3658085,"uuid":"4726328","full_name":"fredwu/api_taster","owner":"fredwu","description":"A quick and easy way to visually test your Rails application's API.","archived":false,"fork":false,"pushed_at":"2015-03-20T08:52:32.000Z","size":548,"stargazers_count":727,"open_issues_count":11,"forks_count":85,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-05-08T03:48:44.641Z","etag":null,"topics":["api","factory-girl","testfactory","testing"],"latest_commit_sha":null,"homepage":"http://fredwu.github.com/api_taster","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/fredwu.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":"2012-06-20T13:06:55.000Z","updated_at":"2024-09-20T20:00:46.000Z","dependencies_parsed_at":"2022-08-19T02:51:32.332Z","dependency_job_id":null,"html_url":"https://github.com/fredwu/api_taster","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredwu%2Fapi_taster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredwu%2Fapi_taster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredwu%2Fapi_taster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredwu%2Fapi_taster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fredwu","download_url":"https://codeload.github.com/fredwu/api_taster/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254384987,"owners_count":22062422,"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":["api","factory-girl","testfactory","testing"],"created_at":"2024-08-01T22:02:39.154Z","updated_at":"2025-05-15T17:04:51.513Z","avatar_url":"https://github.com/fredwu.png","language":"Ruby","readme":"# ApiTaster [![endorse](http://api.coderwall.com/fredwu/endorsecount.png)](http://coderwall.com/fredwu) [![Build Status](https://secure.travis-ci.org/fredwu/api_taster.png?branch=master)](http://travis-ci.org/fredwu/api_taster) [![Dependency Status](https://gemnasium.com/fredwu/api_taster.png)](https://gemnasium.com/fredwu/api_taster)\n\n### NOTE\n\u003e If you want to use this gem with Rails 3x/4.0 please specify version 0.7.0 in\nyour Gemfile.\n\n\u003e Version 0.8 of this gem is compatible only with Rails 4.1.\n\nA quick and easy way to visually test your Rails application's API.\n\n![](http://i.imgur.com/8Dnto.png)\n\n## Why?\n\nThere are already many awesome API clients (such as [Postman](https://chrome.google.com/webstore/detail/fdmmgilgnpjigdojojpjoooidkmcomcm)), so why reinvent the wheel?\n\nAPI Taster compared to alternatives, have the following advantages:\n\n- API endpoints are automatically generated from your Rails routes definition\n- Defining params is as easy as defining routes\n- Params can be shared with your test factories\n\n## Usage\n\nAdd API Taster in your gemfile:\n\n```ruby\ngem 'api_taster'\n```\nMount API Taster, this will allow you to visit API Taster from within your app. For example:\n\n```ruby\nRails.application.routes.draw do\n  mount ApiTaster::Engine =\u003e \"/api_taster\" if Rails.env.development?\nend\n```\n\nIn `lib/api_tasters/routes.rb`, define parameters for each API endpoint after the normal routes definition block. For example:\n\n```ruby\nif Rails.env.development?\n  ApiTaster.routes do\n    desc 'Get a __list__ of users'\n    get '/users'\n\n    post '/users', {\n      :user =\u003e {\n        :name =\u003e 'Fred'\n      }\n    }\n\n    get '/users/:id', {\n      :id =\u003e 1\n    }\n\n    put '/users/:id', {\n      :id =\u003e 1, :user =\u003e {\n        :name =\u003e 'Awesome'\n      }\n    }\n\n    delete '/users/:id', {\n      :id =\u003e 1\n    }\n  end\nend\n```\n\nYou can change the default `lib/api_tasters/routes.rb` path by creating `config/initializers/api_taster.rb` with the content below:\n```ruby\nApiTaster.route_path = Rails.root.to_s + \"/app/api_tasters\" # just an example\n```\n\n### Share Params with Test Factories\n\nIf you use a test factory such as [FactoryGirl](https://github.com/thoughtbot/factory_girl), you can require your test factories and share the params. For example in FactoryGirl you can use the `attributes_for(:name_of_factory)` method.\n\n### Custom Headers\n\nIf there are certain headers (such as auth token) that need to be present to\nconsume an API endpoint, you may set then in `APITaster.global_headers` before\n`APITaster.routes`:\n\n```ruby\nApiTaster.global_headers = {\n  'Authorization' =\u003e 'Token token=teGpfbVitpnUwm7qStf9'\n}\n\nApiTaster.routes do\n  # your route definitions\nend\n```\n\n### Global Params\n\nIf there are certain params (such as API version and auth token) that need to be present in every API endpoint, you may set them in `ApiTaster.global_params` before `ApiTaster.routes`:\n\n```ruby\nApiTaster.global_params = {\n  :version    =\u003e 1,\n  :auth_token =\u003e 'teGpfbVitpnUwm7qStf9'\n}\n\nApiTaster.routes do\n  # your route definitions\nend\n```\n\n### Commenting API Endpoints\n\nBefore each route definitions, you may use `desc` to add some comments. Markdown is supported.\n\n```ruby\ndesc 'Get a __list__ of users'\nget '/users'\n```\n\n### Metadata for API Endpoints\n\nFor each route definition, you may supply an optional third parameter (hash) as metadata:\n\n```ruby\nget '/users', {}, { :meta =\u003e 'data' }\n```\n\nThe metadata option is useful for passing in arbitrary data for a route definition. For example, you could specify response expectations so that your test suite could tap into them.\n\nMetadata for every route definition are stored in `ApiTaster::Route.metadata`. Please read the source code to find out how to get metadata for a particular route.\n\n### Missing Route Definitions Detection\n\nInstead of manually finding out which route definitions you need, API Taster provides a warning page that shows you all the missing definitions.\n\n![](http://i.imgur.com/vZb93.png)\n\n### Obsolete / Mismatched Route Definitions Detection\n\nAPIs evolve - especially during the development stage. To keep `ApiTaster.routes` in sync with your route definitions, API Taster provides a warning page that shows you the definitions that are obsolete/mismatched therefore you could correct or remove them.\n\n![](http://i.imgur.com/qK7g5.png)\n\n## License\n\nThis gem is released under the [MIT License](http://www.opensource.org/licenses/mit-license.php).\n\n## Author\n\n[Fred Wu](https://github.com/fredwu), originally built for [Locomote](http://locomote.com.au).\n\n\n[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/fredwu/api_taster/trend.png)](https://bitdeli.com/free \"Bitdeli Badge\")\n\n","funding_links":[],"categories":["Testing","Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffredwu%2Fapi_taster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffredwu%2Fapi_taster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffredwu%2Fapi_taster/lists"}