ka-ching-client 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +17 -0
- data/.rubocop.yml +27 -0
- data/.tool-versions +1 -0
- data/CHANGELOG.md +8 -0
- data/CONTRIBUTING.md +126 -0
- data/Gemfile +19 -0
- data/Gemfile.lock +127 -0
- data/LICENSE.txt +21 -0
- data/README.md +342 -0
- data/Rakefile +12 -0
- data/lib/ka-ching-client.rb +14 -0
- data/lib/ka_ching/api_client.rb +40 -0
- data/lib/ka_ching/api_v1/admin.rb +82 -0
- data/lib/ka_ching/api_v1/audit_logs.rb +107 -0
- data/lib/ka_ching/api_v1/bookings.rb +151 -0
- data/lib/ka_ching/api_v1/client.rb +70 -0
- data/lib/ka_ching/api_v1/lockings.rb +136 -0
- data/lib/ka_ching/api_v1/saldo.rb +42 -0
- data/lib/ka_ching/api_v1/tenants.rb +73 -0
- data/lib/ka_ching/version.rb +5 -0
- metadata +101 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2e16582171eb9b2444e49108b7aa5e5510f8d1b161083c246e4f0ef3d7b4403e
|
4
|
+
data.tar.gz: a35cf46ed2c2cd17ca08c18807b3e2b1467b426e33cfddd4fa60a23a4d488aa5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7ccca54c865747187c51e8b89a11b78fbb91296e3a60a3ded4a17df30b443e0d055963f782538f9c7e1e871135ecfc94eca94ffc8b7ea0868b05ccf6939a3d80
|
7
|
+
data.tar.gz: c7effcd12a68700eeec10a980983aa2e1bda4ee86bb7b0f37902429e8cb6e62a62411b605213077029c1d04f347e97325d4d75323f768c1841f8f15501321ea9
|
data/.editorconfig
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
[*.rb]
|
2
|
+
indent_size = 2
|
3
|
+
indent_style = space
|
4
|
+
end_of_line = lf
|
5
|
+
|
6
|
+
[Gemfile]
|
7
|
+
indent_size = 2
|
8
|
+
indent_style = space
|
9
|
+
end_of_line = lf
|
10
|
+
|
11
|
+
[*.md]
|
12
|
+
indent_size = 2
|
13
|
+
indent_style = space
|
14
|
+
end_of_line = lf
|
15
|
+
|
16
|
+
[*.yml]
|
17
|
+
indent_size = 2
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.7
|
3
|
+
NewCops: enable
|
4
|
+
|
5
|
+
Naming/FileName:
|
6
|
+
Exclude:
|
7
|
+
- "lib/ka-ching-client.rb"
|
8
|
+
|
9
|
+
Naming/MemoizedInstanceVariableName:
|
10
|
+
EnforcedStyleForLeadingUnderscores: optional
|
11
|
+
|
12
|
+
Metrics/MethodLength:
|
13
|
+
Max: 20
|
14
|
+
CountAsOne: ["array", "hash", "heredoc", "method_call"]
|
15
|
+
|
16
|
+
Metrics/ParameterLists:
|
17
|
+
Max: 6
|
18
|
+
|
19
|
+
Metrics/BlockLength:
|
20
|
+
Enabled: True
|
21
|
+
Exclude:
|
22
|
+
- "test/**/*"
|
23
|
+
|
24
|
+
Metrics/AbcSize:
|
25
|
+
Enabled: false
|
26
|
+
Exclude:
|
27
|
+
- "test/**/*"
|
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 3.2.2
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [Unreleased] - yyyy-mm-dd
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
# Contributing to ka-ching-client
|
2
|
+
|
3
|
+
This project is work of [many contributors](https://github.com/simonneutert/ka-ching-client/graphs/contributors).
|
4
|
+
|
5
|
+
You're encouraged to submit [pull requests](https://github.com/simonneutert/ka-ching-client/pulls), [propose features and discuss issues](https://github.com/simonneutert/ka-ching-client/issues).
|
6
|
+
|
7
|
+
In the examples below, substitute your Github username for `contributor` in URLs.
|
8
|
+
|
9
|
+
### Fork the Project
|
10
|
+
|
11
|
+
Fork the [project on Github](https://github.com/simonneutert/ka-ching-client) and check out your copy.
|
12
|
+
|
13
|
+
```
|
14
|
+
git clone https://github.com/contributor/ka-ching-client.git
|
15
|
+
cd ka-ching-client
|
16
|
+
git remote add upstream https://github.com/simonneutert/ka-ching-client.git
|
17
|
+
```
|
18
|
+
|
19
|
+
### Bundle Install and Test
|
20
|
+
|
21
|
+
Ensure that you can build the project and run tests.
|
22
|
+
|
23
|
+
```
|
24
|
+
bash bin/init.sh
|
25
|
+
bundle install
|
26
|
+
bundle exec rake
|
27
|
+
```
|
28
|
+
|
29
|
+
## Contribute Code
|
30
|
+
|
31
|
+
### Create a Topic Branch
|
32
|
+
|
33
|
+
Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.
|
34
|
+
|
35
|
+
```
|
36
|
+
git checkout main
|
37
|
+
git pull upstream main
|
38
|
+
git checkout -b my-feature-branch
|
39
|
+
```
|
40
|
+
|
41
|
+
### Write Tests
|
42
|
+
|
43
|
+
Try to write a test that reproduces the problem you're trying to fix or describes a feature that you want to build. Add tests to [test](test).
|
44
|
+
|
45
|
+
We definitely appreciate pull requests that highlight or reproduce a problem, even without a fix.
|
46
|
+
|
47
|
+
### Write Code
|
48
|
+
|
49
|
+
Implement your feature or bug fix.
|
50
|
+
|
51
|
+
Ruby style is enforced with [Rubocop](https://github.com/bbatsov/rubocop). Run `bundle exec rubocop` and fix any style issues highlighted, auto-correct issues when possible with `bundle exec rubocop -a`. To silence generally ingored issues, including line lengths or code complexity metrics, run `bundle exec rubocop --auto-gen-config`.
|
52
|
+
|
53
|
+
Make sure that `bundle exec rake` completes without errors.
|
54
|
+
|
55
|
+
### Write Documentation
|
56
|
+
|
57
|
+
Document any external behavior in the [README](README.md).
|
58
|
+
|
59
|
+
### Update Changelog
|
60
|
+
|
61
|
+
Add a line to [CHANGELOG](CHANGELOG.md) under *Next Release*. Don't remove *Your contribution here*.
|
62
|
+
|
63
|
+
Make it look like every other line, including a link to the issue being fixed, your name and link to your Github account.
|
64
|
+
|
65
|
+
### Commit Changes
|
66
|
+
|
67
|
+
Make sure git knows your name and email address:
|
68
|
+
|
69
|
+
```
|
70
|
+
git config --global user.name "Your Name"
|
71
|
+
git config --global user.email "contributor@example.com"
|
72
|
+
```
|
73
|
+
|
74
|
+
Writing good commit logs is important. A commit log should describe what changed and why.
|
75
|
+
|
76
|
+
```
|
77
|
+
git add ...
|
78
|
+
git commit
|
79
|
+
```
|
80
|
+
|
81
|
+
### Push
|
82
|
+
|
83
|
+
```
|
84
|
+
git push origin my-feature-branch
|
85
|
+
```
|
86
|
+
|
87
|
+
### Make a Pull Request
|
88
|
+
|
89
|
+
Go to https://github.com/contributor/ka-ching-client and select your feature branch. Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
|
90
|
+
|
91
|
+
### Update CHANGELOG Again
|
92
|
+
|
93
|
+
Update the [CHANGELOG](CHANGELOG.md) with the pull request number. A typical entry looks as follows.
|
94
|
+
|
95
|
+
```
|
96
|
+
* [#123](https://github.com/simonneutert/ka-ching-client/pull/123): Reticulated splines - [@contributor](https://github.com/contributor).
|
97
|
+
```
|
98
|
+
|
99
|
+
Amend your previous commit and force push the changes.
|
100
|
+
|
101
|
+
```
|
102
|
+
git commit --amend
|
103
|
+
git push origin my-feature-branch -f
|
104
|
+
```
|
105
|
+
|
106
|
+
### Rebase
|
107
|
+
|
108
|
+
If you've been working on a change for a while, rebase with upstream/master.
|
109
|
+
|
110
|
+
```
|
111
|
+
git fetch upstream
|
112
|
+
git rebase upstream/master
|
113
|
+
git push origin my-feature-branch -f
|
114
|
+
```
|
115
|
+
|
116
|
+
### Check on Your Pull Request
|
117
|
+
|
118
|
+
Go back to your pull request after a few minutes and see whether it passed muster with GitHub-CI. Everything should look green, otherwise fix issues and amend your commit as described above.
|
119
|
+
|
120
|
+
### Be Patient
|
121
|
+
|
122
|
+
It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang on there!
|
123
|
+
|
124
|
+
## Thank You
|
125
|
+
|
126
|
+
Please do know that we really appreciate and value your time and work. We love you, really.
|
data/Gemfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
gemspec
|
6
|
+
|
7
|
+
group :development, :test do
|
8
|
+
gem 'minitest', '~> 5.0'
|
9
|
+
gem 'minitest-vcr', '~> 1.4'
|
10
|
+
gem 'pry', '~> 0.14.2'
|
11
|
+
gem 'rake', '~> 13.0'
|
12
|
+
gem 'rubocop', '~> 1.52'
|
13
|
+
gem 'rubocop-minitest', '~> 0.31.0'
|
14
|
+
gem 'rubocop-performance', '~> 1.18'
|
15
|
+
gem 'solargraph', '~> 0.49.0'
|
16
|
+
gem 'vcr', '~> 6.1'
|
17
|
+
gem 'webmock', '~> 3.18'
|
18
|
+
gem 'yard', '~> 0.9.34'
|
19
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ka-ching-client (0.1.0)
|
5
|
+
faraday (~> 2.7.4)
|
6
|
+
httpx (>= 0.22.4, < 0.24.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
addressable (2.8.4)
|
12
|
+
public_suffix (>= 2.0.2, < 6.0)
|
13
|
+
ast (2.4.2)
|
14
|
+
backport (1.2.0)
|
15
|
+
benchmark (0.2.1)
|
16
|
+
coderay (1.1.3)
|
17
|
+
crack (0.4.5)
|
18
|
+
rexml
|
19
|
+
diff-lcs (1.5.0)
|
20
|
+
e2mmap (0.1.0)
|
21
|
+
faraday (2.7.6)
|
22
|
+
faraday-net_http (>= 2.0, < 3.1)
|
23
|
+
ruby2_keywords (>= 0.0.4)
|
24
|
+
faraday-net_http (3.0.2)
|
25
|
+
hashdiff (1.0.1)
|
26
|
+
http-2-next (0.5.1)
|
27
|
+
httpx (0.23.4)
|
28
|
+
http-2-next (>= 0.4.1)
|
29
|
+
jaro_winkler (1.5.6)
|
30
|
+
json (2.6.3)
|
31
|
+
kramdown (2.4.0)
|
32
|
+
rexml
|
33
|
+
kramdown-parser-gfm (1.1.0)
|
34
|
+
kramdown (~> 2.0)
|
35
|
+
method_source (1.0.0)
|
36
|
+
minispec-metadata (2.0.0)
|
37
|
+
minitest
|
38
|
+
minitest (5.18.0)
|
39
|
+
minitest-vcr (1.4.0)
|
40
|
+
minispec-metadata (~> 2.0)
|
41
|
+
minitest (>= 4.7.5)
|
42
|
+
vcr (>= 2.9)
|
43
|
+
nokogiri (1.15.2-arm64-darwin)
|
44
|
+
racc (~> 1.4)
|
45
|
+
nokogiri (1.15.2-x86_64-linux)
|
46
|
+
racc (~> 1.4)
|
47
|
+
parallel (1.23.0)
|
48
|
+
parser (3.2.2.3)
|
49
|
+
ast (~> 2.4.1)
|
50
|
+
racc
|
51
|
+
pry (0.14.2)
|
52
|
+
coderay (~> 1.1)
|
53
|
+
method_source (~> 1.0)
|
54
|
+
public_suffix (5.0.1)
|
55
|
+
racc (1.7.0)
|
56
|
+
rainbow (3.1.1)
|
57
|
+
rake (13.0.6)
|
58
|
+
rbs (2.8.4)
|
59
|
+
regexp_parser (2.8.1)
|
60
|
+
reverse_markdown (2.1.1)
|
61
|
+
nokogiri
|
62
|
+
rexml (3.2.5)
|
63
|
+
rubocop (1.52.1)
|
64
|
+
json (~> 2.3)
|
65
|
+
parallel (~> 1.10)
|
66
|
+
parser (>= 3.2.2.3)
|
67
|
+
rainbow (>= 2.2.2, < 4.0)
|
68
|
+
regexp_parser (>= 1.8, < 3.0)
|
69
|
+
rexml (>= 3.2.5, < 4.0)
|
70
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
71
|
+
ruby-progressbar (~> 1.7)
|
72
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
73
|
+
rubocop-ast (1.29.0)
|
74
|
+
parser (>= 3.2.1.0)
|
75
|
+
rubocop-minitest (0.31.0)
|
76
|
+
rubocop (>= 1.39, < 2.0)
|
77
|
+
rubocop-performance (1.18.0)
|
78
|
+
rubocop (>= 1.7.0, < 2.0)
|
79
|
+
rubocop-ast (>= 0.4.0)
|
80
|
+
ruby-progressbar (1.13.0)
|
81
|
+
ruby2_keywords (0.0.5)
|
82
|
+
solargraph (0.49.0)
|
83
|
+
backport (~> 1.2)
|
84
|
+
benchmark
|
85
|
+
bundler (~> 2.0)
|
86
|
+
diff-lcs (~> 1.4)
|
87
|
+
e2mmap
|
88
|
+
jaro_winkler (~> 1.5)
|
89
|
+
kramdown (~> 2.3)
|
90
|
+
kramdown-parser-gfm (~> 1.1)
|
91
|
+
parser (~> 3.0)
|
92
|
+
rbs (~> 2.0)
|
93
|
+
reverse_markdown (~> 2.0)
|
94
|
+
rubocop (~> 1.38)
|
95
|
+
thor (~> 1.0)
|
96
|
+
tilt (~> 2.0)
|
97
|
+
yard (~> 0.9, >= 0.9.24)
|
98
|
+
thor (1.2.2)
|
99
|
+
tilt (2.2.0)
|
100
|
+
unicode-display_width (2.4.2)
|
101
|
+
vcr (6.1.0)
|
102
|
+
webmock (3.18.1)
|
103
|
+
addressable (>= 2.8.0)
|
104
|
+
crack (>= 0.3.2)
|
105
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
106
|
+
yard (0.9.34)
|
107
|
+
|
108
|
+
PLATFORMS
|
109
|
+
arm64-darwin-22
|
110
|
+
x86_64-linux
|
111
|
+
|
112
|
+
DEPENDENCIES
|
113
|
+
ka-ching-client!
|
114
|
+
minitest (~> 5.0)
|
115
|
+
minitest-vcr (~> 1.4)
|
116
|
+
pry (~> 0.14.2)
|
117
|
+
rake (~> 13.0)
|
118
|
+
rubocop (~> 1.52)
|
119
|
+
rubocop-minitest (~> 0.31.0)
|
120
|
+
rubocop-performance (~> 1.18)
|
121
|
+
solargraph (~> 0.49.0)
|
122
|
+
vcr (~> 6.1)
|
123
|
+
webmock (~> 3.18)
|
124
|
+
yard (~> 0.9.34)
|
125
|
+
|
126
|
+
BUNDLED WITH
|
127
|
+
2.4.14
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 Simon Neutert
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,342 @@
|
|
1
|
+
# KaChing::Client<!-- omit from toc -->
|
2
|
+
|
3
|
+
KaChing::Client is a Ruby API client for the [KaChing Backend project / simonneutert/ka-ching-backend](https://github.com/simonneutert/ka-ching-backend).
|
4
|
+
|
5
|
+
[![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)
|
6
|
+
|
7
|
+
- [Installation](#installation)
|
8
|
+
- [Usage (API V1)](#usage-api-v1)
|
9
|
+
- [Setup the client](#setup-the-client)
|
10
|
+
- [Customize Faraday](#customize-faraday)
|
11
|
+
- [Saldo](#saldo)
|
12
|
+
- [current](#current)
|
13
|
+
- [Bookings](#bookings)
|
14
|
+
- [deposit!](#deposit)
|
15
|
+
- [withdraw!](#withdraw)
|
16
|
+
- [drop!](#drop)
|
17
|
+
- [unlocked](#unlocked)
|
18
|
+
- [Lockings](#lockings)
|
19
|
+
- [lock!](#lock)
|
20
|
+
- [unlock!](#unlock)
|
21
|
+
- [all paginated](#all-paginated)
|
22
|
+
- [of\_year](#of_year)
|
23
|
+
- [of\_year\_month](#of_year_month)
|
24
|
+
- [of\_year\_month\_day](#of_year_month_day)
|
25
|
+
- [AuditLogs](#auditlogs)
|
26
|
+
- [of\_year](#of_year-1)
|
27
|
+
- [of\_year\_month](#of_year_month-1)
|
28
|
+
- [of\_year\_month\_day](#of_year_month_day-1)
|
29
|
+
- [Tenants](#tenants)
|
30
|
+
- [all](#all)
|
31
|
+
- [active](#active)
|
32
|
+
- [inactive](#inactive)
|
33
|
+
- [Admin](#admin)
|
34
|
+
- [details](#details)
|
35
|
+
- [create!](#create)
|
36
|
+
- [drop!](#drop-1)
|
37
|
+
- [Development](#development)
|
38
|
+
- [Contributing](#contributing)
|
39
|
+
- [License](#license)
|
40
|
+
|
41
|
+
## Installation
|
42
|
+
|
43
|
+
TODO: Replace `ka-ching-client` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
44
|
+
|
45
|
+
Install the gem and add to the application's Gemfile by executing:
|
46
|
+
|
47
|
+
$ bundle add ka-ching-client
|
48
|
+
|
49
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
50
|
+
|
51
|
+
$ gem install ka-ching-client
|
52
|
+
|
53
|
+
## Usage (API V1)
|
54
|
+
|
55
|
+
The KaChing API is a RESTful API. It uses JSON for serialization of requests and responses.
|
56
|
+
|
57
|
+
### Setup the client
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
require 'bundle/setup'
|
61
|
+
require 'ka-ching-client'
|
62
|
+
|
63
|
+
client = KaChing::ApiClient.new(api_version: :v1, base_url: 'http://localhost:9292')
|
64
|
+
.build_client!
|
65
|
+
```
|
66
|
+
|
67
|
+
#### Customize Faraday
|
68
|
+
|
69
|
+
See the [Faraday documentation](https://lostisland.github.io/faraday/middleware/logger) for more information for the configuration.
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
require 'bundle/setup'
|
73
|
+
require 'ka-ching-client'
|
74
|
+
|
75
|
+
# configure the base url for the client
|
76
|
+
base_url = 'http://localhost:9292'
|
77
|
+
|
78
|
+
# configure the faraday client with a custom logger and your base url
|
79
|
+
custom_faraday = Faraday.new do |builder|
|
80
|
+
builder.url_prefix = base_url
|
81
|
+
builder.response :logger, nil, { bodies: { request: true, response: true } }
|
82
|
+
end
|
83
|
+
|
84
|
+
# instantiate the client for the v1 api version and the base url,
|
85
|
+
# then build the client with the custom faraday client via `build_client!`
|
86
|
+
client = KaChing::ApiClient.new(api_version: :v1, base_url: base_url)
|
87
|
+
.build_client!(faraday: custom_faraday)
|
88
|
+
```
|
89
|
+
|
90
|
+
### Saldo
|
91
|
+
|
92
|
+
All saldo related endpoints.
|
93
|
+
|
94
|
+
#### current
|
95
|
+
|
96
|
+
Get the current saldo for a tenant.
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
res = client.v1.saldo.current(tenant_account_id: 'testuser_1')
|
100
|
+
puts res # => { saldo: 100 }
|
101
|
+
```
|
102
|
+
|
103
|
+
### Bookings
|
104
|
+
|
105
|
+
All booking related endpoints.
|
106
|
+
|
107
|
+
#### deposit!
|
108
|
+
|
109
|
+
Books a deposit for a tenant.
|
110
|
+
|
111
|
+
```ruby
|
112
|
+
res = client.v1.bookings.deposit!(
|
113
|
+
tenant_account_id: 'testuser_1',
|
114
|
+
amount_cents: 100,
|
115
|
+
year: 2019,
|
116
|
+
month: 11,
|
117
|
+
day: 1,
|
118
|
+
context: {'foo' => 'bar'}
|
119
|
+
)
|
120
|
+
```
|
121
|
+
|
122
|
+
#### withdraw!
|
123
|
+
|
124
|
+
Books a withdrawal for a tenant.
|
125
|
+
|
126
|
+
```ruby
|
127
|
+
res = client.v1.bookings.withdraw!(
|
128
|
+
tenant_account_id: 'testuser_1',
|
129
|
+
amount_cents: 100,
|
130
|
+
year: 2019,
|
131
|
+
month: 11,
|
132
|
+
day: 1,
|
133
|
+
context: {'foo' => 'bar'}
|
134
|
+
)
|
135
|
+
```
|
136
|
+
|
137
|
+
#### drop!
|
138
|
+
|
139
|
+
Drops/Deletes a booking for a tenant by its id.
|
140
|
+
|
141
|
+
```ruby
|
142
|
+
res = client.v1.bookings.drop!(
|
143
|
+
tenant_account_id: 'testuser_1',
|
144
|
+
booking_id: 'uuid-example-1234'
|
145
|
+
)
|
146
|
+
```
|
147
|
+
|
148
|
+
#### unlocked
|
149
|
+
|
150
|
+
Shows all unlocked bookings for a tenant.
|
151
|
+
|
152
|
+
```ruby
|
153
|
+
res = client.v1.bookings.unlocked(tenant_account_id: 'testuser_1')
|
154
|
+
puts res # => [{ id: 'uuid-example-1234', amount_cents: 100, ... }]
|
155
|
+
```
|
156
|
+
|
157
|
+
### Lockings
|
158
|
+
|
159
|
+
All lockings related endpoints.
|
160
|
+
|
161
|
+
#### lock!
|
162
|
+
|
163
|
+
Locks all unlocked bookings for a tenant by its id on (including) the given year-month-day.
|
164
|
+
|
165
|
+
```ruby
|
166
|
+
res = client.v1.lockings.lock!(
|
167
|
+
tenant_account_id: 'testuser_1',
|
168
|
+
amount_cents_saldo_user_counted: '1000',
|
169
|
+
year: 2019,
|
170
|
+
month: 11,
|
171
|
+
day: 1,
|
172
|
+
context: {'foo' => 'bar'}
|
173
|
+
)
|
174
|
+
```
|
175
|
+
|
176
|
+
#### unlock!
|
177
|
+
|
178
|
+
Unlock the last locking for a tenant by its id.
|
179
|
+
|
180
|
+
```ruby
|
181
|
+
res = client.v1.lockings.unlock!(tenant_account_id: 'testuser_1')
|
182
|
+
```
|
183
|
+
|
184
|
+
#### all paginated
|
185
|
+
|
186
|
+
Get all lockings for a tenant paginated.
|
187
|
+
|
188
|
+
```ruby
|
189
|
+
res = client.v1.lockings.all(
|
190
|
+
tenant_account_id: 'testuser_1',
|
191
|
+
page: 1,
|
192
|
+
per_page: 10
|
193
|
+
)
|
194
|
+
```
|
195
|
+
|
196
|
+
#### of_year
|
197
|
+
|
198
|
+
Get lockings for a tenant by year.
|
199
|
+
|
200
|
+
```ruby
|
201
|
+
res = client.v1.lockings.of_year(tenant_account_id: 'testuser_1', year: 2019)
|
202
|
+
```
|
203
|
+
|
204
|
+
#### of_year_month
|
205
|
+
|
206
|
+
Get lockings for a tenant by year and month.
|
207
|
+
|
208
|
+
```ruby
|
209
|
+
res = client.v1.lockings.of_year(
|
210
|
+
tenant_account_id: 'testuser_1',
|
211
|
+
year: 2019,
|
212
|
+
month: 11
|
213
|
+
)
|
214
|
+
```
|
215
|
+
|
216
|
+
#### of_year_month_day
|
217
|
+
|
218
|
+
Get lockings for a tenant by year, month and day.
|
219
|
+
|
220
|
+
```ruby
|
221
|
+
res = client.v1.lockings.of_year(
|
222
|
+
tenant_account_id: 'testuser_1',
|
223
|
+
year: 2019,
|
224
|
+
month: 11,
|
225
|
+
day: 21
|
226
|
+
)
|
227
|
+
```
|
228
|
+
|
229
|
+
### AuditLogs
|
230
|
+
|
231
|
+
All audit_logs related endpoints.
|
232
|
+
|
233
|
+
#### of_year
|
234
|
+
|
235
|
+
Get audit_logs for a tenant by year.
|
236
|
+
|
237
|
+
```ruby
|
238
|
+
res = client.v1.audit_logs.of_year(tenant_account_id: 'testuser_1', year: 2019)
|
239
|
+
```
|
240
|
+
|
241
|
+
#### of_year_month
|
242
|
+
|
243
|
+
Get audit_logs for a tenant by year and month.
|
244
|
+
|
245
|
+
```ruby
|
246
|
+
res = client.v1.audit_logs.of_year(
|
247
|
+
tenant_account_id: 'testuser_1',
|
248
|
+
year: 2019,
|
249
|
+
month: 11
|
250
|
+
)
|
251
|
+
```
|
252
|
+
|
253
|
+
#### of_year_month_day
|
254
|
+
|
255
|
+
Get audit_logs for a tenant by year, month and day.
|
256
|
+
|
257
|
+
```ruby
|
258
|
+
res = client.v1.audit_logs.of_year(
|
259
|
+
tenant_account_id: 'testuser_1',
|
260
|
+
year: 2019,
|
261
|
+
month: 11,
|
262
|
+
day: 21
|
263
|
+
)
|
264
|
+
```
|
265
|
+
|
266
|
+
### Tenants
|
267
|
+
|
268
|
+
All tenants related endpoints.
|
269
|
+
|
270
|
+
#### all
|
271
|
+
|
272
|
+
Get all tenants paginated.
|
273
|
+
|
274
|
+
```ruby
|
275
|
+
res = client.v1.tenants.all(page: 1)
|
276
|
+
```
|
277
|
+
|
278
|
+
#### active
|
279
|
+
|
280
|
+
Get all active tenants paginated.
|
281
|
+
|
282
|
+
```ruby
|
283
|
+
res = client.v1.tenants.active(page: 1)
|
284
|
+
```
|
285
|
+
|
286
|
+
#### inactive
|
287
|
+
|
288
|
+
Get all inactive tenants paginated.
|
289
|
+
|
290
|
+
```ruby
|
291
|
+
res = client.v1.tenants.inactive(page: 1)
|
292
|
+
```
|
293
|
+
|
294
|
+
### Admin
|
295
|
+
|
296
|
+
All admin related endpoints, for managing tenant databases.
|
297
|
+
|
298
|
+
#### details
|
299
|
+
|
300
|
+
Details of a tenant database.
|
301
|
+
|
302
|
+
```ruby
|
303
|
+
res = client.v1.admin.details(tenant_account_id: 'testuser_1')
|
304
|
+
```
|
305
|
+
|
306
|
+
#### create!
|
307
|
+
|
308
|
+
Create a new tenant database.
|
309
|
+
|
310
|
+
```ruby
|
311
|
+
res = client.v1.admin.create!(tenant_account_id: 'testuser_1')
|
312
|
+
```
|
313
|
+
|
314
|
+
#### drop!
|
315
|
+
|
316
|
+
Drop/Delete a tenant database.
|
317
|
+
|
318
|
+
```ruby
|
319
|
+
res = client.v1.admin.drop!(tenant_account_id: 'testuser_1')
|
320
|
+
```
|
321
|
+
|
322
|
+
## Development
|
323
|
+
|
324
|
+
After 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.
|
325
|
+
|
326
|
+
To 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).
|
327
|
+
|
328
|
+
In order to record new VCR cassettes you need to bring the database into a state where the cassettes can be recorded.
|
329
|
+
|
330
|
+
It is recommended to run tests in a certain order one after another. So, you end up with the fresh cassettes you might need.
|
331
|
+
|
332
|
+
But 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.
|
333
|
+
|
334
|
+
## Contributing
|
335
|
+
|
336
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/simonneutert/ka-ching-client.
|
337
|
+
|
338
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
339
|
+
|
340
|
+
## License
|
341
|
+
|
342
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|