memori-client 0.0.6 → 0.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a25355893a36bf78a27a8241f8610cf5c4d250ae8541ef81971783330b9e00f0
4
- data.tar.gz: 854edc910da83e6f8cc9df32abf3c36694cad75997dcca07b5f601765e3e518f
3
+ metadata.gz: 85bb70384b9b85bf352c6f82e4b43ea5a077e6c8affc36da7b4c9b56f67bbe86
4
+ data.tar.gz: a4012ec355f0f094ffd2642093ea77313d22ae7d78bf4a3bfd3c2f4bb08671f0
5
5
  SHA512:
6
- metadata.gz: dae21f1aa38356b4662690c724a9dc57e0be4e97962389e4d2899a04e3a76556d461ee0903ec416c9990c45de2f5f13ee238ecd5146f19f0dd00bd2b8a6c7a18
7
- data.tar.gz: 473fe0538dd3be8861e7ccee08191606f9dcc9beb471391df93aabc1a289ec8ba4e9cd3f68c8b98e64f7018ffcbbaecefac3d031aa00f6c00df4594a4e155cd9
6
+ metadata.gz: 12579681c1dc49013509c2fb53b486839671630a8e64e6d467715db4f3f0a5e60f9bd4b9f367e106c2d0b55842431476281f5c2008b01e27c755adbd7c883c29
7
+ data.tar.gz: 05062f91d4b97235e2584fd959abcb44b18e43b87d6a0bb8d67c2dff6f3e1b2142e71250d50cb6560706187996333afe534783a561e30543169109e4c5929764
@@ -1,24 +1,32 @@
1
1
  class MemoriClient::Engine::Resource
2
2
  def self.exec_http_request(method, path, args)
3
- raise 'todo'
4
- # stop = false
5
- # processed_tokens = []
6
- # path.split('/').each do |token|
7
- # break if stop == true
8
- # if token =~ /^{.*}$/
9
- # param_name = token.match(/^{(.*)}$/).captures.first
10
- # if args[param_name.to_sym].blank?
11
- # stop = true
12
- # else
13
- # processed_tokens << args[param_name.to_sym]
14
- # end
15
- # else
16
- # processed_tokens << token
17
- # end
18
- # end
19
- #
20
- # url = processed_tokens.join('/')
21
- #
22
- # puts "#{method} #{url}"
3
+ stop = false
4
+ processed_tokens = []
5
+ path.split('/').each do |token|
6
+ break if stop == true
7
+ if token =~ /^{.*}$/
8
+ param_name = token.match(/^{(.*)}$/).captures.first
9
+ if args[param_name.to_sym].blank?
10
+ stop = true
11
+ else
12
+ processed_tokens << args[param_name.to_sym]
13
+ end
14
+ else
15
+ processed_tokens << token
16
+ end
17
+ end
18
+
19
+ url = processed_tokens.join('/')
20
+ url = [MemoriClient.configuration.engine_api_root, url].join('')
21
+ http = MemoriClient::HttpClient.new
22
+
23
+ case method
24
+ when 'get'
25
+ status, body = http.get(url)
26
+ else
27
+ status, body = http.send(method, url, payload: args[:payload])
28
+ end
29
+
30
+ [status, body]
23
31
  end
24
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: memori-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefano Lampis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-16 00:00:00.000000000 Z
11
+ date: 2022-12-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Memori Client to interact with Memori backend and engine API
14
14
  email: me@stefanolampis.com