ka-ching-client 0.2.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bac54083b8081e1e66eef09715fd734594f926efb9632d559c16939183aa9360
4
- data.tar.gz: ccc12ba3b2bd625e9305ebac3a329d6038cb975615d79c7f32775344b9d19367
3
+ metadata.gz: b266d888ac648db0b7ba10d543b48b7e5a8873195a6982f838c6c0df698b3f10
4
+ data.tar.gz: '091be55267371bb203f35badd476240281758ab3a165edafefe97d9acbfd9c71'
5
5
  SHA512:
6
- metadata.gz: 62ec0f7c7f0724ab6b124f88c309d88d1394450ac81c1c797a390ed2cc3cdb4784a2c44993de9dbb3978dfe67c3573699c8f6344da064039e0171045fec41e14
7
- data.tar.gz: e97d23adab7dc7e92a5a4d1947f5cf2467c5d459f47977e30c46ed692c908759401b7c8e90604d5974fb44f54086ba44d3568e513c093cbdef48101b3506b4ff
6
+ metadata.gz: 8a575168a652675ec36b46793b079f661957cc5b3906260c54bc0d6e3628f8f1c6a0e117c5df0c6bd3132c88e878ddd0aad0b72afe02a29387709311a4fce9a5
7
+ data.tar.gz: 6ed57b703f09d68b3ddf529cc0db13f3fb672ee6296aafdea99eb180f3906abbc4cf243565bec8eb330c938372c4bbdfdf12688dd182b2dfee0b0d1d0d058820
data/CHANGELOG.md CHANGED
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.4.0] - 2023-07-11
9
+
10
+ - [#18](https://github.com/simonneutert/ka-ching-client/pull/18) implements a much simpler json interaction all the way for every endpoint - [@simonneutert](https://github.com/simonneutert).
11
+
12
+ ## [0.3.0] - 2023-06-27
13
+
14
+ Matches ka-ching-backend version bump to v0.3.0.
15
+
8
16
  ## [0.2.1] - 2023-06-24
9
17
 
10
18
  - [#8](https://github.com/simonneutert/ka-ching-client/pull/8) adds ability to reset the tenant database `admin#reset!` - [@simonneutert](https://github.com/simonneutert).
data/Gemfile CHANGED
@@ -9,11 +9,11 @@ group :development, :test do
9
9
  gem 'minitest-vcr', '~> 1.4'
10
10
  gem 'pry', '~> 0.14.2'
11
11
  gem 'rake', '~> 13.0'
12
- gem 'rubocop', '~> 1.52'
12
+ gem 'rubocop', '~> 1.54'
13
13
  gem 'rubocop-minitest', '~> 0.31.0'
14
14
  gem 'rubocop-performance', '~> 1.18'
15
15
  gem 'solargraph', '~> 0.49.0'
16
- gem 'vcr', '~> 6.1'
16
+ gem 'vcr', '~> 6.2'
17
17
  gem 'webmock', '~> 3.18'
18
18
  gem 'yard', '~> 0.9.34'
19
19
  end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ka-ching-client (0.2.1)
4
+ ka-ching-client (0.4.0)
5
5
  faraday (~> 2.7.4)
6
6
  httpx (>= 0.22.4, < 0.25.0)
7
7
 
@@ -18,13 +18,13 @@ GEM
18
18
  rexml
19
19
  diff-lcs (1.5.0)
20
20
  e2mmap (0.1.0)
21
- faraday (2.7.6)
21
+ faraday (2.7.10)
22
22
  faraday-net_http (>= 2.0, < 3.1)
23
23
  ruby2_keywords (>= 0.0.4)
24
24
  faraday-net_http (3.0.2)
25
25
  hashdiff (1.0.1)
26
26
  http-2-next (0.5.1)
27
- httpx (0.24.0)
27
+ httpx (0.24.1)
28
28
  http-2-next (>= 0.4.1)
29
29
  jaro_winkler (1.5.6)
30
30
  json (2.6.3)
@@ -32,6 +32,7 @@ GEM
32
32
  rexml
33
33
  kramdown-parser-gfm (1.1.0)
34
34
  kramdown (~> 2.0)
35
+ language_server-protocol (3.17.0.3)
35
36
  method_source (1.0.0)
36
37
  mini_portile2 (2.8.2)
37
38
  minispec-metadata (2.0.0)
@@ -56,7 +57,7 @@ GEM
56
57
  coderay (~> 1.1)
57
58
  method_source (~> 1.0)
58
59
  public_suffix (5.0.1)
59
- racc (1.7.0)
60
+ racc (1.7.1)
60
61
  rainbow (3.1.1)
61
62
  rake (13.0.6)
62
63
  rbs (2.8.4)
@@ -64,8 +65,9 @@ GEM
64
65
  reverse_markdown (2.1.1)
65
66
  nokogiri
66
67
  rexml (3.2.5)
67
- rubocop (1.52.1)
68
+ rubocop (1.54.1)
68
69
  json (~> 2.3)
70
+ language_server-protocol (>= 3.17.0)
69
71
  parallel (~> 1.10)
70
72
  parser (>= 3.2.2.3)
71
73
  rainbow (>= 2.2.2, < 4.0)
@@ -102,7 +104,7 @@ GEM
102
104
  thor (1.2.2)
103
105
  tilt (2.2.0)
104
106
  unicode-display_width (2.4.2)
105
- vcr (6.1.0)
107
+ vcr (6.2.0)
106
108
  webmock (3.18.1)
107
109
  addressable (>= 2.8.0)
108
110
  crack (>= 0.3.2)
@@ -120,11 +122,11 @@ DEPENDENCIES
120
122
  minitest-vcr (~> 1.4)
121
123
  pry (~> 0.14.2)
122
124
  rake (~> 13.0)
123
- rubocop (~> 1.52)
125
+ rubocop (~> 1.54)
124
126
  rubocop-minitest (~> 0.31.0)
125
127
  rubocop-performance (~> 1.18)
126
128
  solargraph (~> 0.49.0)
127
- vcr (~> 6.1)
129
+ vcr (~> 6.2)
128
130
  webmock (~> 3.18)
129
131
  yard (~> 0.9.34)
130
132
 
data/README.md CHANGED
@@ -4,6 +4,10 @@ KaChing::Client is a Ruby API client for the [KaChing Backend project / simonneu
4
4
 
5
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
6
 
7
+ The 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.
8
+
9
+ ---
10
+
7
11
  - [Installation](#installation)
8
12
  - [Usage (API V1)](#usage-api-v1)
9
13
  - [Setup the client](#setup-the-client)
@@ -29,7 +29,7 @@ module KaChing
29
29
  { year: year })
30
30
 
31
31
  yield res if block_given?
32
- parse_bookings(JSON.parse(res.body))['audit_logs']
32
+ JSON.parse(res.body)['audit_logs']
33
33
  end
34
34
 
35
35
  #
@@ -46,7 +46,7 @@ module KaChing
46
46
  res = get(build_url(tenant_account_id: tenant_account_id),
47
47
  { year: year, month: month })
48
48
  yield res if block_given?
49
- parse_bookings(JSON.parse(res.body))['audit_logs']
49
+ JSON.parse(res.body)['audit_logs']
50
50
  end
51
51
 
52
52
  #
@@ -64,31 +64,11 @@ module KaChing
64
64
  res = get(build_url(tenant_account_id: tenant_account_id),
65
65
  { year: year, month: month, day: day })
66
66
  yield res if block_given?
67
- parse_bookings(JSON.parse(res.body))['audit_logs']
67
+ JSON.parse(res.body)['audit_logs']
68
68
  end
69
69
 
70
70
  private
71
71
 
72
- def parse_bookings(audit_log_json)
73
- audit_log_json['audit_logs'].map! do |audit_log|
74
- parse_booking(audit_log, 'environment_snapshot')
75
- parse_booking(audit_log, 'log_entry')
76
- audit_log
77
- end
78
- audit_log_json
79
- end
80
-
81
- def parse_booking(audit_log, bookings_key)
82
- audit_log[bookings_key] = JSON.parse(audit_log[bookings_key])
83
- audit_log[bookings_key]['context'] = JSON.parse(JSON.parse(audit_log[bookings_key]['context']))
84
- audit_log[bookings_key]['bookings'] = JSON.parse(audit_log[bookings_key]['bookings_json'])
85
- audit_log[bookings_key]['bookings'].map! do |b|
86
- b['context'] = JSON.parse(b['context'])
87
- b
88
- end
89
- audit_log
90
- end
91
-
92
72
  #
93
73
  # build the url for the bookings endpoint
94
74
  #
@@ -47,10 +47,7 @@ module KaChing
47
47
  req.body = locking.to_json
48
48
  end
49
49
  yield res if block_given?
50
- res = JSON.parse(res.body)
51
- res['record']['bookings_json'] = JSON.parse(res['record']['bookings_json'])
52
- res['context'] = JSON.parse(JSON.parse(res['context']))
53
- res
50
+ JSON.parse(res.body)
54
51
  end
55
52
 
56
53
  #
@@ -64,10 +61,7 @@ module KaChing
64
61
  req.headers['Content-Type'] = 'application/json'
65
62
  end
66
63
  yield res if block_given?
67
- res = JSON.parse(res.body)
68
- res['bookings_json'] = JSON.parse(res['bookings_json'])
69
- res['context'] = JSON.parse(JSON.parse(res['context']))
70
- res
64
+ JSON.parse(res.body)
71
65
  end
72
66
 
73
67
  def all(tenant_account_id:, page: 1, per_page: 10)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KaChing
4
- VERSION = '0.2.1'
4
+ VERSION = '0.4.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ka-ching-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Neutert
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-24 00:00:00.000000000 Z
11
+ date: 2023-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  requirements: []
98
- rubygems_version: 3.4.14
98
+ rubygems_version: 3.4.13
99
99
  signing_key:
100
100
  specification_version: 4
101
101
  summary: This gem is a client for the ka-ching API.