{"id":13879803,"url":"https://github.com/jsmestad/jsonapi-consumer","last_synced_at":"2025-04-09T13:10:37.797Z","repository":{"id":21987233,"uuid":"25312200","full_name":"jsmestad/jsonapi-consumer","owner":"jsmestad","description":"Client framework for consuming JSONAPI services in Ruby","archived":false,"fork":false,"pushed_at":"2021-07-13T22:38:27.000Z","size":170,"stargazers_count":94,"open_issues_count":3,"forks_count":18,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-02T12:05:20.971Z","etag":null,"topics":["activemodel","json-api","jsonapi-standards","ruby"],"latest_commit_sha":null,"homepage":"https://github.com/jsmestad/jsonapi-consumer","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jsmestad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-16T16:56:42.000Z","updated_at":"2023-03-15T10:30:15.000Z","dependencies_parsed_at":"2022-08-18T03:11:18.606Z","dependency_job_id":null,"html_url":"https://github.com/jsmestad/jsonapi-consumer","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsmestad%2Fjsonapi-consumer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsmestad%2Fjsonapi-consumer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsmestad%2Fjsonapi-consumer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsmestad%2Fjsonapi-consumer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsmestad","download_url":"https://codeload.github.com/jsmestad/jsonapi-consumer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248045245,"owners_count":21038554,"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":["activemodel","json-api","jsonapi-standards","ruby"],"created_at":"2024-08-06T08:02:33.957Z","updated_at":"2025-04-09T13:10:37.779Z","avatar_url":"https://github.com/jsmestad.png","language":"Ruby","readme":"# JSONAPI::Consumer\n\nAn ActiveModel-compliant consumer framework for communicating with JSONAPI-based APIs.\n\n[![CircleCI](https://circleci.com/gh/jsmestad/jsonapi-consumer/tree/master.svg?style=svg)](https://circleci.com/gh/jsmestad/jsonapi-consumer/tree/master)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'jsonapi-consumer', '~\u003e 1.0'\n```\n\nAnd then execute:\n\n    $ bundle\n\n## Usage\n\nIt's suggested to create a base resource for the whole API that you can re-use.\n\n```ruby\nclass Base \u003c JSONAPI::Consumer::Resource\n  # self.connection_options = {} # Faraday connection options\n  # self.json_key_format = :dasherized_key # (default: underscored_key)\n  # self.route_format = :dasherized_route # (default: underscored_route)\n  self.site = 'http://localhost:3000/api/'\nend\n```\n\nThen inherit from that Base class for each resource defined in your API.\n\n```ruby\nmodule Blog\n  class Author \u003c Base\n    has_many :posts, class_name: 'Blog::Post'\n  end\n\n  class Post \u003c Base\n    has_one :user, class_name: 'Blog::User'\n    has_many :comments, class_name: 'Blog::Comment'\n  end\n\n  class User \u003c Base\n\n  end\n\n  class Comment \u003c Base\n\n  end\nend\n```\n\n\n## Contributing\n\n1. Fork it ( https://github.com/jsmestad/jsonapi-consumer/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Copyright \u0026 License\n\nJSONAPI::Consumer is distributed under the Apache 2.0 License. See LICENSE.txt file for more information.\n\nVersion v1 is a rewrite is based on the excellent work by [json_api_client](https://github.com/chingor13/json_api_client) [v1.5.3](https://github.com/chingor13/json_api_client/tree/v1.5.3).\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsmestad%2Fjsonapi-consumer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsmestad%2Fjsonapi-consumer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsmestad%2Fjsonapi-consumer/lists"}