schemaless_rest_api 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/schemaless_rest_api/rest_server.rb +5 -4
- data/lib/schemaless_rest_api/version.rb +1 -1
- data/lib/schemaless_rest_api.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c6884db983603d3fe99853d2daf2448c5a112535d427c4dcf93085c03d0d572
|
4
|
+
data.tar.gz: 233cf6a115128268144a612ff02e5de53c32b4f1dc0cb3e46a53f15ebc776e9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fddf98f70498d9efee708f86ba28a3ddc4da8b53c029886c964ba8be2078d8bc459d025c50236bb11c9992a8a4ef5edd62d3a05491d8686ac481c2d6a61238a
|
7
|
+
data.tar.gz: ad73ffe9c66723853b0e0a9dc6ecaeb30371b7b12ceb33267715de10dcac052bb3d2107ad3fd4d93bff978239077d2a9434e526b8a32dc550676145b4d0b7db9
|
@@ -51,6 +51,7 @@ class RestServer < Sinatra::Base
|
|
51
51
|
end
|
52
52
|
post "/#{model.downcase}" do
|
53
53
|
response["Access-Control-Allow-Origin"] = "*"
|
54
|
+
SchemalessRestApi.logger.info "POST #{request.fullpath}"
|
54
55
|
data = JSON.parse(request.body.read)
|
55
56
|
id = ""
|
56
57
|
if data["id"]
|
@@ -81,7 +82,7 @@ class RestServer < Sinatra::Base
|
|
81
82
|
end
|
82
83
|
get "/#{model.downcase}" do
|
83
84
|
response["Access-Control-Allow-Origin"] = "*"
|
84
|
-
SchemalessRestApi.logger.info request.fullpath
|
85
|
+
SchemalessRestApi.logger.info "GET #{request.fullpath}"
|
85
86
|
if ENV["mongodb"]
|
86
87
|
if params == {}
|
87
88
|
JSON.generate(MongoClient.get_all(model))
|
@@ -107,7 +108,7 @@ class RestServer < Sinatra::Base
|
|
107
108
|
end
|
108
109
|
get "/#{model.downcase}/:id" do |id|
|
109
110
|
response["Access-Control-Allow-Origin"] = "*"
|
110
|
-
|
111
|
+
SchemalessRestApi.logger.info "GET #{request.fullpath}"
|
111
112
|
if ENV["mongodb"]
|
112
113
|
results = MongoClient.find(model, id)
|
113
114
|
return not_have(id) unless results.first
|
@@ -135,7 +136,7 @@ class RestServer < Sinatra::Base
|
|
135
136
|
end
|
136
137
|
put "/#{model.downcase}/:id" do |id|
|
137
138
|
response["Access-Control-Allow-Origin"] = "*"
|
138
|
-
|
139
|
+
SchemalessRestApi.logger.info "PUT #{request.fullpath}"
|
139
140
|
data = JSON.parse(request.body.read)
|
140
141
|
if ENV["mongodb"]
|
141
142
|
results = MongoClient.find(model, id)
|
@@ -156,7 +157,7 @@ class RestServer < Sinatra::Base
|
|
156
157
|
end
|
157
158
|
delete "/#{model.downcase}/:id" do |id|
|
158
159
|
response["Access-Control-Allow-Origin"] = "*"
|
159
|
-
|
160
|
+
SchemalessRestApi.logger.info "DEL #{request.fullpath}"
|
160
161
|
if ENV["mongodb"]
|
161
162
|
results = MongoClient.find(model, id)
|
162
163
|
return not_have(id) unless results.first
|
data/lib/schemaless_rest_api.rb
CHANGED