schemaless_rest_api 0.5.0 → 0.5.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: 8cd0875a0972ff3b33119a209a1e0a4a338e89cc52949c3014f12e9193315fbc
4
- data.tar.gz: 5a15b247ae28b9ec1329637dac2649bc6104425d4f576a77d0ca4725b3a1ae0d
3
+ metadata.gz: 49fba7a856b268a6077d6597c20687d0d056cce2049fb5c0590da046acebf91f
4
+ data.tar.gz: 2ac45839af0b7d4e273812bcf6a4a9d3f750d958285c3f9fcfccf143ee4d8c57
5
5
  SHA512:
6
- metadata.gz: da922d8ce69b812d26fa7f6887e604190a22c4f9924a9fb2d33a93c5de4a52aca09c92c0b172674d51970704abb09fec1e26851d8254009ba96f56df4e8966be
7
- data.tar.gz: 3aeb83be262190ef8273dc1fcf521b11ee637f6ccbb7e389b7e379be528fc3a593cdb31497652016225484b222af2a4e1cd539ab2d301af798c7893061041baa
6
+ metadata.gz: 5c545f176d807dff6894b10a54aba45737968157247261b1a973ae471ec60155834a8847a43edb3c2ee50ad2a2b562846f5513479112402f3013b7da6a84a0c2
7
+ data.tar.gz: 35f4ed2bc211ac4bf163296b69c29362a7d13a3c705898e7a5a07438d3c8b071907acfd0792fb9b84e81519e74b6cfd95276156948ae422d27886a13ebb7421c
Binary file
@@ -14,29 +14,34 @@ class RestServer < Sinatra::Base
14
14
  helpers ServerUtils
15
15
 
16
16
  before do
17
- @request_id = SecureRandom.uuid
18
- headers["X-Request-Id"] = @request_id
17
+ @request_id = SecureRandom.uuid
18
+ headers["X-Correlation-Id"] = @request_id
19
19
  headers["Access-Control-Allow-Origin"] = "*"
20
- log({ msg: "Request"}) if (request.fullpath != "")
20
+ log({ msg: "Request" }) if request.fullpath != ""
21
21
  end
22
22
 
23
- after do
24
- log({ msg: "Response", status: response.status }) if (request.fullpath != "")
23
+ after do
24
+ log({ msg: "Response", status: response.status }) if request.fullpath != ""
25
25
  end
26
26
 
27
- SWAGGER_FILES = %w[index.css swagger.html swagger-initializer.js swagger-ui-bundle.js swagger-ui-standalone-preset.js swagger-ui.css]
27
+ get "/favicon.ico" do
28
+ send_file File.join(__dir__, "rest.ico")
29
+ end
30
+
31
+ SWAGGER_FILES = %w[index.css swagger.html swagger-initializer.js swagger-ui-bundle.js swagger-ui-standalone-preset.js
32
+ swagger-ui.css]
28
33
 
29
34
  SWAGGER_FILES.each do |filename|
30
35
  get "/#{filename.gsub(".html", "")}" do
31
- if filename.end_with? '.json'
36
+ if filename.end_with? ".json"
32
37
  content_type :json
33
- elsif filename.end_with? '.css'
38
+ elsif filename.end_with? ".css"
34
39
  content_type :css
35
- elsif filename.end_with? '.js'
40
+ elsif filename.end_with? ".js"
36
41
  content_type :js
37
42
  end
38
43
 
39
- File.read("./lib/schemaless_rest_api/swagger/#{filename}")
44
+ File.read(File.join(__dir__, "swagger", filename))
40
45
  end
41
46
  end
42
47
 
@@ -79,7 +84,7 @@ class RestServer < Sinatra::Base
79
84
  else
80
85
  Entities.models[model][id] = data
81
86
  end
82
- log({msg: "Created #{id}"})
87
+ log({ msg: "Created #{id}" })
83
88
  [201, JSON.generate({ id: id })]
84
89
  end
85
90
 
@@ -3,5 +3,5 @@
3
3
  # typed: true
4
4
 
5
5
  module SchemalessRestApi
6
- VERSION = "0.5.0"
6
+ VERSION = "0.5.1"
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schemaless_rest_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Garratt
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-14 00:00:00.000000000 Z
11
+ date: 2024-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongo
@@ -122,6 +122,7 @@ files:
122
122
  - lib/schemaless_rest_api.rb
123
123
  - lib/schemaless_rest_api/entities.rb
124
124
  - lib/schemaless_rest_api/mongo_client.rb
125
+ - lib/schemaless_rest_api/rest.ico
125
126
  - lib/schemaless_rest_api/rest_server.rb
126
127
  - lib/schemaless_rest_api/server_utils.rb
127
128
  - lib/schemaless_rest_api/swagger/index.css