ka-ching-client 0.3.0 → 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: '096acd110efe41626adbb730494ba86247e0c20614b294ba1bfa4d4dd7d420d9'
4
- data.tar.gz: ea47b6fcb5d16b2a42a0a198c4c397eb0ebabc05f6d9755bc3a2fa31793aa982
3
+ metadata.gz: b266d888ac648db0b7ba10d543b48b7e5a8873195a6982f838c6c0df698b3f10
4
+ data.tar.gz: '091be55267371bb203f35badd476240281758ab3a165edafefe97d9acbfd9c71'
5
5
  SHA512:
6
- metadata.gz: 19d9b84a3e2a5c4872fe9fe0ed2746140d9da84afa925f1ef7554d2d048bd087d1032c272030269c01e8d742dfa953597561f503d0d7e50ed0e99ecede67e311
7
- data.tar.gz: cb4701e66c2a1e922379a4fec71ec935982d0021dcdb7601b61bec19bbd1ad3217b55f024a01cf4bdd5028d64e9d341b6a705b57dc9a1be9c700d8155fc96489
6
+ metadata.gz: 8a575168a652675ec36b46793b079f661957cc5b3906260c54bc0d6e3628f8f1c6a0e117c5df0c6bd3132c88e878ddd0aad0b72afe02a29387709311a4fce9a5
7
+ data.tar.gz: 6ed57b703f09d68b3ddf529cc0db13f3fb672ee6296aafdea99eb180f3906abbc4cf243565bec8eb330c938372c4bbdfdf12688dd182b2dfee0b0d1d0d058820
data/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ 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
+
8
12
  ## [0.3.0] - 2023-06-27
9
13
 
10
14
  Matches ka-ching-backend version bump to v0.3.0.
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.53'
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.3.0)
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.7)
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)
@@ -65,7 +65,7 @@ GEM
65
65
  reverse_markdown (2.1.1)
66
66
  nokogiri
67
67
  rexml (3.2.5)
68
- rubocop (1.53.1)
68
+ rubocop (1.54.1)
69
69
  json (~> 2.3)
70
70
  language_server-protocol (>= 3.17.0)
71
71
  parallel (~> 1.10)
@@ -104,7 +104,7 @@ GEM
104
104
  thor (1.2.2)
105
105
  tilt (2.2.0)
106
106
  unicode-display_width (2.4.2)
107
- vcr (6.1.0)
107
+ vcr (6.2.0)
108
108
  webmock (3.18.1)
109
109
  addressable (>= 2.8.0)
110
110
  crack (>= 0.3.2)
@@ -122,11 +122,11 @@ DEPENDENCIES
122
122
  minitest-vcr (~> 1.4)
123
123
  pry (~> 0.14.2)
124
124
  rake (~> 13.0)
125
- rubocop (~> 1.53)
125
+ rubocop (~> 1.54)
126
126
  rubocop-minitest (~> 0.31.0)
127
127
  rubocop-performance (~> 1.18)
128
128
  solargraph (~> 0.49.0)
129
- vcr (~> 6.1)
129
+ vcr (~> 6.2)
130
130
  webmock (~> 3.18)
131
131
  yard (~> 0.9.34)
132
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.3.0'
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.3.0
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-27 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.