ka-ching-client 0.3.0 → 0.4.1

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: '096acd110efe41626adbb730494ba86247e0c20614b294ba1bfa4d4dd7d420d9'
4
- data.tar.gz: ea47b6fcb5d16b2a42a0a198c4c397eb0ebabc05f6d9755bc3a2fa31793aa982
3
+ metadata.gz: db52d31fd7f27fd2eb354d1ae70a90aa4699f91f6d0e9bc9b4232bbfc61af879
4
+ data.tar.gz: 256122db2442d874a1524898f87404077f14ef1b20b8ee62b261f3004503cbe8
5
5
  SHA512:
6
- metadata.gz: 19d9b84a3e2a5c4872fe9fe0ed2746140d9da84afa925f1ef7554d2d048bd087d1032c272030269c01e8d742dfa953597561f503d0d7e50ed0e99ecede67e311
7
- data.tar.gz: cb4701e66c2a1e922379a4fec71ec935982d0021dcdb7601b61bec19bbd1ad3217b55f024a01cf4bdd5028d64e9d341b6a705b57dc9a1be9c700d8155fc96489
6
+ metadata.gz: 64a4f749aec6b45f7a6e1cacbf9990ebad70c7210ac50f8cd2d5055d380e58a048813040f3f87ccaddc2068c8b4fad3f9fb98ea65653f88e36299d4ccd25b61a
7
+ data.tar.gz: e7146f915876f592374904f4a5ce0ea8af696749b63fd47a4243ecae7c7f81803860657067bd0e9217ecceb886a5b7f346988031d0b2c2c2919ea542a82ad15e
data/CHANGELOG.md CHANGED
@@ -5,6 +5,15 @@ 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.1] - 2023-09-16
9
+
10
+ - [#19](https://github.com/simonneutert/ka-ching-client/pull/19) upgrades dependencies - [@simonneutert](https://github.com/simonneutert).
11
+ - [#23](https://github.com/simonneutert/ka-ching-client/pull/23) drops minitest-vcr dependency - [@simonneutert](https://github.com/simonneutert).
12
+
13
+ ## [0.4.0] - 2023-07-11
14
+
15
+ - [#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).
16
+
8
17
  ## [0.3.0] - 2023-06-27
9
18
 
10
19
  Matches ka-ching-backend version bump to v0.3.0.
data/Gemfile CHANGED
@@ -5,15 +5,14 @@ source 'https://rubygems.org'
5
5
  gemspec
6
6
 
7
7
  group :development, :test do
8
- gem 'minitest', '~> 5.18'
9
- gem 'minitest-vcr', '~> 1.4'
8
+ gem 'minitest', '~> 5.20'
10
9
  gem 'pry', '~> 0.14.2'
11
10
  gem 'rake', '~> 13.0'
12
- gem 'rubocop', '~> 1.53'
13
- gem 'rubocop-minitest', '~> 0.31.0'
14
- gem 'rubocop-performance', '~> 1.18'
11
+ gem 'rubocop', '~> 1.56'
12
+ gem 'rubocop-minitest', '~> 0.31.1'
13
+ gem 'rubocop-performance', '~> 1.19'
15
14
  gem 'solargraph', '~> 0.49.0'
16
- gem 'vcr', '~> 6.1'
17
- gem 'webmock', '~> 3.18'
15
+ gem 'vcr', '~> 6.2'
16
+ gem 'webmock', '~> 3.19'
18
17
  gem 'yard', '~> 0.9.34'
19
18
  end
data/Gemfile.lock CHANGED
@@ -1,30 +1,32 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ka-ching-client (0.3.0)
5
- faraday (~> 2.7.4)
4
+ ka-ching-client (0.4.1)
5
+ faraday (~> 2.7.10)
6
6
  httpx (>= 0.22.4, < 0.25.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- addressable (2.8.4)
11
+ addressable (2.8.5)
12
12
  public_suffix (>= 2.0.2, < 6.0)
13
13
  ast (2.4.2)
14
14
  backport (1.2.0)
15
+ base64 (0.1.1)
15
16
  benchmark (0.2.1)
16
17
  coderay (1.1.3)
17
18
  crack (0.4.5)
18
19
  rexml
19
20
  diff-lcs (1.5.0)
20
21
  e2mmap (0.1.0)
21
- faraday (2.7.7)
22
+ faraday (2.7.11)
23
+ base64
22
24
  faraday-net_http (>= 2.0, < 3.1)
23
25
  ruby2_keywords (>= 0.0.4)
24
26
  faraday-net_http (3.0.2)
25
27
  hashdiff (1.0.1)
26
28
  http-2-next (0.5.1)
27
- httpx (0.24.0)
29
+ httpx (0.24.4)
28
30
  http-2-next (>= 0.4.1)
29
31
  jaro_winkler (1.5.6)
30
32
  json (2.6.3)
@@ -34,20 +36,14 @@ GEM
34
36
  kramdown (~> 2.0)
35
37
  language_server-protocol (3.17.0.3)
36
38
  method_source (1.0.0)
37
- mini_portile2 (2.8.2)
38
- minispec-metadata (2.0.0)
39
- minitest
40
- minitest (5.18.1)
41
- minitest-vcr (1.4.0)
42
- minispec-metadata (~> 2.0)
43
- minitest (>= 4.7.5)
44
- vcr (>= 2.9)
45
- nokogiri (1.15.2)
39
+ mini_portile2 (2.8.4)
40
+ minitest (5.20.0)
41
+ nokogiri (1.15.4)
46
42
  mini_portile2 (~> 2.8.2)
47
43
  racc (~> 1.4)
48
- nokogiri (1.15.2-arm64-darwin)
44
+ nokogiri (1.15.4-arm64-darwin)
49
45
  racc (~> 1.4)
50
- nokogiri (1.15.2-x86_64-linux)
46
+ nokogiri (1.15.4-x86_64-linux)
51
47
  racc (~> 1.4)
52
48
  parallel (1.23.0)
53
49
  parser (3.2.2.3)
@@ -56,7 +52,7 @@ GEM
56
52
  pry (0.14.2)
57
53
  coderay (~> 1.1)
58
54
  method_source (~> 1.0)
59
- public_suffix (5.0.1)
55
+ public_suffix (5.0.3)
60
56
  racc (1.7.1)
61
57
  rainbow (3.1.1)
62
58
  rake (13.0.6)
@@ -64,8 +60,9 @@ GEM
64
60
  regexp_parser (2.8.1)
65
61
  reverse_markdown (2.1.1)
66
62
  nokogiri
67
- rexml (3.2.5)
68
- rubocop (1.53.1)
63
+ rexml (3.2.6)
64
+ rubocop (1.56.3)
65
+ base64 (~> 0.1.1)
69
66
  json (~> 2.3)
70
67
  language_server-protocol (>= 3.17.0)
71
68
  parallel (~> 1.10)
@@ -73,14 +70,14 @@ GEM
73
70
  rainbow (>= 2.2.2, < 4.0)
74
71
  regexp_parser (>= 1.8, < 3.0)
75
72
  rexml (>= 3.2.5, < 4.0)
76
- rubocop-ast (>= 1.28.0, < 2.0)
73
+ rubocop-ast (>= 1.28.1, < 2.0)
77
74
  ruby-progressbar (~> 1.7)
78
75
  unicode-display_width (>= 2.4.0, < 3.0)
79
76
  rubocop-ast (1.29.0)
80
77
  parser (>= 3.2.1.0)
81
- rubocop-minitest (0.31.0)
78
+ rubocop-minitest (0.31.1)
82
79
  rubocop (>= 1.39, < 2.0)
83
- rubocop-performance (1.18.0)
80
+ rubocop-performance (1.19.0)
84
81
  rubocop (>= 1.7.0, < 2.0)
85
82
  rubocop-ast (>= 0.4.0)
86
83
  ruby-progressbar (1.13.0)
@@ -102,10 +99,10 @@ GEM
102
99
  tilt (~> 2.0)
103
100
  yard (~> 0.9, >= 0.9.24)
104
101
  thor (1.2.2)
105
- tilt (2.2.0)
102
+ tilt (2.3.0)
106
103
  unicode-display_width (2.4.2)
107
- vcr (6.1.0)
108
- webmock (3.18.1)
104
+ vcr (6.2.0)
105
+ webmock (3.19.1)
109
106
  addressable (>= 2.8.0)
110
107
  crack (>= 0.3.2)
111
108
  hashdiff (>= 0.4.0, < 2.0.0)
@@ -118,17 +115,16 @@ PLATFORMS
118
115
 
119
116
  DEPENDENCIES
120
117
  ka-ching-client!
121
- minitest (~> 5.18)
122
- minitest-vcr (~> 1.4)
118
+ minitest (~> 5.20)
123
119
  pry (~> 0.14.2)
124
120
  rake (~> 13.0)
125
- rubocop (~> 1.53)
126
- rubocop-minitest (~> 0.31.0)
127
- rubocop-performance (~> 1.18)
121
+ rubocop (~> 1.56)
122
+ rubocop-minitest (~> 0.31.1)
123
+ rubocop-performance (~> 1.19)
128
124
  solargraph (~> 0.49.0)
129
- vcr (~> 6.1)
130
- webmock (~> 3.18)
125
+ vcr (~> 6.2)
126
+ webmock (~> 3.19)
131
127
  yard (~> 0.9.34)
132
128
 
133
129
  BUNDLED WITH
134
- 2.4.14
130
+ 2.4.19
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.3.0'
4
+ VERSION = '0.4.1'
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.3.0
4
+ version: 0.4.1
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-27 00:00:00.000000000 Z
11
+ date: 2023-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.7.4
19
+ version: 2.7.10
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.7.4
26
+ version: 2.7.10
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: httpx
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -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.