infopark_cloud_connector 6.8.0.23.da7f96b → 6.8.0.72.d18d096
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/infopark_cloud_connector.rb +0 -1
- data/lib/rails_connector/blob.rb +2 -2
- data/lib/rails_connector/cms_api_search_request.rb +41 -8
- data/lib/rails_connector/cms_base_model.rb +1 -1
- data/lib/rails_connector/obj.rb +16 -18
- data/lib/rails_connector/obj_body.rb +1 -1
- data/lib/rails_connector/obj_data_from_database.rb +6 -0
- data/lib/rails_connector/obj_data_from_hash.rb +1 -1
- data/lib/rails_connector/s3_blob.rb +1 -1
- metadata +19 -21
data/lib/rails_connector/blob.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'json'
|
2
1
|
require 'restclient'
|
3
2
|
|
4
3
|
module RailsConnector
|
@@ -27,27 +26,27 @@ module RailsConnector
|
|
27
26
|
headers = {
|
28
27
|
:content_type => :json,
|
29
28
|
:accept => :json,
|
30
|
-
:params => {
|
31
|
-
:query => @query_string,
|
32
|
-
:offset => @options[:offset],
|
33
|
-
:limit => @options[:limit],
|
34
|
-
},
|
35
29
|
}
|
36
30
|
headers[:host] = @options[:http_host] if @options[:http_host].present?
|
37
|
-
hits =
|
31
|
+
hits = MultiJson.decode(
|
38
32
|
RestClient::Request.execute({
|
39
33
|
:method => :get,
|
40
34
|
:url => url,
|
41
35
|
:user => @options[:login],
|
42
36
|
:password => @options[:api_key],
|
43
37
|
:headers => headers,
|
38
|
+
:payload => MultiJson.encode({
|
39
|
+
:query => query,
|
40
|
+
:offset => @options[:offset],
|
41
|
+
:size => @options[:limit],
|
42
|
+
}),
|
44
43
|
})
|
45
44
|
)
|
46
45
|
|
47
46
|
result = SES::SearchResult.new(hits['total'])
|
48
47
|
hits['results'].each do |hit|
|
49
48
|
hard_coded_score = 1
|
50
|
-
result << SES::Hit.new(hit, hard_coded_score,
|
49
|
+
result << SES::Hit.new(hit['id'], hard_coded_score, hit)
|
51
50
|
end
|
52
51
|
result
|
53
52
|
end
|
@@ -57,6 +56,40 @@ module RailsConnector
|
|
57
56
|
def url
|
58
57
|
"#{@options[:url]}/revisions/#{Revision.current.id}/objs/search"
|
59
58
|
end
|
59
|
+
|
60
|
+
def query
|
61
|
+
now = Time.now
|
62
|
+
|
63
|
+
q = [
|
64
|
+
{
|
65
|
+
"field" => "_obj_class",
|
66
|
+
"operator" => "equal",
|
67
|
+
"value" => "Image",
|
68
|
+
"negate" => true
|
69
|
+
},
|
70
|
+
{
|
71
|
+
"field" => "_valid_from",
|
72
|
+
"operator" => "less_than",
|
73
|
+
"value" => now.to_iso
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"field" => "_valid_until",
|
77
|
+
"operator" => "less_than",
|
78
|
+
"value" => now.to_iso,
|
79
|
+
"negate" => true
|
80
|
+
}
|
81
|
+
]
|
82
|
+
|
83
|
+
@query_string.split(/[\s]+/).each do |word|
|
84
|
+
q << {
|
85
|
+
"field" => "*",
|
86
|
+
"operator" => "prefix_search",
|
87
|
+
"value" => word,
|
88
|
+
}
|
89
|
+
end
|
90
|
+
|
91
|
+
q
|
92
|
+
end
|
60
93
|
end
|
61
94
|
|
62
95
|
end
|
@@ -4,7 +4,7 @@ module RailsConnector
|
|
4
4
|
|
5
5
|
# This is the abstract class from which all CMS models derive.
|
6
6
|
#
|
7
|
-
class CmsBaseModel < Kvom::Base #:nodoc:
|
7
|
+
class CmsBaseModel < Kvom::Model::Base #:nodoc:
|
8
8
|
class << self
|
9
9
|
def instance_name=(ignore) # :nodoc:
|
10
10
|
# this method is here only for compatibility with the fiona connector.
|
data/lib/rails_connector/obj.rb
CHANGED
@@ -12,9 +12,6 @@ module RailsConnector
|
|
12
12
|
include SEO
|
13
13
|
include ObjBody
|
14
14
|
|
15
|
-
extend PathConversion
|
16
|
-
include PathConversion
|
17
|
-
|
18
15
|
# Create a new Obj instance with the given values and attributes.
|
19
16
|
# Normally this method should not be used.
|
20
17
|
# Instead Objs should be loaded from the cms database.
|
@@ -70,10 +67,6 @@ module RailsConnector
|
|
70
67
|
find_objs_by(:path, [path]).first.first
|
71
68
|
end
|
72
69
|
|
73
|
-
def self.find_by_path_list(path_list) # :nodoc:
|
74
|
-
find_by_path(path_from_list(path_list))
|
75
|
-
end
|
76
|
-
|
77
70
|
def self.find_many_by_paths(pathes) # :nodoc:
|
78
71
|
find_objs_by(:path, pathes).map(&:first)
|
79
72
|
end
|
@@ -138,14 +131,14 @@ module RailsConnector
|
|
138
131
|
# return the Obj that is the parent of this Obj.
|
139
132
|
# returns nil for the root Obj.
|
140
133
|
def parent
|
141
|
-
root? ? nil : Obj.
|
134
|
+
root? ? nil : Obj.find_by_path(parent_path)
|
142
135
|
end
|
143
136
|
|
144
137
|
# Returns an Array of all the ancestor objects, starting at the root and ending at this object's parent.
|
145
138
|
def ancestors
|
146
139
|
return [] if root?
|
147
|
-
ancestor_paths =
|
148
|
-
list << list.last +
|
140
|
+
ancestor_paths = parent_path.scan(/\/[^\/]+/).inject([""]) do |list, component|
|
141
|
+
list << list.last + component
|
149
142
|
end
|
150
143
|
ancestor_paths[0] = "/"
|
151
144
|
Obj.find_many_by_paths(ancestor_paths)
|
@@ -160,16 +153,16 @@ module RailsConnector
|
|
160
153
|
|
161
154
|
# returns the Obj's path as a String.
|
162
155
|
def path
|
163
|
-
|
164
|
-
end
|
165
|
-
|
166
|
-
def path_list # :nodoc:
|
167
|
-
read_attribute('_path') || []
|
156
|
+
read_attribute('_path') or raise "Obj without path"
|
168
157
|
end
|
169
158
|
|
170
159
|
# returns the Obj's name, i.e. the last component of the path.
|
171
160
|
def name
|
172
|
-
|
161
|
+
if root?
|
162
|
+
""
|
163
|
+
else
|
164
|
+
path.match(/[^\/]+$/)[0]
|
165
|
+
end
|
173
166
|
end
|
174
167
|
|
175
168
|
def permissions
|
@@ -315,7 +308,7 @@ module RailsConnector
|
|
315
308
|
|
316
309
|
# Returns true if this object is the root object.
|
317
310
|
def root?
|
318
|
-
|
311
|
+
path == "/"
|
319
312
|
end
|
320
313
|
|
321
314
|
# Returns a list of exportable? children excluding the binary? ones unless :all is specfied.
|
@@ -391,7 +384,7 @@ module RailsConnector
|
|
391
384
|
# Returns the Object with the given name next in the hierarchy
|
392
385
|
# returns nil if no object with the given name was found.
|
393
386
|
def find_nearest(name)
|
394
|
-
obj = self.class.
|
387
|
+
obj = self.class.find_by_path(root? ? "/#{name}" : "#{path}/#{name}")
|
395
388
|
return obj if obj and obj.active?
|
396
389
|
parent.find_nearest(name) unless self.root?
|
397
390
|
end
|
@@ -545,6 +538,11 @@ module RailsConnector
|
|
545
538
|
end
|
546
539
|
end
|
547
540
|
|
541
|
+
def parent_path
|
542
|
+
raise "parent_path called for root" if root?
|
543
|
+
path.gsub(/\/[^\/]+$/, "").presence || "/"
|
544
|
+
end
|
545
|
+
|
548
546
|
def as_date(value)
|
549
547
|
DateAttribute.parse(value) unless value.nil?
|
550
548
|
end
|
@@ -17,6 +17,8 @@ module RailsConnector
|
|
17
17
|
attribute_value = read_value(attribute_name)
|
18
18
|
if attribute_name == '_text_links'
|
19
19
|
attribute_value = attribute_value && attribute_value.values
|
20
|
+
elsif attribute_name == '_path'
|
21
|
+
attribute_value = PathConversion.path_from_list(attribute_value)
|
20
22
|
end
|
21
23
|
else
|
22
24
|
attribute_type = current_attribute_type(attribute_name)
|
@@ -34,6 +36,10 @@ module RailsConnector
|
|
34
36
|
obj_class_attributes.include?(name)
|
35
37
|
end
|
36
38
|
|
39
|
+
def all_custom_attributes
|
40
|
+
obj_class_attributes
|
41
|
+
end
|
42
|
+
|
37
43
|
private
|
38
44
|
|
39
45
|
attr_reader :values, :rtc_ref, :revision
|
metadata
CHANGED
@@ -1,19 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infopark_cloud_connector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 300142121
|
5
5
|
prerelease: 9
|
6
6
|
segments:
|
7
7
|
- 6
|
8
8
|
- 8
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
-
|
12
|
-
-
|
13
|
-
-
|
10
|
+
- 72
|
11
|
+
- d
|
12
|
+
- 18
|
13
|
+
- d
|
14
14
|
- 96
|
15
|
-
|
16
|
-
version: 6.8.0.23.da7f96b
|
15
|
+
version: 6.8.0.72.d18d096
|
17
16
|
platform: ruby
|
18
17
|
authors:
|
19
18
|
- Infopark AG
|
@@ -21,10 +20,11 @@ autorequire:
|
|
21
20
|
bindir: bin
|
22
21
|
cert_chain: []
|
23
22
|
|
24
|
-
date: 2012-
|
23
|
+
date: 2012-10-22 00:00:00 +02:00
|
25
24
|
default_executable:
|
26
25
|
dependencies:
|
27
26
|
- !ruby/object:Gem::Dependency
|
27
|
+
type: :runtime
|
28
28
|
requirement: &id001 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
@@ -36,11 +36,11 @@ dependencies:
|
|
36
36
|
- 3
|
37
37
|
- 6
|
38
38
|
version: 1.3.6
|
39
|
-
version_requirements: *id001
|
40
39
|
name: aws-sdk
|
40
|
+
version_requirements: *id001
|
41
41
|
prerelease: false
|
42
|
-
type: :runtime
|
43
42
|
- !ruby/object:Gem::Dependency
|
43
|
+
type: :runtime
|
44
44
|
requirement: &id002 !ruby/object:Gem::Requirement
|
45
45
|
none: false
|
46
46
|
requirements:
|
@@ -51,32 +51,30 @@ dependencies:
|
|
51
51
|
- 1
|
52
52
|
- 6
|
53
53
|
version: "1.6"
|
54
|
-
version_requirements: *id002
|
55
54
|
name: rest-client
|
55
|
+
version_requirements: *id002
|
56
56
|
prerelease: false
|
57
|
-
type: :runtime
|
58
57
|
- !ruby/object:Gem::Dependency
|
58
|
+
type: :runtime
|
59
59
|
requirement: &id003 !ruby/object:Gem::Requirement
|
60
60
|
none: false
|
61
61
|
requirements:
|
62
62
|
- - "="
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
hash:
|
64
|
+
hash: 300142121
|
65
65
|
segments:
|
66
66
|
- 6
|
67
67
|
- 8
|
68
68
|
- 0
|
69
|
-
-
|
70
|
-
-
|
71
|
-
-
|
72
|
-
-
|
69
|
+
- 72
|
70
|
+
- d
|
71
|
+
- 18
|
72
|
+
- d
|
73
73
|
- 96
|
74
|
-
|
75
|
-
version: 6.8.0.23.da7f96b
|
76
|
-
version_requirements: *id003
|
74
|
+
version: 6.8.0.72.d18d096
|
77
75
|
name: kvom
|
76
|
+
version_requirements: *id003
|
78
77
|
prerelease: false
|
79
|
-
type: :runtime
|
80
78
|
description: The Cloud Connector for Infopark CMS Fiona enables you to develop modern, dynamic Web 2.0 applications using Ruby on Rails and at the same time display CMS managed content.
|
81
79
|
email: info@infopark.de
|
82
80
|
executables: []
|