blsk_ruby_core_api 0.1.5 → 0.1.6

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: b3f4ebf6047ba0f37b3f1ae6512335e7332c5448f1425fe078ae10d69f175b6b
4
- data.tar.gz: cbc8dc774fcac8b621b16e5eb439ab821a17c62c5c485bb04a3d4db256065cd8
3
+ metadata.gz: 91389e86201d1e77ba1a79c167b583a5258551bb3588ce379f591b5865e830b4
4
+ data.tar.gz: c46b2a42a6f40004fedb6ecb16a7ec11de02874fd7590ee98267a74462da999e
5
5
  SHA512:
6
- metadata.gz: 54a7e52ef9610661491cf95ee294dd53738623802d7a776b86e0122a28d0b2662696d53dc4350c9f54b670ee9a520fa6ee47abb1a51ccc083c9a78935d1cbb1e
7
- data.tar.gz: c6a0c1121d35afbd75ad2fb9fefb9b6d08b36d5472b08f14407e66db8cf0fe567b2d42b24d5bb329cf28110bde2d73c1c6021e936e0f962adf24ca053a636bb6
6
+ metadata.gz: a721020d02694c89b45c38885c673ce1f5dc582e655da1a2ba08a46e96789fc570936bba2c9bfa69a2d3658e41f2f29b33754331212efc7fb7ebabcf10b6f8d3
7
+ data.tar.gz: 500ba3d2d185f5b892525861b9d728052f49d504d08b4ac59d2f5e9ecad9e11b6fd3c4c833f009844abfe7cd8dcaabe3c22ea6bf32e0d30992d7a8cc07306276
@@ -16,7 +16,7 @@ module Validator
16
16
  end
17
17
 
18
18
  def check_validate(seed_model, self_rest)
19
- errors = seed_model.class::ValidationSchema.call(seed_model.validate_attributes).messages
19
+ errors = seed_model.validate
20
20
  if errors.empty?
21
21
  [true]
22
22
  else
data/lib/model/model.rb CHANGED
@@ -13,7 +13,7 @@ class Model < Dry::Struct
13
13
  end
14
14
 
15
15
  def validate
16
- @@validation_schema.call(attributes).inspect
16
+ @@validation_schema.call(attributes).messages
17
17
  end
18
18
 
19
19
  def to clazz
@@ -35,7 +35,7 @@ class RestBase < RestApplication
35
35
 
36
36
  if request.env['CONTENT_TYPE'] == 'application/json'
37
37
  body_content = JSON.load(request.body)
38
- request['body'] = JSON.parse( body_content ) unless body_content.nil?
38
+ request.params[:body] = JSON.parse( body_content ) unless body_content.nil?
39
39
  end
40
40
  end
41
41
 
@@ -8,22 +8,22 @@ class RestApplication < Sinatra::Base
8
8
 
9
9
  error CommonError::InvalidToken do
10
10
  status 401
11
- JSON RestApplication.error_response('InvalidToken')
11
+ RestApplication.error_response('InvalidToken')
12
12
  end
13
13
 
14
14
  error CommonError::PermissionDenied do
15
15
  status 403
16
- JSON RestApplication.error_response('PermissionDenied')
16
+ RestApplication.error_response('PermissionDenied')
17
17
  end
18
18
 
19
19
  error CommonError::EntityNotFound do
20
20
  status 404
21
- JSON RestApplication.error_response('EntityNotFound')
21
+ RestApplication.error_response('EntityNotFound')
22
22
  end
23
23
 
24
24
  error CommonError::InvalidData do
25
25
  status 422
26
- JSON RestApplication.error_response('InvalidData', @errors)
26
+ RestApplication.error_response('InvalidData', @errors)
27
27
  end
28
28
 
29
29
  def response_with_error(exception_class, errors=[])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blsk_ruby_core_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fusin Thang