ldp 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/Gemfile +2 -2
- data/ldp.gemspec +5 -2
- data/lib/ldp.rb +3 -1
- data/lib/ldp/client/methods.rb +1 -1
- data/lib/ldp/error.rb +8 -6
- data/lib/ldp/version.rb +1 -1
- data/spec/lib/ldp/client_spec.rb +2 -2
- data/spec/lib/ldp/orm/orm_spec.rb +6 -6
- data/spec/lib/ldp/resource/rdf_source_spec.rb +1 -1
- data/spec/spec_helper.rb +4 -4
- metadata +46 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 242a8bac0d570bda5387a6883f122078b33be099
|
4
|
+
data.tar.gz: 3313163cca6a9daab1e152ab4712c1c0f507a4a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4ae6556d98e34e2852930d54148a65ee35daa122e11681013d6481b2ba8685a730788d8643c315c78091175c54fbd39634b4f3b868b00bcec4072ab34f4a1bb
|
7
|
+
data.tar.gz: dfdb01e0843f5bb894f1a1a83a8acfe46bb3e12c151283574bcede9eaaf11b2d1f09b182c7cebdad8f801756b66698b00fed319c4622d117fd7ed086e9433cd4
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/ldp.gemspec
CHANGED
@@ -20,8 +20,11 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
22
|
spec.add_dependency "faraday"
|
23
|
-
spec.add_dependency "
|
24
|
-
spec.add_dependency "rdf-
|
23
|
+
spec.add_dependency "rdf", ">= 1.1"
|
24
|
+
spec.add_dependency "rdf-turtle"
|
25
|
+
spec.add_dependency "rdf-vocab", ">= 0.8"
|
26
|
+
spec.add_dependency "rdf-isomorphic"
|
27
|
+
spec.add_dependency "json-ld"
|
25
28
|
spec.add_dependency "http_logger"
|
26
29
|
spec.add_dependency "deprecation"
|
27
30
|
spec.add_dependency "slop"
|
data/lib/ldp.rb
CHANGED
data/lib/ldp/client/methods.rb
CHANGED
@@ -132,7 +132,7 @@ module Ldp::Client::Methods
|
|
132
132
|
when 410
|
133
133
|
Ldp::Gone.new(resp.body)
|
134
134
|
when 412
|
135
|
-
Ldp::
|
135
|
+
Ldp::PreconditionFailed.new(resp.body)
|
136
136
|
else
|
137
137
|
Ldp::HttpError.new("STATUS: #{resp.status} #{resp.body[0, 1000]}...")
|
138
138
|
end
|
data/lib/ldp/error.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
module Ldp
|
2
2
|
class Error < StandardError; end
|
3
3
|
|
4
|
-
class HttpError
|
5
|
-
class BadRequest
|
6
|
-
class NotFound
|
7
|
-
class Conflict
|
8
|
-
class Gone
|
9
|
-
class
|
4
|
+
class HttpError < RuntimeError; end
|
5
|
+
class BadRequest < HttpError; end # 400
|
6
|
+
class NotFound < HttpError; end # 404
|
7
|
+
class Conflict < HttpError; end # 409
|
8
|
+
class Gone < HttpError; end # 410
|
9
|
+
class PreconditionFailed < HttpError; end # 412
|
10
10
|
|
11
11
|
class UnexpectedContentType < RuntimeError; end
|
12
12
|
|
@@ -17,4 +17,6 @@ module Ldp
|
|
17
17
|
@diff = diff
|
18
18
|
end
|
19
19
|
end
|
20
|
+
|
21
|
+
ETagMismatch = PreconditionFailed # deprecation
|
20
22
|
end
|
data/lib/ldp/version.rb
CHANGED
data/spec/lib/ldp/client_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
describe "Ldp::Client" do
|
3
3
|
|
4
4
|
let(:simple_graph) do
|
5
|
-
graph = RDF::Graph.new << [RDF::URI.new(""), RDF::DC.title, "Hello, world!"]
|
5
|
+
graph = RDF::Graph.new << [RDF::URI.new(""), RDF::Vocab::DC.title, "Hello, world!"]
|
6
6
|
graph.dump(:ttl)
|
7
7
|
end
|
8
8
|
|
@@ -236,7 +236,7 @@ describe "Ldp::Client" do
|
|
236
236
|
end
|
237
237
|
|
238
238
|
it "checks for 412 errors" do
|
239
|
-
expect { subject.put "mismatch_resource", "some-payload" }.to raise_error Ldp::
|
239
|
+
expect { subject.put "mismatch_resource", "some-payload" }.to raise_error Ldp::PreconditionFailed
|
240
240
|
end
|
241
241
|
end
|
242
242
|
|
@@ -4,7 +4,7 @@ describe Ldp::Orm do
|
|
4
4
|
subject { Ldp::Orm.new test_resource }
|
5
5
|
|
6
6
|
let(:simple_graph) do
|
7
|
-
RDF::Graph.new << [RDF::URI.new(""), RDF::DC.title, "Hello, world!"]
|
7
|
+
RDF::Graph.new << [RDF::URI.new(""), RDF::Vocab::DC.title, "Hello, world!"]
|
8
8
|
end
|
9
9
|
|
10
10
|
let(:conn_stubs) do
|
@@ -67,19 +67,19 @@ describe Ldp::Orm do
|
|
67
67
|
it "should raise an exception if the ETag didn't match" do
|
68
68
|
conn_stubs.instance_variable_get(:@stack)[:put] = [] # erases the stubs for :put
|
69
69
|
conn_stubs.put('/a_resource') {[412, {}, "Bad If-Match header value: 'ae43aa934dc4f4e15ea1b4dd1ca7a56791972836'"]}
|
70
|
-
expect { subject.save! }.to raise_exception(Ldp::
|
70
|
+
expect { subject.save! }.to raise_exception(Ldp::PreconditionFailed, "Bad If-Match header value: 'ae43aa934dc4f4e15ea1b4dd1ca7a56791972836'")
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
74
|
describe "#value" do
|
75
75
|
it "should provide a convenience method for retrieving values" do
|
76
|
-
expect(subject.value(RDF::DC.title).first.to_s).to eq "Hello, world!"
|
76
|
+
expect(subject.value(RDF::Vocab::DC.title).first.to_s).to eq "Hello, world!"
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
80
|
describe "#reload" do
|
81
81
|
before do
|
82
|
-
updated_graph = RDF::Graph.new << [RDF::URI.new(""), RDF::DC.title, "Hello again, world!"]
|
82
|
+
updated_graph = RDF::Graph.new << [RDF::URI.new(""), RDF::Vocab::DC.title, "Hello again, world!"]
|
83
83
|
conn_stubs.get('/a_resource') {[200,
|
84
84
|
{"Link" => "<http://www.w3.org/ns/ldp#Resource>;rel=\"type\", <http://www.w3.org/ns/ldp#DirectContainer>;rel=\"type\"",
|
85
85
|
"ETag" => "new-tag"},
|
@@ -87,9 +87,9 @@ describe Ldp::Orm do
|
|
87
87
|
end
|
88
88
|
|
89
89
|
it "loads the new values" do
|
90
|
-
old_value = subject.value(RDF::DC.title).first.to_s
|
90
|
+
old_value = subject.value(RDF::Vocab::DC.title).first.to_s
|
91
91
|
reloaded = subject.reload
|
92
|
-
expect(reloaded.value(RDF::DC.title).first.to_s).not_to eq old_value
|
92
|
+
expect(reloaded.value(RDF::Vocab::DC.title).first.to_s).not_to eq old_value
|
93
93
|
end
|
94
94
|
|
95
95
|
it "uses the new ETag" do
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
describe Ldp::Resource::RdfSource do
|
5
5
|
let(:simple_graph) do
|
6
|
-
RDF::Graph.new << [RDF::URI.new(), RDF::DC.title, "Hello, world!"]
|
6
|
+
RDF::Graph.new << [RDF::URI.new(), RDF::Vocab::DC.title, "Hello, world!"]
|
7
7
|
end
|
8
8
|
|
9
9
|
let(:simple_graph_source) do
|
data/spec/spec_helper.rb
CHANGED
@@ -4,10 +4,10 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
4
4
|
require 'simplecov'
|
5
5
|
require 'coveralls'
|
6
6
|
|
7
|
-
SimpleCov.formatter =
|
8
|
-
SimpleCov::Formatter::HTMLFormatter,
|
9
|
-
|
10
|
-
|
7
|
+
SimpleCov.formatter =
|
8
|
+
SimpleCov::Formatter::MultiFormatter.new([SimpleCov::Formatter::HTMLFormatter,
|
9
|
+
Coveralls::SimpleCov::Formatter])
|
10
|
+
|
11
11
|
SimpleCov.start do
|
12
12
|
add_filter 'spec/'
|
13
13
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ldp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rdf
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -38,8 +38,50 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rdf-turtle
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rdf-vocab
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.8'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.8'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rdf-isomorphic
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: json-ld
|
43
85
|
requirement: !ruby/object:Gem::Requirement
|
44
86
|
requirements:
|
45
87
|
- - ">="
|
@@ -225,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
225
267
|
version: '0'
|
226
268
|
requirements: []
|
227
269
|
rubyforge_project:
|
228
|
-
rubygems_version: 2.
|
270
|
+
rubygems_version: 2.5.1
|
229
271
|
signing_key:
|
230
272
|
specification_version: 4
|
231
273
|
summary: Linked Data Platform client library
|