{"id":15594782,"url":"https://github.com/simonneutert/ka-ching-client","last_synced_at":"2026-03-03T18:03:44.761Z","repository":{"id":174711327,"uuid":"652664313","full_name":"simonneutert/ka-ching-client","owner":"simonneutert","description":"KaChing::Client is a Ruby API client for simonneutert/ka-ching-backend.","archived":false,"fork":false,"pushed_at":"2026-03-01T19:32:31.000Z","size":128,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-01T21:53:16.198Z","etag":null,"topics":["api-client","faraday","httpx","ruby"],"latest_commit_sha":null,"homepage":"https://github.com/simonneutert/ka-ching-backend","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/simonneutert.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-06-12T14:38:45.000Z","updated_at":"2026-03-01T19:32:34.000Z","dependencies_parsed_at":"2023-06-29T07:16:06.811Z","dependency_job_id":"b8dce095-b33e-4db7-b017-e8c3a0227228","html_url":"https://github.com/simonneutert/ka-ching-client","commit_stats":null,"previous_names":["simonneutert/ka-ching-client"],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/simonneutert/ka-ching-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonneutert%2Fka-ching-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonneutert%2Fka-ching-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonneutert%2Fka-ching-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonneutert%2Fka-ching-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonneutert","download_url":"https://codeload.github.com/simonneutert/ka-ching-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonneutert%2Fka-ching-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30054013,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T17:46:22.538Z","status":"ssl_error","status_checked_at":"2026-03-03T17:46:22.036Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","faraday","httpx","ruby"],"created_at":"2024-10-03T00:41:35.021Z","updated_at":"2026-03-03T18:03:44.740Z","avatar_url":"https://github.com/simonneutert.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KaChing::Client\u003c!-- omit from toc --\u003e\n\nKaChing::Client is a Ruby API client for the [KaChing Backend project / simonneutert/ka-ching-backend](https://github.com/simonneutert/ka-ching-backend).\n\n[![Ruby](https://github.com/simonneutert/ka-ching-client/actions/workflows/main.yml/badge.svg)](https://github.com/simonneutert/ka-ching-client/actions/workflows/main.yml)\n\nThe client is supposed to work with the corresponding backend version. As long as it is `0.x.y` the minor (x in this case) must match. \n\n---\n\n- [Installation](#installation)\n- [Usage (API V1)](#usage-api-v1)\n  - [Setup the client](#setup-the-client)\n    - [Customize Faraday](#customize-faraday)\n  - [Saldo](#saldo)\n    - [current](#current)\n  - [Bookings](#bookings)\n    - [deposit!](#deposit)\n    - [withdraw!](#withdraw)\n    - [drop!](#drop)\n    - [unlocked](#unlocked)\n  - [Lockings](#lockings)\n    - [lock!](#lock)\n    - [unlock!](#unlock)\n    - [all paginated](#all-paginated)\n    - [of\\_year](#of_year)\n    - [active](#active)\n    - [inactive](#inactive)\n  - [AuditLogs](#auditlogs)\n    - [of\\_year](#of_year-1)\n    - [of\\_year\\_month](#of_year_month)\n    - [of\\_year\\_month\\_day](#of_year_month_day)\n  - [Tenants](#tenants)\n    - [all](#all)\n    - [active](#active-1)\n    - [inactive](#inactive-1)\n  - [Admin](#admin)\n    - [details](#details)\n    - [create!](#create)\n    - [drop!](#drop-1)\n    - [reset!](#reset)\n- [Development](#development)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Installation\n\nInstall the gem and add to the application's Gemfile by executing:\n\n    $ bundle add ka-ching-client\n\nIf bundler is not being used to manage dependencies, install the gem by executing:\n\n    $ gem install ka-ching-client\n\n## Usage (API V1)\n\nThe KaChing API is a RESTful API. It uses JSON for serialization of requests and responses.\n\n### Setup the client\n\n```ruby\nrequire 'bundle/setup'\nrequire 'ka-ching-client'\n\nclient = KaChing::ApiClient.new(api_version: :v1, base_url: 'http://localhost:9292')\n                           .build_client!\n```\n\n#### Customize Faraday\n\nSee the [Faraday documentation](https://lostisland.github.io/faraday/middleware/logger) for more information for the configuration.\n\n```ruby\nrequire 'bundle/setup'\nrequire 'ka-ching-client'\n\n# configure the base url for the client\nbase_url = 'http://localhost:9292'\n\n# configure the faraday client with a custom logger and your base url\ncustom_faraday = Faraday.new do |builder|\n  builder.url_prefix = base_url\n  builder.response :logger, nil, { bodies: { request: true, response: true } }\nend\n\n# instantiate the client for the v1 api version and the base url,\n# then build the client with the custom faraday client via `build_client!`\nclient = KaChing::ApiClient.new(api_version: :v1, base_url: base_url)\n                           .build_client!(faraday: custom_faraday)\n```\n\n### Saldo\n\nAll saldo related endpoints.\n\n#### current\n\nGet the current saldo for a tenant.\n\n```ruby\nres = client.v1.saldo.current(tenant_account_id: 'testuser_1')\nputs res # =\u003e { saldo: 100 }\n```\n\n### Bookings\n\nAll booking related endpoints.\n\n#### deposit!\n\nBooks a deposit for a tenant.\n\n```ruby\nres = client.v1.bookings.deposit!(\n  tenant_account_id: 'testuser_1',\n  amount_cents: 100,\n  year: 2019,\n  month: 11,\n  day: 1,\n  context: {'foo' =\u003e 'bar'}\n)\n```\n\n#### withdraw!\n\nBooks a withdrawal for a tenant.\n\n```ruby\nres = client.v1.bookings.withdraw!(\n  tenant_account_id: 'testuser_1',\n  amount_cents: 100,\n  year: 2019,\n  month: 11,\n  day: 1,\n  context: {'foo' =\u003e 'bar'}\n)\n```\n\n#### drop!\n\nDrops/Deletes a booking for a tenant by its id.\n\n```ruby\nres = client.v1.bookings.drop!(\n  tenant_account_id: 'testuser_1',\n  booking_id: 'uuid-example-1234'\n)\n```\n\n#### unlocked\n\nShows all unlocked bookings for a tenant.\n\n```ruby\nres = client.v1.bookings.unlocked(tenant_account_id: 'testuser_1')\nputs res # =\u003e [{ id: 'uuid-example-1234', amount_cents: 100, ... }]\n```\n\n### Lockings\n\nAll lockings related endpoints.\n\n#### lock!\n\nLocks all unlocked bookings for a tenant by its id on (including) the given year-month-day.\n\n```ruby\nres = client.v1.lockings.lock!(\n  tenant_account_id: 'testuser_1',\n  amount_cents_saldo_user_counted: '1000',\n  year: 2019,\n  month: 11,\n  day: 1,\n  context: {'foo' =\u003e 'bar'}\n)\n```\n\n#### unlock!\n\nUnlock the last locking for a tenant by its id.\n\n```ruby\nres = client.v1.lockings.unlock!(tenant_account_id: 'testuser_1')\n```\n\n#### all paginated\n\nGet all lockings for a tenant paginated.\n\n```ruby\nres = client.v1.lockings.all(\n  tenant_account_id: 'testuser_1',\n  page: 1,\n  per_page: 10,\n)\n```\n\n#### of_year\n\nGet lockings for a tenant by year.\n\n```ruby\nres = client.v1.lockings.of_year(tenant_account_id: 'testuser_1', year: 2019)\n```\n\n#### active\n\nGet active lockings for a tenant for a year.\n\n```ruby\nres = client.v1.lockings.active(\n  tenant_account_id: 'testuser_1',\n  year: 2019,\n)\n```\n\n#### inactive\n\nGet inactive lockings for a tenant for a year.\n\n```ruby\nres = client.v1.lockings.inactive(\n  tenant_account_id: 'testuser_1',\n  year: 2019,\n)\n```\n\n### AuditLogs\n\nAll audit_logs related endpoints.\n\n#### of_year\n\nGet audit_logs for a tenant by year.\n\n```ruby\nres = client.v1.audit_logs.of_year(tenant_account_id: 'testuser_1', year: 2019)\n```\n\n#### of_year_month\n\nGet audit_logs for a tenant by year and month.\n\n```ruby\nres = client.v1.audit_logs.of_year(\n  tenant_account_id: 'testuser_1',\n  year: 2019,\n  month: 11\n)\n```\n\n#### of_year_month_day\n\nGet audit_logs for a tenant by year, month and day.\n\n```ruby\nres = client.v1.audit_logs.of_year(\n  tenant_account_id: 'testuser_1',\n  year: 2019,\n  month: 11,\n  day: 21\n)\n```\n\n### Tenants\n\nAll tenants related endpoints.\n\n#### all\n\nGet all tenants paginated.\n\n```ruby\nres = client.v1.tenants.all(page: 1, per_page: 1000)\n```\n\n#### active\n\nGet all active tenants paginated.\n\n```ruby\nres = client.v1.tenants.active(page: 1, per_page: 1000)\n```\n\n#### inactive\n\nGet all inactive tenants paginated.\n\n```ruby\nres = client.v1.tenants.inactive(page: 1, per_page: 1000)\n```\n\n### Admin\n\nAll admin related endpoints, for managing tenant databases.\n\n#### details\n\nDetails of a tenant database.\n\n```ruby\nres = client.v1.admin.details(tenant_account_id: 'testuser_1')\n```\n\n#### create!\n\nCreate a new tenant database.\n\n```ruby\nres = client.v1.admin.create!(tenant_account_id: 'testuser_1')\n```\n\n#### drop!\n\nDrop/Delete a tenant database.\n\n```ruby\nres = client.v1.admin.drop!(tenant_account_id: 'testuser_1')\n```\n\n#### reset!\n\nReset a tenant database.\n\n```ruby\nres = client.v1.admin.reset!(tenant_account_id: 'testuser_1')\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\nIn order to record new VCR cassettes you need to bring the database into a state where the cassettes can be recorded.\n\nIt is recommended to run tests in a certain order one after another. So, you end up with the fresh cassettes you might need.\n\nBut as long as `V2` is not released, you can just run the tests in the order they are defined in the test file and use the cassettes already recorded.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/simonneutert/ka-ching-client.\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md).\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%2Fsimonneutert%2Fka-ching-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonneutert%2Fka-ching-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonneutert%2Fka-ching-client/lists"}