pavlov 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 +4 -4
- data/lib/pavlov/command.rb +4 -0
- data/lib/pavlov/helpers.rb +3 -3
- data/lib/pavlov/interactor.rb +0 -4
- data/lib/pavlov/operation.rb +15 -10
- data/lib/pavlov/query.rb +4 -0
- data/lib/pavlov/version.rb +1 -1
- metadata +17 -6
- data/lib/generators/pavlov/templates/backend/command.rb +0 -3
- data/lib/generators/pavlov/templates/backend/interactor.rb +0 -16
- data/lib/generators/pavlov/templates/backend/query.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28147e53a9ec3060b50d87d0ffa15929c17f006c
|
4
|
+
data.tar.gz: 4f508eb3d010a7f276f68ff269d71ca86e200549
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9c8cb195850d0e8deb4f8e70c08ba86a587104b66a8f78b920678d0bcf903ebfde8f51dea33e26ce22cd87dda1a7a6a41ad4da5db8090b87d1216ed27385b66
|
7
|
+
data.tar.gz: 8bb36fef06d09c8ef8c4a0e91bfb402dee5c95f863aac3aff77200619f69631c1ce371009e120d108556aa693b068a5461f9a1ffc294a09d57088a7e6e94ed77
|
data/lib/pavlov/command.rb
CHANGED
data/lib/pavlov/helpers.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
module Pavlov
|
2
2
|
module Helpers
|
3
|
-
def interactor name, hash
|
3
|
+
def interactor name, hash = {}
|
4
4
|
Pavlov.interactor name, with_pavlov_options(hash)
|
5
5
|
end
|
6
6
|
|
7
|
-
def query name, hash
|
7
|
+
def query name, hash = {}
|
8
8
|
Pavlov.query name, with_pavlov_options(hash)
|
9
9
|
end
|
10
10
|
|
11
|
-
def command name, hash
|
11
|
+
def command name, hash = {}
|
12
12
|
Pavlov.command name, with_pavlov_options(hash)
|
13
13
|
end
|
14
14
|
|
data/lib/pavlov/interactor.rb
CHANGED
data/lib/pavlov/operation.rb
CHANGED
@@ -4,18 +4,24 @@ require 'virtus'
|
|
4
4
|
require_relative 'access_denied'
|
5
5
|
|
6
6
|
module Pavlov
|
7
|
+
class ValidationError < StandardError
|
8
|
+
end
|
9
|
+
|
7
10
|
module Operation
|
8
11
|
extend Pavlov::Concern
|
9
12
|
include Pavlov::Helpers
|
10
13
|
include Virtus
|
11
14
|
|
12
15
|
def validate
|
13
|
-
return false
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
return false if attributes_without_defaults_missing_values?
|
17
|
+
|
18
|
+
raise Pavlov::ValidationError, 'an argument is invalid' unless valid?
|
19
|
+
|
20
|
+
true
|
21
|
+
end
|
22
|
+
|
23
|
+
def valid?
|
24
|
+
true
|
19
25
|
end
|
20
26
|
|
21
27
|
def call(*args, &block)
|
@@ -31,14 +37,13 @@ module Pavlov
|
|
31
37
|
end
|
32
38
|
|
33
39
|
def check_authorization
|
34
|
-
raise_unauthorized
|
40
|
+
raise_unauthorized unless authorized?
|
35
41
|
end
|
36
42
|
|
37
|
-
def
|
38
|
-
|
43
|
+
def attributes_without_defaults_missing_values?
|
44
|
+
attribute_set.find_index do |attribute|
|
39
45
|
!attribute.options.has_key?(:default) && send(attribute.name).nil?
|
40
46
|
end
|
41
|
-
attributes_without_value.empty?
|
42
47
|
end
|
43
48
|
|
44
49
|
module ClassMethods
|
data/lib/pavlov/query.rb
CHANGED
data/lib/pavlov/version.rb
CHANGED
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pavlov
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Marten Veldthuis
|
8
8
|
- Mark IJbema
|
9
9
|
- Tom de Vries
|
10
10
|
- Jan Paul Posma
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2013-08-
|
16
|
+
date: 2013-08-13 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: virtus
|
@@ -85,6 +85,20 @@ dependencies:
|
|
85
85
|
- - '>='
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: '0'
|
88
|
+
- !ruby/object:Gem::Dependency
|
89
|
+
name: guard-rubocop
|
90
|
+
requirement: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
type: :development
|
96
|
+
prerelease: false
|
97
|
+
version_requirements: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
88
102
|
- !ruby/object:Gem::Dependency
|
89
103
|
name: terminal-notifier-guard
|
90
104
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,9 +178,6 @@ extra_rdoc_files: []
|
|
164
178
|
files:
|
165
179
|
- lib/generators/pavlov/install_generator.rb
|
166
180
|
- lib/generators/pavlov/templates/backend/backend.rb
|
167
|
-
- lib/generators/pavlov/templates/backend/command.rb
|
168
|
-
- lib/generators/pavlov/templates/backend/interactor.rb
|
169
|
-
- lib/generators/pavlov/templates/backend/query.rb
|
170
181
|
- lib/pavlov.rb
|
171
182
|
- lib/pavlov/access_denied.rb
|
172
183
|
- lib/pavlov/alpha_compatibility.rb
|
@@ -1,16 +0,0 @@
|
|
1
|
-
class Interactor
|
2
|
-
include Pavlov::Operation
|
3
|
-
|
4
|
-
# If you want your interactors to be compatible with a backgrounding
|
5
|
-
# daemon, you can use this base class to add support.
|
6
|
-
#
|
7
|
-
# Example for Resque:
|
8
|
-
#
|
9
|
-
# def self.perform(*args)
|
10
|
-
# new(*args).call
|
11
|
-
# end
|
12
|
-
|
13
|
-
def authorized?
|
14
|
-
raise NotImplementedError
|
15
|
-
end
|
16
|
-
end
|