materialize 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/materialize/repo.rb +28 -8
- data/lib/materialize/version.rb +1 -1
- data/materialize-0.4.0.gem +0 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62835d5edc997985eb7a005a787c66ccf9a0ab4a
|
4
|
+
data.tar.gz: 4c964cbb78c9e88a564c9697e0759093323bf600
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 383b43dd28af0bb63f626a5a8596c6f43ace9d32d3687192a8e77e3c60472e997f44bd6ce1d7f5f9dc50bca3f511c28a34a595dad4f103201965b881d83799c2
|
7
|
+
data.tar.gz: 7ee96bc1c83b54b31f92a5d295bf668262fe6463c7ed73ae5dea9847f1717087b0fccb878c67197967819dc5b8ce49eb4924244d2da1fccf66492e1d8373b92a
|
data/lib/materialize/repo.rb
CHANGED
@@ -13,27 +13,43 @@ module Materialize
|
|
13
13
|
options = args[1] || {}
|
14
14
|
args_to_pass = options[:args]
|
15
15
|
|
16
|
-
data, builder_class = process(data_source_class, query, args_to_pass)
|
16
|
+
data, builder_class, entity_class = process(data_source_class, query, args_to_pass)
|
17
17
|
|
18
18
|
yield(data) if block_given?
|
19
19
|
|
20
20
|
options.delete(:args)
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
# TODO: add a temporary bypass switch that skips builders
|
23
|
+
# TODO: Switch to something like data['m_message'] to avoid collisions
|
24
|
+
|
25
|
+
if options[:skip_builders]
|
26
|
+
if data.is_a?(Hash) and !data['message'].nil?
|
27
|
+
Response.new data
|
28
|
+
elsif data.is_a?(Array)
|
29
|
+
builder_class.build_all(data, self, options)
|
30
|
+
else
|
31
|
+
builder_class.build(data, self, options)
|
32
|
+
end
|
26
33
|
else
|
27
|
-
|
34
|
+
if data.is_a?(Hash) and !data['message'].nil?
|
35
|
+
Response.new data
|
36
|
+
elsif data.is_a?(Array)
|
37
|
+
builder_class.build_all(data, self, options)
|
38
|
+
else
|
39
|
+
builder_class.build(data, self, options)
|
40
|
+
end
|
28
41
|
end
|
42
|
+
|
29
43
|
end
|
30
44
|
|
31
45
|
private
|
32
46
|
|
33
47
|
def process(data_source_class, query, args_to_pass)
|
34
|
-
data
|
48
|
+
data = get_data(data_source_class, query, args_to_pass)
|
35
49
|
builder_class = builder_class_for builder_class_name_for base_class_name_for data_source_class
|
36
|
-
|
50
|
+
entity_class = entity_class_for base_class_name_for data_source_class
|
51
|
+
|
52
|
+
return data, builder_class, entity_class
|
37
53
|
end
|
38
54
|
|
39
55
|
def builder_class_for(builder_class_name)
|
@@ -48,6 +64,10 @@ module Materialize
|
|
48
64
|
"#{base_class_name}Builder"
|
49
65
|
end
|
50
66
|
|
67
|
+
def entity_class_for(base_class_name)
|
68
|
+
Module.const_get("Entities::#{base_class_name}")
|
69
|
+
end
|
70
|
+
|
51
71
|
def base_class_name_for(data_source_class)
|
52
72
|
data_source_class.name.split('::').last
|
53
73
|
end
|
data/lib/materialize/version.rb
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: materialize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Fiser
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -107,6 +107,7 @@ files:
|
|
107
107
|
- lib/materialize/utils.rb
|
108
108
|
- lib/materialize/version.rb
|
109
109
|
- materialize-0.3.5.gem
|
110
|
+
- materialize-0.4.0.gem
|
110
111
|
- materialize.gemspec
|
111
112
|
homepage: http://bluebear.io
|
112
113
|
licenses:
|
@@ -129,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
130
|
version: '0'
|
130
131
|
requirements: []
|
131
132
|
rubyforge_project:
|
132
|
-
rubygems_version: 2.6.
|
133
|
+
rubygems_version: 2.6.10
|
133
134
|
signing_key:
|
134
135
|
specification_version: 4
|
135
136
|
summary: This is the summary.
|