sample_core_api 0.0.9.pre.6 → 0.0.9.pre.8

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: be0b35369c52fa332ea1cee2167292c18dbf739b7cd2506f88145a76c98bbd8a
4
- data.tar.gz: 80be2877ffb5bfc945ad4a567dbf073e779f7270dcb18b5f9bb233cf5152a833
3
+ metadata.gz: c6f83a2b2183ee268ef20ba591d8e1562385ff3407d65ec93a11cb5215be194e
4
+ data.tar.gz: 1ff5d0a5036b12408e319f8a8e9b961ead73f1deca1dabdf0076bfd0ab3a7534
5
5
  SHA512:
6
- metadata.gz: be8a79f314256dbe3cc300be2aac06989542091b0b126bba492b2e9deaff16412b48b4b7c5645f5aa3661f7f5722bc9787801ec24e336642c818d467a8029064
7
- data.tar.gz: 2649841e10b42997018ed12684490a7742f9c70f36f134b0d4b168c1951ef753b56f29893b939e3aae4786b6a7c03d916f59c9ef73a1ad590007bb77582ae942
6
+ metadata.gz: e678867ce46b92e5501732a8a6f932e4fc4f165725d03a3e2bc880819bddf8d6a612dd26d7021f78f2274f098920333a2658a027a5dfd0369730c733b448823d
7
+ data.tar.gz: 5c775832d079e6a52830fa61419b3eae4ea2e3ff6a094765a436df786103e8e38d89bf5f1ce3df4b3c3db169bdd967c76788b779f9fe78e8d7a6d90fff42d27a
@@ -15,7 +15,7 @@ module Authenticator
15
15
  end
16
16
 
17
17
  def authenticate isAuthorized
18
- lambda {|*args, &blk|
18
+ lambda {|self_model, *args, &blk|
19
19
  puts "isAuthorized"
20
20
  # check authentication and authorization here, then return true/false
21
21
  if isAuthorized.call(*args, &blk)
@@ -26,28 +26,3 @@ module Authenticator
26
26
  }
27
27
  end
28
28
  end
29
-
30
- # class Authenticate < MethodDecorators::Decorator
31
- # def initialize(authorize_function, arguments)
32
- # @authorize_function = authorize_function
33
- # @arguments = arguments
34
- # end
35
-
36
- # def call(wrapped, this, *args, &blk)
37
- # puts "before authentication"
38
- # puts "user #" + SecurityContextHolder.get_user()
39
- # if self.send(@authorize_function, @arguments, *args, &blk)
40
- # result = wrapped.call(*args, &blk)
41
- # else
42
- # raise CommonError::InvalidToken
43
- # end
44
- # puts "after authentication"
45
-
46
- # result
47
- # end
48
-
49
- # def has_roles(roles, *args, &blk)
50
- # # check roles here
51
- # return true
52
- # end
53
- # end
@@ -2,10 +2,10 @@ require_relative '../rest/rest_service'
2
2
 
3
3
  module Validator
4
4
  def validate params={}
5
- lambda {|*args, &blk|
5
+ lambda {|self_model, *args, &blk|
6
6
  puts "Validate"
7
- check_validate = true # check validation and return true/false
8
- if validate
7
+ check_validate = self_model.check_validate(*args, &blk) # check validation and return true/false
8
+ if check_validate
9
9
  true
10
10
  else
11
11
  raise CommonError::InvalidData
@@ -13,26 +13,3 @@ module Validator
13
13
  }
14
14
  end
15
15
  end
16
-
17
- # class Valid < MethodDecorators::Decorator
18
- # def initialize(validate_function, arguments)
19
- # @validate_function = validate_function
20
- # @arguments = arguments
21
- # end
22
-
23
- # def call(wrapped, this, *args, &blk)
24
- # puts "before validation"
25
- # if self.send(@validate_function, @arguments, *args, &blk)
26
- # result = wrapped.call(*args, &blk)
27
- # else
28
- # raise CommonError::InvalidData
29
- # end
30
- # puts "after validation"
31
- # result
32
- # end
33
-
34
- # def validate(arguments, *args, &blk)
35
- # # check validation here
36
- # return true
37
- # end
38
- # end
data/lib/ioc/injector.rb CHANGED
@@ -39,7 +39,7 @@ module Injector
39
39
  decorators[:is_processed] = true
40
40
  define_method(name) do |*args, &blk|
41
41
  decorators[:decorators].each do |decor|
42
- decor.call(*args, &blk)
42
+ decor.call(self, *args, &blk)
43
43
  end
44
44
  orig_method.bind(self).call(*args, &blk)
45
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sample_core_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9.pre.6
4
+ version: 0.0.9.pre.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fusin Thang
@@ -130,6 +130,26 @@ dependencies:
130
130
  - - ">="
131
131
  - !ruby/object:Gem::Version
132
132
  version: 1.4.1
133
+ - !ruby/object:Gem::Dependency
134
+ name: dry-validation
135
+ requirement: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: 0.12.0
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: 0.12.0
143
+ type: :runtime
144
+ prerelease: false
145
+ version_requirements: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - "~>"
148
+ - !ruby/object:Gem::Version
149
+ version: 0.12.0
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: 0.12.0
133
153
  - !ruby/object:Gem::Dependency
134
154
  name: bundler
135
155
  requirement: !ruby/object:Gem::Requirement