ka-ching-client 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KaChing
|
4
|
+
module ApiV1
|
5
|
+
#
|
6
|
+
# Tenants Endpoint for the KaChing API V1
|
7
|
+
#
|
8
|
+
class Tenants
|
9
|
+
extend Forwardable
|
10
|
+
|
11
|
+
def_delegators :@conn, :get, :post, :put, :patch, :delete
|
12
|
+
|
13
|
+
def initialize(conn:, api_url:)
|
14
|
+
@conn = conn
|
15
|
+
@api_url = api_url
|
16
|
+
end
|
17
|
+
|
18
|
+
#
|
19
|
+
# Get all tenants paginated
|
20
|
+
#
|
21
|
+
# @param [Integer] page The page number to fetch
|
22
|
+
#
|
23
|
+
# @return [Array<Hash>] An array of tenant detail hashes
|
24
|
+
#
|
25
|
+
def all(page: 1)
|
26
|
+
all_url = build_url
|
27
|
+
res = get("#{all_url}/all/#{page}") do |req|
|
28
|
+
req.headers['Content-Type'] = 'application/json'
|
29
|
+
end
|
30
|
+
yield res if block_given?
|
31
|
+
JSON.parse(res.body)
|
32
|
+
end
|
33
|
+
|
34
|
+
#
|
35
|
+
# Get all active tenants paginated
|
36
|
+
#
|
37
|
+
# @param [Integer] page The page number to fetch
|
38
|
+
#
|
39
|
+
# @return [Array<Hash>] An array of tenant detail hashes
|
40
|
+
#
|
41
|
+
def active(page: 1)
|
42
|
+
active_url = build_url
|
43
|
+
res = get("#{active_url}/active/#{page}}") do |req|
|
44
|
+
req.headers['Content-Type'] = 'application/json'
|
45
|
+
end
|
46
|
+
yield res if block_given?
|
47
|
+
JSON.parse(res.body)
|
48
|
+
end
|
49
|
+
|
50
|
+
#
|
51
|
+
# Get all inactive tenants paginated
|
52
|
+
#
|
53
|
+
# @param [Integer] page The page number to fetch
|
54
|
+
#
|
55
|
+
# @return [Array<Hash>] An array of tenant detail hashes
|
56
|
+
#
|
57
|
+
def inactive(page: 1)
|
58
|
+
inactive_url = build_url
|
59
|
+
res = get("#{inactive_url}/all/#{page}}") do |req|
|
60
|
+
req.headers['Content-Type'] = 'application/json'
|
61
|
+
end
|
62
|
+
yield res if block_given?
|
63
|
+
JSON.parse(res.body)
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def build_url
|
69
|
+
"#{@api_url}/tenants"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ka-ching-client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Simon Neutert
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-06-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.7.4
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.7.4
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: httpx
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.22.4
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 0.24.0
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.22.4
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.24.0
|
47
|
+
description: This gem is a client for the ka-ching API.
|
48
|
+
email:
|
49
|
+
- simonneutert@users.noreply.github.com
|
50
|
+
executables: []
|
51
|
+
extensions: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
54
|
+
- ".editorconfig"
|
55
|
+
- ".rubocop.yml"
|
56
|
+
- ".tool-versions"
|
57
|
+
- CHANGELOG.md
|
58
|
+
- CONTRIBUTING.md
|
59
|
+
- Gemfile
|
60
|
+
- Gemfile.lock
|
61
|
+
- LICENSE.txt
|
62
|
+
- README.md
|
63
|
+
- Rakefile
|
64
|
+
- lib/ka-ching-client.rb
|
65
|
+
- lib/ka_ching/api_client.rb
|
66
|
+
- lib/ka_ching/api_v1/admin.rb
|
67
|
+
- lib/ka_ching/api_v1/audit_logs.rb
|
68
|
+
- lib/ka_ching/api_v1/bookings.rb
|
69
|
+
- lib/ka_ching/api_v1/client.rb
|
70
|
+
- lib/ka_ching/api_v1/lockings.rb
|
71
|
+
- lib/ka_ching/api_v1/saldo.rb
|
72
|
+
- lib/ka_ching/api_v1/tenants.rb
|
73
|
+
- lib/ka_ching/version.rb
|
74
|
+
homepage: https://github.com/simonneutert/ka-ching-client
|
75
|
+
licenses:
|
76
|
+
- MIT
|
77
|
+
metadata:
|
78
|
+
homepage_uri: https://github.com/simonneutert/ka-ching-client
|
79
|
+
source_code_uri: https://github.com/simonneutert/ka-ching-client
|
80
|
+
changelog_uri: https://github.com/simonneutert/ka-ching-client/ChangeLog.md
|
81
|
+
rubygems_mfa_required: 'true'
|
82
|
+
post_install_message:
|
83
|
+
rdoc_options: []
|
84
|
+
require_paths:
|
85
|
+
- lib
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 2.7.0
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
requirements: []
|
97
|
+
rubygems_version: 3.4.13
|
98
|
+
signing_key:
|
99
|
+
specification_version: 4
|
100
|
+
summary: This gem is a client for the ka-ching API.
|
101
|
+
test_files: []
|