{"id":23456709,"url":"https://github.com/nemuba/service_client","last_synced_at":"2025-04-11T06:49:50.574Z","repository":{"id":65712080,"uuid":"597885192","full_name":"nemuba/service_client","owner":"nemuba","description":"The ServiceClient project on GitHub is a lightweight and flexible Ruby gem that simplifies making HTTP requests in Ruby projects. With an intuitive API, configurable base URL, and default headers, you can easily make GET, POST, PUT, and DELETE requests to RESTful APIs and receive responses in a consistent and structured format.","archived":false,"fork":false,"pushed_at":"2024-03-02T03:00:32.000Z","size":779,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T04:59:48.392Z","etag":null,"topics":["gem","http-client","ruby"],"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/nemuba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-02-05T22:52:27.000Z","updated_at":"2023-03-01T18:01:10.000Z","dependencies_parsed_at":"2024-03-02T03:31:46.938Z","dependency_job_id":"da8204ee-f246-47c5-8925-ae72355c1112","html_url":"https://github.com/nemuba/service_client","commit_stats":{"total_commits":30,"total_committers":2,"mean_commits":15.0,"dds":"0.23333333333333328","last_synced_commit":"65c3996704fd7fb13490d75a565c186077a9d405"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemuba%2Fservice_client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemuba%2Fservice_client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemuba%2Fservice_client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemuba%2Fservice_client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nemuba","download_url":"https://codeload.github.com/nemuba/service_client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248358549,"owners_count":21090401,"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":["gem","http-client","ruby"],"created_at":"2024-12-24T04:33:43.502Z","updated_at":"2025-04-11T06:49:50.557Z","avatar_url":"https://github.com/nemuba.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"*# ServiceClient\n\nWelcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/service_client`. To experiment with that code, run `bin/console` for an interactive prompt.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'service_client'\n```\n\nAnd then execute:\n\n```bash\nbundle install\n```\n\nOr install it yourself as:\n\n```bash\ngem install service_client\n```\n\n## Usage\n\nBasic usage example:\n\n```ruby\nclass CustomerClient \u003c ServiceClient::Base\n  base_url 'https://api.com'\n  default_headers content_type: 'application/json'\n\n  def find(id)\n    response = get(\"customers/#{id}\")\n\n    response.data\n  rescue ServiceClient::Errors::NoDataFoundError =\u003e e\n    puts e.response.code # 404\n    puts e.response.headers\n    puts e.response.data \n  rescue ServiceClient::Errors::InternalServerError =\u003e e\n    puts e.response.code # 500\n    puts e.response.headers\n    puts e.response.data\n  # All errors of HTTP status code\n  end\n\n  def all\n    get(nil)\n  rescue ServiceClient::ParamsRequired =\u003e e\n    puts e.message\n  end\nend\n```\n\n## Methods of class\n\n```ruby\n# GET\nServiceClient::Base.get(url, headers:)\n\n# POST\nServiceClient::Base.post(url, headers:, body:)\n\n# PUT\nServiceClient::Base.put(url, headers:, body:)\n\n# DELETE\nServiceClient::Base.delete(url, headers:, body:)\n```\n\n## Classes of errors\n\n```ruby\n  # 400 – Bad Request\n  ServiceClient::Errors::BadRequestError\n  # 401 – Unauthorized\n  ServiceClient::Errors::UnauthorizedError\n  # 402 – Payment Required\n  ServiceClient::Errors::PaymentRequiredError\n  # 403 – Forbidden\n  ServiceClient::Errors::ForbiddenError\n  # 404 – Not Found\n  ServiceClient::Errors::NotFoundError\n  # 405 – Method Not Allowed\n  ServiceClient::Errors::MethodNotAllowedError\n  # 406 – Not Acceptable\n  ServiceClient::Errors::NotAcceptableError\n  # 407 – Proxy Authentication Required\n  ServiceClient::Errors::ProxyAuthenticationRequiredError\n  # 408 – Request Timeout\n  ServiceClient::Errors::RequestTimeoutError\n  # 409 – Conflict\n  ServiceClient::Errors::ConflictError\n  # 410 – Gone\n  ServiceClient::Errors::GoneError\n  # 411 – Length Required\n  ServiceClient::Errors::LengthRequiredError\n  # 412 – Precondition Failed\n  ServiceClient::Errors::PreconditionFailedError\n  # 413 – Request Entity Too Large\n  ServiceClient::Errors::RequestEntityTooLargeError\n  # 414 – Request-URI Too Long\n  ServiceClient::Errors::RequestURITooLongError\n  # 415 – Unsupported Media Type\n  ServiceClient::Errors::UnsupportedMediaTypeError\n  # 416 – Requested Range Not Satisfiable\n  ServiceClient::Errors::RequestedRangeNotSatisfiableError\n  # 417 – Expectation Failed\n  ServiceClient::Errors::ExpectationFailedError\n  # 420 – Enhance Your Calm\n  ServiceClient::Errors::EnhanceYourCalmError\n  # 422 – Unprocessable Entity\n  ServiceClient::Errors::UnprocessableEntityError\n  # 423 – Locked\n  ServiceClient::Errors::LockedError\n  # 424 – Failed Dependency\n  ServiceClient::Errors::FailedDependencyError\n  # 426 – Upgrade Required\n  ServiceClient::Errors::UpgradeRequiredError\n  # 428 – Precondition Required\n  ServiceClient::Errors::PreconditionRequiredError\n  # 429 – Too Many Requests\n  ServiceClient::Errors::TooManyRequestsError\n  # 431 – Request Header Fields Too Large\n  ServiceClient::Errors::RequestHeaderFieldsTooLargeError\n  # 444 – No Response\n  ServiceClient::Errors::NoResponseError\n  # 449 – Retry With\n  ServiceClient::Errors::RetryWithError\n  # 450 – Bllocked by Windows Parental Controls\n  ServiceClient::Errors::BlockedByWindowsParentalControlsError\n  # 451 – Unavailable For Legal Reasons\n  ServiceClient::Errors::UnavailableForLegalReasonsError\n  # 499 – Client Closed Request\n  ServiceClient::Errors::ClientClosedRequestError\n  # 500 – Internal Server Error\n  ServiceClient::Errors::InternalServerError\n  # 501 – Not Implemented\n  ServiceClient::Errors::NotImplementedError\n  # 502 – Bad Gateway\n  ServiceClient::Errors::BadGatewayError\n  # 503 – Service Unavailable\n  ServiceClient::Errors::ServiceUnavailableError\n  # 504 – Gateway Timeout\n  ServiceClient::Errors::GatewayTimeoutError\n  # 505 – HTTP Version Not Supported\n  ServiceClient::Errors::HTTPVersionNotSupportedError\n  # 506 – Variant Also Negotiates\n  ServiceClient::Errors::VariantAlsoNegotiatesError\n  # 507 – Insufficient Storage\n  ServiceClient::Errors::InsufficientStorageError\n  # 508 – Loop Detected\n  ServiceClient::Errors::LoopDetectedError\n  # 510 – Not Extended\n  ServiceClient::Errors::NotExtendedError\n  # 511 – Network Authentication Required\n  ServiceClient::Errors::NetworkAuthenticationRequiredError\n  # 598 – Network Read Timeout Error\n  ServiceClient::Errors::NetworkReadTimeoutError\n  # 599 – Network Connect Timeout Error\n  ServiceClient::Errors::NetworkConnectTimeoutError\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at \u003chttps://github.com/nemuba/service_client\u003e.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnemuba%2Fservice_client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnemuba%2Fservice_client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnemuba%2Fservice_client/lists"}