ldp 0.2.2 → 0.2.3
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/LICENSE.txt +9 -18
- data/README.md +6 -0
- data/ldp.gemspec +1 -1
- data/lib/ldp/client/methods.rb +3 -3
- data/lib/ldp/resource/rdf_source.rb +1 -1
- data/lib/ldp/version.rb +1 -1
- data/spec/lib/ldp/client_spec.rb +29 -3
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aed769ef892aa0d5ba1e4c05b3800348191d64c9
|
4
|
+
data.tar.gz: e46dfc3a68c8028b857f9158c191d2bf953a630e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21151cf14c58ab5901e02f487a04592909080b2edba9ad23c447ccf266e1d0a7085a6dd973dbdff932207c4d9f29af08796ab11d183ab0125623edbb3a284056
|
7
|
+
data.tar.gz: b4dd704c77df50f18d3420eff5ec4ce35671fc793ecef6e001abba69dc5cb7f8c11408c09a2fd801c48d2c1527f506a57d21bb1e38c697cdf3c17f90aa9d002a
|
data/LICENSE.txt
CHANGED
@@ -1,22 +1,13 @@
|
|
1
1
|
Copyright (c) 2013 Chris Beer
|
2
2
|
|
3
|
-
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
4
6
|
|
5
|
-
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
12
8
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.md
CHANGED
@@ -49,3 +49,9 @@ Due to some discrepancies with alpha version of Fedora Commons, you may need to
|
|
49
49
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
50
50
|
4. Push to the branch (`git push origin my-new-feature`)
|
51
51
|
5. Create new Pull Request
|
52
|
+
|
53
|
+
# Project Hydra
|
54
|
+
This software has been developed by and is brought to you by the Hydra community. Learn more at the
|
55
|
+
[Project Hydra website](http://projecthydra.org)
|
56
|
+
|
57
|
+

|
data/ldp.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.description = %q{Linked Data Platform client library}
|
12
12
|
spec.summary = spec.description
|
13
13
|
spec.homepage = "https://github.com/cbeer/ldp"
|
14
|
-
spec.license = "
|
14
|
+
spec.license = "APACHE2"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
data/lib/ldp/client/methods.rb
CHANGED
@@ -69,7 +69,7 @@ module Ldp::Client::Methods
|
|
69
69
|
logger.debug "LDP: POST [#{url}]"
|
70
70
|
resp = http.post do |req|
|
71
71
|
req.url munge_to_relative_url(url)
|
72
|
-
req.headers
|
72
|
+
req.headers.merge!(default_headers).merge!(headers)
|
73
73
|
req.body = body
|
74
74
|
yield req if block_given?
|
75
75
|
end
|
@@ -81,7 +81,7 @@ module Ldp::Client::Methods
|
|
81
81
|
logger.debug "LDP: PUT [#{url}]"
|
82
82
|
resp = http.put do |req|
|
83
83
|
req.url munge_to_relative_url(url)
|
84
|
-
req.headers
|
84
|
+
req.headers.merge!(default_headers).merge!(headers)
|
85
85
|
req.body = body
|
86
86
|
yield req if block_given?
|
87
87
|
end
|
@@ -93,7 +93,7 @@ module Ldp::Client::Methods
|
|
93
93
|
logger.debug "LDP: PATCH [#{url}]"
|
94
94
|
resp = http.patch do |req|
|
95
95
|
req.url munge_to_relative_url(url)
|
96
|
-
req.headers
|
96
|
+
req.headers.merge!(default_patch_headers).merge!(headers)
|
97
97
|
req.body = body
|
98
98
|
yield req if block_given?
|
99
99
|
end
|
data/lib/ldp/version.rb
CHANGED
data/spec/lib/ldp/client_spec.rb
CHANGED
@@ -30,6 +30,7 @@ describe "Ldp::Client" do
|
|
30
30
|
stub.delete("/a_resource") { [204] }
|
31
31
|
stub.head('/a_container') { [200] }
|
32
32
|
stub.post("/a_container") { [201, {"Location" => "http://example.com/a_container/subresource"}] }
|
33
|
+
stub.patch("/a_container") { [201, {"Location" => "http://example.com/a_container/subresource"}] }
|
33
34
|
stub.get("/test:1") { [200] }
|
34
35
|
stub.get("http://test:8080/abc") { [200] }
|
35
36
|
stub.put("/mismatch_resource") { [412] }
|
@@ -132,13 +133,13 @@ describe "Ldp::Client" do
|
|
132
133
|
|
133
134
|
it "should set default Content-type" do
|
134
135
|
subject.post "a_container", 'foo' do |req|
|
135
|
-
expect(req.headers).to
|
136
|
+
expect(req.headers).to include({ "Content-Type" => "text/turtle" })
|
136
137
|
end
|
137
138
|
end
|
138
139
|
|
139
140
|
it "should set headers" do
|
140
141
|
subject.post "a_container", 'foo', {'Content-Type' => 'application/pdf'} do |req|
|
141
|
-
expect(req.headers).to
|
142
|
+
expect(req.headers).to include({ "Content-Type" => "application/pdf" })
|
142
143
|
end
|
143
144
|
end
|
144
145
|
|
@@ -150,6 +151,13 @@ describe "Ldp::Client" do
|
|
150
151
|
expect { |b| subject.post "a_container", &b }.to yield_control
|
151
152
|
end
|
152
153
|
|
154
|
+
it "should preserve basic auth headers" do
|
155
|
+
subject.http.basic_auth('Aladdin', 'open sesame')
|
156
|
+
subject.post "a_container", 'foo' do |req|
|
157
|
+
expect(req.headers).to include({ "Authorization" => "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" })
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
153
161
|
end
|
154
162
|
|
155
163
|
describe "put" do
|
@@ -164,7 +172,7 @@ describe "Ldp::Client" do
|
|
164
172
|
|
165
173
|
it "should set headers" do
|
166
174
|
subject.put "a_resource", 'payload', {'Content-Type' => 'application/pdf'} do |req|
|
167
|
-
expect(req.headers).to
|
175
|
+
expect(req.headers).to include({ "Content-Type" => "application/pdf" })
|
168
176
|
end
|
169
177
|
end
|
170
178
|
|
@@ -181,8 +189,26 @@ describe "Ldp::Client" do
|
|
181
189
|
expect { subject.put "mismatch_resource", "some-payload" }.to raise_error Ldp::EtagMismatch
|
182
190
|
end
|
183
191
|
end
|
192
|
+
|
193
|
+
it "should preserve basic auth headers" do
|
194
|
+
subject.http.basic_auth('Aladdin', 'open sesame')
|
195
|
+
subject.put "a_resource", "some-payload" do |req|
|
196
|
+
expect(req.headers).to include({ "Authorization" => "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" })
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
184
200
|
end
|
185
201
|
|
202
|
+
describe 'patch' do
|
203
|
+
|
204
|
+
it "should preserve basic auth headers" do
|
205
|
+
subject.http.basic_auth('Aladdin', 'open sesame')
|
206
|
+
subject.patch "a_container", 'foo' do |req|
|
207
|
+
expect(req.headers).to include({ "Authorization" => "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" })
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
end
|
186
212
|
|
187
213
|
describe "find_or_initialize" do
|
188
214
|
it "should be a resource" do
|
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.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -149,7 +149,7 @@ files:
|
|
149
149
|
- spec/spec_helper.rb
|
150
150
|
homepage: https://github.com/cbeer/ldp
|
151
151
|
licenses:
|
152
|
-
-
|
152
|
+
- APACHE2
|
153
153
|
metadata: {}
|
154
154
|
post_install_message:
|
155
155
|
rdoc_options: []
|
@@ -167,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
167
|
version: '0'
|
168
168
|
requirements: []
|
169
169
|
rubyforge_project:
|
170
|
-
rubygems_version: 2.
|
170
|
+
rubygems_version: 2.4.5
|
171
171
|
signing_key:
|
172
172
|
specification_version: 4
|
173
173
|
summary: Linked Data Platform client library
|
@@ -180,4 +180,3 @@ test_files:
|
|
180
180
|
- spec/lib/ldp/resource_spec.rb
|
181
181
|
- spec/lib/ldp/response_spec.rb
|
182
182
|
- spec/spec_helper.rb
|
183
|
-
has_rdoc:
|