{"id":18546651,"url":"https://github.com/proctoru/daredevil","last_synced_at":"2025-05-15T07:09:25.934Z","repository":{"id":59152719,"uuid":"97237973","full_name":"ProctorU/daredevil","owner":"ProctorU","description":"Add JSON errors to your Rails app.","archived":false,"fork":false,"pushed_at":"2018-06-27T18:00:04.000Z","size":50,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":31,"default_branch":"master","last_synced_at":"2025-05-15T07:09:02.209Z","etag":null,"topics":["proctoru"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ProctorU.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-14T13:42:25.000Z","updated_at":"2018-06-27T17:54:21.000Z","dependencies_parsed_at":"2022-09-22T09:10:26.383Z","dependency_job_id":null,"html_url":"https://github.com/ProctorU/daredevil","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProctorU%2Fdaredevil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProctorU%2Fdaredevil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProctorU%2Fdaredevil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProctorU%2Fdaredevil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ProctorU","download_url":"https://codeload.github.com/ProctorU/daredevil/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254292042,"owners_count":22046426,"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":["proctoru"],"created_at":"2024-11-06T20:26:20.094Z","updated_at":"2025-05-15T07:09:20.926Z","avatar_url":"https://github.com/ProctorU.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Daredevil\n\nThis gem provides insight to api errors by providing messages for all general server error response codes. It is inspired by the [json_api_responders](https://github.com/stankec/json_api_responders) gem.\n\n## Table of contents\n\n- [Status](#status)\n- [Installation](#installation)\n- [Configuration](#configuration)\n- [Usage](#usage)\n- [Developing](#developing)\n- [License](#license)\n- [Credits](#credits)\n\n## Status\n\n[![CircleCI](https://circleci.com/gh/ProctorU/daredevil.svg?style=svg)](https://circleci.com/gh/ProctorU/daredevil)\n\n## Installation\n\nAdd `daredevil` to your application's `Gemfile`:\n\n```ruby\ngem 'daredevil'\n```\n\nAnd then execute:\n\n```bash\n$ bundle\n```\n\nInside your base controller, include the module:\n\n```ruby\nmodule Api\n  module V1\n    class BaseController \u003c ApplicationController\n      include Daredevil\n    end\n  end\nend\n```\n\n## Configuration\n\nIf you would like to use serializers instead of jbuilder, you can add a config initializer.\n\n```ruby\nDaredevil.configure do |config|\n  config.responder_type = :serializers\nend\n```\n\n## Usage\n\nIf a status is not set, the default status will be returned.\n\n```ruby\nclass ResourceController\n  before_action :set_resource\n\n  def index\n    respond_with @resources\n  end\n\n  def show\n    respond_with @resource\n  end\n\n  def create\n    if resource.save\n      respond_with @resource, status: 201\n    else\n      respond_with @resource, status: 442\n    end\n  end\n\n  def update\n    if resource.valid?\n      respond_with @resource, status: 200\n    else\n      respond_with @resource, status: 442\n    end\n  end\n\n  def destroy\n    head status: 204\n  end\n\n  private\n\n  def set_resource; end\nend\n```\n\nIf serializers are set as the render method, Daredevil will try to infer which serializer _first_ by checking for a namespaced serializer, then fallback to a non-namespaced serializer.\n\nThe following example will look for `Api::V1::UserSerializer` first, then if not found will look for `UserSerializer`.\n\n```ruby\nmodule Api\n  module V1\n    class UserController\n      def index\n        respond_with @users\n      end\n    end\n  end\nend\n```\n\nOr, specify a serializer specifically:\n\n\n```ruby\nmodule Api\n  module V1\n    class UserController\n      def index\n        respond_with @users, serializer: KustomUserSerializer\n      end\n    end\n  end\nend\n```\n\n## Developing\n\n1. Thank you! We love [our contributors](https://github.com/ProctorU/daredevil/graphs/contributors)!\n1. Clone the repository.\n1. Make your changes in a thoughtfully-named branch.\n1. Ensure 1:1 test coverage.\n1. Submit a [Pull Request](https://github.com/ProctorU/daredevil/pulls)!\n1. Celebrate! :tada:\n\n## License\n\nThis project rocks and uses MIT-LICENSE.\n\n## Credits\n\nDaredevil is maintained and funded by [ProctorU](https://twitter.com/ProctorU),\na simple online proctoring service that allows you to take exams or\ncertification tests at home.\n\n\u003cbr\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://twitter.com/ProctorUEng\"\u003e\n    \u003cimg src=\"https://s3-us-west-2.amazonaws.com/dev-team-resources/procki-eyes.svg\" width=108 height=72\u003e\n  \u003c/a\u003e\n\n  \u003ch3 align=\"center\"\u003e\n    \u003ca href=\"https://twitter.com/ProctorUEng\"\u003eProctorU Engineering \u0026 Design\u003c/a\u003e\n  \u003c/h3\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproctoru%2Fdaredevil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fproctoru%2Fdaredevil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproctoru%2Fdaredevil/lists"}