ldp 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +8 -3
- data/Gemfile +3 -1
- data/ldp.gemspec +5 -0
- data/lib/ldp.rb +3 -9
- data/lib/ldp/client.rb +20 -15
- data/lib/ldp/client/methods.rb +4 -6
- data/lib/ldp/container.rb +30 -4
- data/lib/ldp/container/basic.rb +4 -13
- data/lib/ldp/container/direct.rb +11 -6
- data/lib/ldp/container/indirect.rb +9 -3
- data/lib/ldp/error.rb +20 -0
- data/lib/ldp/orm.rb +13 -24
- data/lib/ldp/resource.rb +23 -5
- data/lib/ldp/resource/binary_source.rb +9 -1
- data/lib/ldp/resource/rdf_source.rb +26 -11
- data/lib/ldp/response.rb +117 -88
- data/lib/ldp/uri.rb +39 -23
- data/lib/ldp/version.rb +1 -1
- data/spec/lib/integration/integration_spec.rb +51 -2
- data/spec/lib/ldp/client_spec.rb +20 -11
- data/spec/lib/ldp/resource/binary_source_spec.rb +25 -0
- data/spec/lib/ldp/resource/rdf_source_spec.rb +24 -0
- data/spec/lib/ldp/resource_spec.rb +1 -2
- data/spec/lib/ldp/response_spec.rb +49 -29
- data/spec/spec_helper.rb +10 -0
- metadata +61 -6
- data/lib/ldp/response/paging.rb +0 -57
data/lib/ldp/response/paging.rb
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
module Ldp
|
2
|
-
module Response::Paging
|
3
|
-
##
|
4
|
-
# Statements about the page
|
5
|
-
def page
|
6
|
-
@page_graph ||= begin
|
7
|
-
g = RDF::Graph.new
|
8
|
-
|
9
|
-
if resource?
|
10
|
-
res = graph.query RDF::Statement.new(page_subject, nil, nil)
|
11
|
-
|
12
|
-
res.each_statement do |s|
|
13
|
-
g << s
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
g
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
##
|
22
|
-
# Get the subject for the response
|
23
|
-
def subject
|
24
|
-
@subject ||= if has_page?
|
25
|
-
graph.first_object [page_subject, Ldp.page_of, nil]
|
26
|
-
else
|
27
|
-
page_subject
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
##
|
32
|
-
# Is there a next page?
|
33
|
-
def has_next?
|
34
|
-
next_page != nil
|
35
|
-
end
|
36
|
-
|
37
|
-
##
|
38
|
-
# Get the URI for the next page
|
39
|
-
def next_page
|
40
|
-
graph.first_object [page_subject, Ldp.nextPage, nil]
|
41
|
-
end
|
42
|
-
|
43
|
-
##
|
44
|
-
# Get the URI to the first page
|
45
|
-
def first_page
|
46
|
-
if links['first']
|
47
|
-
RDF::URI.new links['first']
|
48
|
-
elsif graph.has_statement? RDf::Statement.new(page_subject, Ldp.nextPage, nil)
|
49
|
-
subject
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def sort
|
54
|
-
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|