query-interface-server 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +64 -57
- data/lib/query-interface-server/transformations.rb +1 -2
- data/lib/query-interface-server/transformations/sequel_transformer.rb +5 -9
- data/lib/query-interface-server/version.rb +1 -1
- data/query-interface-server.gemspec +1 -1
- data/spec/lib/transformations_spec.rb +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fb550135a6842572fc049da4d88e94c6e869c24
|
4
|
+
data.tar.gz: 0be204391a9fd4b5765978125234b2b954e5bdc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac6665bc4094a107cce0156af9e97242d8414412fead578918bc9d7d24cf28e17eb9194f6ed39f17a9364527f3cf68ba737230565548d98252272c6f7313251d
|
7
|
+
data.tar.gz: 24d9b442c532ab19abaa70ca8f95805a1a671e0de9a19051b0b150238c86d57afc9315b5e96f5b0bd654b3c17d96b17ce2fbe52d39ec4a3cc65302b04533a1c5
|
data/Gemfile.lock
CHANGED
@@ -1,99 +1,106 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
actionmailer (4.
|
5
|
-
actionpack (= 4.
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
actionmailer (4.1.1)
|
5
|
+
actionpack (= 4.1.1)
|
6
|
+
actionview (= 4.1.1)
|
7
|
+
mail (~> 2.5.4)
|
8
|
+
actionpack (4.1.1)
|
9
|
+
actionview (= 4.1.1)
|
10
|
+
activesupport (= 4.1.1)
|
11
11
|
rack (~> 1.5.2)
|
12
12
|
rack-test (~> 0.6.2)
|
13
|
-
|
14
|
-
activesupport (= 4.
|
15
|
-
builder (~> 3.1
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
13
|
+
actionview (4.1.1)
|
14
|
+
activesupport (= 4.1.1)
|
15
|
+
builder (~> 3.1)
|
16
|
+
erubis (~> 2.7.0)
|
17
|
+
activemodel (4.1.1)
|
18
|
+
activesupport (= 4.1.1)
|
19
|
+
builder (~> 3.1)
|
20
|
+
activerecord (4.1.1)
|
21
|
+
activemodel (= 4.1.1)
|
22
|
+
activesupport (= 4.1.1)
|
23
|
+
arel (~> 5.0.0)
|
24
|
+
activesupport (4.1.1)
|
25
|
+
i18n (~> 0.6, >= 0.6.9)
|
26
|
+
json (~> 1.7, >= 1.7.7)
|
27
|
+
minitest (~> 5.1)
|
26
28
|
thread_safe (~> 0.1)
|
27
|
-
tzinfo (~>
|
28
|
-
arel (
|
29
|
-
atomic (1.1.10)
|
29
|
+
tzinfo (~> 1.1)
|
30
|
+
arel (5.0.1.20140414130214)
|
30
31
|
autotest-standalone (4.5.11)
|
31
|
-
builder (3.
|
32
|
-
diff-lcs (1.2.
|
32
|
+
builder (3.2.2)
|
33
|
+
diff-lcs (1.2.5)
|
34
|
+
docile (1.1.3)
|
33
35
|
erubis (2.7.0)
|
34
36
|
hike (1.2.3)
|
35
|
-
i18n (0.6.
|
37
|
+
i18n (0.6.9)
|
38
|
+
json (1.8.1)
|
36
39
|
mail (2.5.4)
|
37
40
|
mime-types (~> 1.16)
|
38
41
|
treetop (~> 1.4.8)
|
39
|
-
mime-types (1.
|
40
|
-
minitest (
|
41
|
-
multi_json (1.
|
42
|
-
polyglot (0.3.
|
42
|
+
mime-types (1.25.1)
|
43
|
+
minitest (5.3.3)
|
44
|
+
multi_json (1.10.0)
|
45
|
+
polyglot (0.3.4)
|
43
46
|
rack (1.5.2)
|
44
47
|
rack-test (0.6.2)
|
45
48
|
rack (>= 1.0)
|
46
|
-
rails (4.
|
47
|
-
actionmailer (= 4.
|
48
|
-
actionpack (= 4.
|
49
|
-
|
50
|
-
|
49
|
+
rails (4.1.1)
|
50
|
+
actionmailer (= 4.1.1)
|
51
|
+
actionpack (= 4.1.1)
|
52
|
+
actionview (= 4.1.1)
|
53
|
+
activemodel (= 4.1.1)
|
54
|
+
activerecord (= 4.1.1)
|
55
|
+
activesupport (= 4.1.1)
|
51
56
|
bundler (>= 1.3.0, < 2.0)
|
52
|
-
railties (= 4.
|
53
|
-
sprockets-rails (~> 2.0
|
54
|
-
railties (4.
|
55
|
-
actionpack (= 4.
|
56
|
-
activesupport (= 4.
|
57
|
+
railties (= 4.1.1)
|
58
|
+
sprockets-rails (~> 2.0)
|
59
|
+
railties (4.1.1)
|
60
|
+
actionpack (= 4.1.1)
|
61
|
+
activesupport (= 4.1.1)
|
57
62
|
rake (>= 0.8.7)
|
58
63
|
thor (>= 0.18.1, < 2.0)
|
59
|
-
rake (10.1
|
64
|
+
rake (10.3.1)
|
60
65
|
rspec (2.14.1)
|
61
66
|
rspec-core (~> 2.14.0)
|
62
67
|
rspec-expectations (~> 2.14.0)
|
63
68
|
rspec-mocks (~> 2.14.0)
|
64
|
-
rspec-core (2.14.
|
65
|
-
rspec-expectations (2.14.
|
69
|
+
rspec-core (2.14.8)
|
70
|
+
rspec-expectations (2.14.5)
|
66
71
|
diff-lcs (>= 1.1.3, < 2.0)
|
67
|
-
rspec-mocks (2.14.
|
68
|
-
rspec-rails (2.14.
|
72
|
+
rspec-mocks (2.14.6)
|
73
|
+
rspec-rails (2.14.2)
|
69
74
|
actionpack (>= 3.0)
|
75
|
+
activemodel (>= 3.0)
|
70
76
|
activesupport (>= 3.0)
|
71
77
|
railties (>= 3.0)
|
72
78
|
rspec-core (~> 2.14.0)
|
73
79
|
rspec-expectations (~> 2.14.0)
|
74
80
|
rspec-mocks (~> 2.14.0)
|
75
|
-
sequel (4.
|
76
|
-
simplecov (0.
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
+
sequel (4.10.0)
|
82
|
+
simplecov (0.8.2)
|
83
|
+
docile (~> 1.1.0)
|
84
|
+
multi_json
|
85
|
+
simplecov-html (~> 0.8.0)
|
86
|
+
simplecov-html (0.8.0)
|
87
|
+
sprockets (2.12.1)
|
81
88
|
hike (~> 1.2)
|
82
89
|
multi_json (~> 1.0)
|
83
90
|
rack (~> 1.0)
|
84
91
|
tilt (~> 1.1, != 1.3.0)
|
85
|
-
sprockets-rails (2.
|
92
|
+
sprockets-rails (2.1.3)
|
86
93
|
actionpack (>= 3.0)
|
87
94
|
activesupport (>= 3.0)
|
88
95
|
sprockets (~> 2.8)
|
89
|
-
thor (0.
|
90
|
-
thread_safe (0.
|
91
|
-
atomic
|
96
|
+
thor (0.19.1)
|
97
|
+
thread_safe (0.3.3)
|
92
98
|
tilt (1.4.1)
|
93
|
-
treetop (1.4.
|
99
|
+
treetop (1.4.15)
|
94
100
|
polyglot
|
95
101
|
polyglot (>= 0.3.1)
|
96
|
-
tzinfo (
|
102
|
+
tzinfo (1.1.0)
|
103
|
+
thread_safe (~> 0.1)
|
97
104
|
|
98
105
|
PLATFORMS
|
99
106
|
ruby
|
@@ -51,8 +51,7 @@ module QueryInterface
|
|
51
51
|
def auto_filter(*names)
|
52
52
|
names.each do |name|
|
53
53
|
self.filters[name] = Proc.new do |param|
|
54
|
-
|
55
|
-
filter(field => param)
|
54
|
+
filter(Sequel.qualify(model.table_name, name) => param)
|
56
55
|
end
|
57
56
|
end
|
58
57
|
end
|
@@ -27,31 +27,27 @@ module QueryInterface
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def validate(transformation)
|
30
|
-
|
30
|
+
constraints = {
|
31
31
|
filter: :collection, with: :collection,order: :collection,
|
32
32
|
instance: :collection, context: :instance, map_ids: :collection,
|
33
33
|
paginate: :collection, first: :collection, last: :collection, count: :collection
|
34
34
|
}
|
35
35
|
method = transformation['transformation'].to_sym
|
36
|
-
raise UnknownTransformation, "#{method}" unless
|
36
|
+
raise UnknownTransformation, "#{method}" unless constraints.has_key?(method)
|
37
37
|
param = transformation['parameter']
|
38
|
-
unless self.result_type ==
|
38
|
+
unless self.result_type == constraints[method]
|
39
39
|
raise InvalidContextException, "expected: #{description[:accepts]}, got: #{self.result_type}"
|
40
40
|
end
|
41
41
|
return [method, param]
|
42
42
|
end
|
43
43
|
|
44
|
-
def table
|
45
|
-
self.result.model.table_name
|
46
|
-
end
|
47
|
-
|
48
44
|
def default_order
|
49
45
|
self.order(self.result.model.primary_key.to_s)
|
50
46
|
end
|
51
47
|
|
52
48
|
def id_selector
|
53
49
|
primary_key = self.result.model.primary_key ? self.result.model.primary_key : :id
|
54
|
-
|
50
|
+
Sequel.qualify(self.result.model.table_name, primary_key)
|
55
51
|
end
|
56
52
|
|
57
53
|
def filter(param)
|
@@ -90,7 +86,7 @@ module QueryInterface
|
|
90
86
|
end
|
91
87
|
|
92
88
|
def map_ids(param)
|
93
|
-
self.default_order.
|
89
|
+
self.default_order.select_map(self.id_selector)
|
94
90
|
end
|
95
91
|
|
96
92
|
def count(param)
|
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.summary = "Server for the radar query interface"
|
24
24
|
s.license = "ISC"
|
25
25
|
|
26
|
-
s.add_runtime_dependency(%q<sequel>, '~>
|
26
|
+
s.add_runtime_dependency(%q<sequel>, '~> 4.10')
|
27
27
|
s.add_development_dependency(%q<rake>, '~> 10.1')
|
28
28
|
s.add_development_dependency(%q<rspec>, '~> 2.14')
|
29
29
|
s.add_development_dependency(%q<rails>, '~> 4.0')
|
@@ -47,7 +47,7 @@ describe QueryInterface::Server::Transformations do
|
|
47
47
|
transformations = Foo.instance_variable_get(:@query_transformations)
|
48
48
|
transformations[:filter].keys.should eq([:foo, :bar])
|
49
49
|
transformations[:filter][:foo].should be_a(Proc)
|
50
|
-
Foo.should_receive(:filter).with(
|
50
|
+
Foo.should_receive(:filter).with(Sequel.qualify('foo_table', :bar) => 'bar_value')
|
51
51
|
Foo.instance_exec('bar_value', &transformations[:filter][:bar])
|
52
52
|
end
|
53
53
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: query-interface-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Kopecky <andreas.kopecky@radarservices.com>
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-05-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: sequel
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - "~>"
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
21
|
+
version: '4.10'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - "~>"
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: '
|
28
|
+
version: '4.10'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: rake
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,9 +126,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
128
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.2.
|
129
|
+
rubygems_version: 2.2.2
|
130
130
|
signing_key:
|
131
131
|
specification_version: 4
|
132
132
|
summary: Server for the radar query interface
|
133
133
|
test_files: []
|
134
|
-
has_rdoc:
|