{"id":20252769,"url":"https://github.com/pragmarb/pragma-client","last_synced_at":"2026-06-09T05:31:58.958Z","repository":{"id":145588064,"uuid":"122825690","full_name":"pragmarb/pragma-client","owner":"pragmarb","description":"Build clients for your Pragma-based APIs.","archived":false,"fork":false,"pushed_at":"2019-03-17T18:26:49.000Z","size":87,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-03T16:50:21.102Z","etag":null,"topics":["api","client","http","rest"],"latest_commit_sha":null,"homepage":"","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/pragmarb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","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-02-25T10:25:51.000Z","updated_at":"2019-03-17T18:26:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"8bad66bb-a3cc-4b16-a9f2-b403dd2269ab","html_url":"https://github.com/pragmarb/pragma-client","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pragmarb/pragma-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pragmarb%2Fpragma-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pragmarb%2Fpragma-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pragmarb%2Fpragma-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pragmarb%2Fpragma-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pragmarb","download_url":"https://codeload.github.com/pragmarb/pragma-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pragmarb%2Fpragma-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34093774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","client","http","rest"],"created_at":"2024-11-14T10:19:18.409Z","updated_at":"2026-06-09T05:31:58.937Z","avatar_url":"https://github.com/pragmarb.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pragma::Client\n\n[![Build Status](https://travis-ci.org/pragmarb/pragma-client.svg?branch=master)](https://travis-ci.org/pragmarb/pragma-client)\n[![Coverage Status](https://coveralls.io/repos/github/pragmarb/pragma-client/badge.svg?branch=master)](https://coveralls.io/github/pragmarb/pragma-client?branch=master)\n[![Maintainability](https://api.codeclimate.com/v1/badges/986b54b1951aef56ce0e/maintainability)](https://codeclimate.com/github/pragmarb/pragma-client/maintainability)\n\nWelcome to Pragma::Client, a gem for implementing clients for Pragma-based APIs.\n\nThe clients you can build with this gem are very similar to [Stripe's Ruby client](https://github.com/stripe/stripe-ruby)\nin features and behavior.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'pragma-client'\n```\n\nAnd then execute:\n\n```bash\n$ bundle\n```\n\nOr install it yourself as:\n\n```bash\n$ gem install pragma-client\n```\n\n## Usage\n\n### Configuring clients\n\nFirst of all, you should define your base resource class:\n\n```ruby\nmodule BlogService\n  class Resource \u003c Pragma::Client::Resource\n    # Define the root URL of the API.\n    self.root_url = 'https://www.example.com/api/v1'\n    \n    # Define authentication logic.\n    authenticate_with do |request|\n      request.query_params[:api_key] = '...'\n      # or maybe:\n      request.headers['Authorization'] = 'Bearer ...' \n    end\n  end\nend\n```\n\nNow, you can start creating API resources:\n\n```ruby\nmodule BlogService\n  class Category \u003c Resource\n    # Optional: This will be inferred if not provided.\n    self.base_url = '/categories'\n    \n    # This assumes you have a `by_category` filter on /articles.\n    has_many :articles\n  end\n  \n  class Article \u003c Resource\n    belongs_to :category\n  end\nend\n```\n\n### Using clients\n\nHere are some usage examples:\n\n```ruby\n# Retrieve a category:\ncategory = BlogService::Category.retrieve('test-category')\n\n# Retrieve the articles of the category. This will loop through all the pages:\ncategory.articles.each do |article|\n  puts article.title\nend\n\n# Create a new article in the category:\ncategory.articles.create(\n  title: 'New Article', \n  body: 'This is the body of my article',\n) \n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/pragmarb/pragma-client. \nThis project is intended to be a safe, welcoming space for collaboration, and contributors are \nexpected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the Pragma::Client project’s codebases, issue trackers, chat rooms and \nmailing lists is expected to follow the [code of conduct](https://github.com/pragmarb/pragma-client/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpragmarb%2Fpragma-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpragmarb%2Fpragma-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpragmarb%2Fpragma-client/lists"}