yaccl 1.0.pre.alpha2 → 1.0.pre.alpha3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/yaccl/children.rb +0 -1
- data/lib/yaccl/connection.rb +3 -3
- data/lib/yaccl/document.rb +1 -1
- data/lib/yaccl/helpers.rb +1 -2
- data/lib/yaccl/object.rb +0 -2
- data/lib/yaccl/query.rb +7 -10
- data/lib/yaccl/repository.rb +20 -0
- data/lib/yaccl/type.rb +1 -1
- data/lib/yaccl/version.rb +1 -1
- data/spec/document_spec.rb +9 -9
- data/spec/object_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78933e5e1b79ac8cb88ca155e3036c73eec12a08
|
4
|
+
data.tar.gz: e65eacc0d1ad149fe4530faa286622994c2b4c4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b572e67d6dd5051d167132f5e79204e84f044da057d727a36b0c1eacd66435e3b7716e6ebc97c74334d8e3ec2a73fa75c177c2911d73dee76edbe1b0322430c9
|
7
|
+
data.tar.gz: e5eaa0cdd87bf8ada2ad6929340d73e5d9fca7737a6438514369ea6b30f17a262f53b7926a6f909019060091960f8870cc66eaa04fa79cbab42c1f06f17b4727
|
data/lib/yaccl/children.rb
CHANGED
data/lib/yaccl/connection.rb
CHANGED
@@ -106,9 +106,9 @@ module YACCL
|
|
106
106
|
value = (value.to_f * 1000).to_i if value.is_a?(Time)
|
107
107
|
if value.is_a?(Array)
|
108
108
|
hash.merge!("propertyId[#{index}]" => id)
|
109
|
-
value.each_with_index
|
109
|
+
value.each_with_index do |v, idx|
|
110
110
|
hash.merge!("propertyValue[#{index}][#{idx}]" => value[idx])
|
111
|
-
|
111
|
+
end
|
112
112
|
else
|
113
113
|
hash.merge!("propertyId[#{index}]" => id,
|
114
114
|
"propertyValue[#{index}]" => value)
|
@@ -137,7 +137,7 @@ module YACCL
|
|
137
137
|
def multipart_post(options)
|
138
138
|
url = URI.parse(options[:url])
|
139
139
|
req = Net::HTTP::Post::Multipart.new(url.path, options[:body])
|
140
|
-
options[:headers].each {|key, value| req[key] = value }
|
140
|
+
options[:headers].each { |key, value| req[key] = value }
|
141
141
|
req.basic_auth @username, @password if @username
|
142
142
|
opts = url.scheme == 'https' ? { use_ssl: true , verify_mode: OpenSSL::SSL::VERIFY_NONE } : {}
|
143
143
|
Net::HTTP.start(url.host, url.port, opts) { |http| http.request(req) }
|
data/lib/yaccl/document.rb
CHANGED
data/lib/yaccl/helpers.rb
CHANGED
@@ -25,7 +25,6 @@ module YACCL
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
|
29
28
|
private
|
30
29
|
|
31
30
|
def method_name(property_name)
|
@@ -42,7 +41,7 @@ module YACCL
|
|
42
41
|
if raw['succinctProperties']
|
43
42
|
result = raw['succinctProperties']
|
44
43
|
elsif raw['properties']
|
45
|
-
result = raw['properties'].
|
44
|
+
result = raw['properties'].reduce({}) do |h, (k, v)|
|
46
45
|
val = v['value']
|
47
46
|
val = v['value'].first if v['value'].is_a?(Array) and v['cardinality'] == 'single'
|
48
47
|
val = Time.at(val / 1000) if val and v['type'] == 'datetime'
|
data/lib/yaccl/object.rb
CHANGED
data/lib/yaccl/query.rb
CHANGED
@@ -2,12 +2,10 @@ module YACCL
|
|
2
2
|
class Query
|
3
3
|
|
4
4
|
def initialize(repository, statement, options)
|
5
|
-
options.stringify_keys!
|
6
|
-
|
7
5
|
@repository = repository
|
8
|
-
@connection = repository.connection
|
9
|
-
|
10
6
|
@statement = statement
|
7
|
+
|
8
|
+
options.stringify_keys!
|
11
9
|
@max_items = options['max_items'] || 10
|
12
10
|
@skip_count = options['skip_count'] || 0
|
13
11
|
|
@@ -32,15 +30,14 @@ module YACCL
|
|
32
30
|
@total ||= do_query.num_items
|
33
31
|
end
|
34
32
|
|
35
|
-
|
36
33
|
private
|
37
34
|
|
38
35
|
def do_query
|
39
|
-
result = @connection.execute!({ cmisselector: 'query',
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
36
|
+
result = @repository.connection.execute!({ cmisselector: 'query',
|
37
|
+
repositoryId: @repository.id,
|
38
|
+
q: @statement,
|
39
|
+
maxItems: @max_items,
|
40
|
+
skipCount: @skip_count })
|
44
41
|
|
45
42
|
results = result['results'].map do |r|
|
46
43
|
ObjectFactory.create(r, @repository)
|
data/lib/yaccl/repository.rb
CHANGED
@@ -97,6 +97,26 @@ module YACCL
|
|
97
97
|
Query.new(self, statement, options)
|
98
98
|
end
|
99
99
|
|
100
|
+
def each_query_result(statement, options = {})
|
101
|
+
options.stringify_keys!
|
102
|
+
|
103
|
+
query_opts = {}
|
104
|
+
query_opts['skip_count'] = options['from']
|
105
|
+
query_opts['max_items'] = options['fetch_size']
|
106
|
+
|
107
|
+
limit = options['limit'] || 10
|
108
|
+
limit = BigDecimal::INFINITY if limit == :all
|
109
|
+
|
110
|
+
query = query(statement, query_opts)
|
111
|
+
counter = 0
|
112
|
+
while query.has_next? && counter < limit
|
113
|
+
query.next_results.each do |object|
|
114
|
+
break unless counter < limit
|
115
|
+
yield object
|
116
|
+
counter = counter.next
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
100
120
|
|
101
121
|
private
|
102
122
|
|
data/lib/yaccl/type.rb
CHANGED
@@ -38,7 +38,7 @@ module YACCL
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def update(changed_property_defs)
|
41
|
-
new_defs = changed_property_defs.map(&:to_hash).
|
41
|
+
new_defs = changed_property_defs.map(&:to_hash).reduce({}) do |result, element|
|
42
42
|
result[element[:id]] = element
|
43
43
|
result
|
44
44
|
end
|
data/lib/yaccl/version.rb
CHANGED
data/spec/document_spec.rb
CHANGED
@@ -33,13 +33,13 @@ describe YACCL::Document do
|
|
33
33
|
doc.delete
|
34
34
|
end
|
35
35
|
|
36
|
-
#it 'set content - attached' do
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
#
|
43
|
-
#
|
44
|
-
#end
|
36
|
+
# it 'set content - attached' do
|
37
|
+
# new_object = @repo.new_document
|
38
|
+
# new_object.name = 'doc3'
|
39
|
+
# new_object.object_type_id = 'cmis:document'
|
40
|
+
# doc = @repo.root.create(new_object)
|
41
|
+
# doc.set_content(StringIO.new('content3'), 'text/plain', 'doc3.txt') # set content on attached doc
|
42
|
+
# doc.content.should eq 'content3'
|
43
|
+
# doc.delete
|
44
|
+
# end
|
45
45
|
end
|
data/spec/object_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yaccl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.pre.
|
4
|
+
version: 1.0.pre.alpha3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenneth Geerts
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-02-
|
12
|
+
date: 2014-02-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: typhoeus
|