ldp 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 652e178917c335b0881ee4e23026d25dc32aa936
4
- data.tar.gz: 20aa0d107df87615a4159ccc10074f7f8269f006
3
+ metadata.gz: aed769ef892aa0d5ba1e4c05b3800348191d64c9
4
+ data.tar.gz: e46dfc3a68c8028b857f9158c191d2bf953a630e
5
5
  SHA512:
6
- metadata.gz: cc468961929d9774a534438c7ce2ed062b603f13dab4251d7fedb3012ccc0290bc188d038e48d142a7cd32505f46249d54b6e75e0b49415554c4fe68b326c5b1
7
- data.tar.gz: 76423521a6ebf9327fda8ebb4d8526b95e84f038891cda7322c8ec1714c65da84e36f5b8212a6cf38c55cd411c1c0f87e8383881534e58c6da84f4a4fce5d846
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
- MIT License
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
- Permission is hereby granted, free of charge, to any person obtaining
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
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
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
+ ![Project Hydra Logo](https://github.com/uvalib/libra-oa/blob/a6564a9e5c13b7873dc883367f5e307bf715d6cf/public/images/powered_by_hydra.png?raw=true)
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 = "MIT"
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) }
@@ -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 = default_headers.merge 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 = default_headers.merge 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 = default_patch_headers.merge 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
@@ -17,7 +17,7 @@ module Ldp
17
17
 
18
18
  def create
19
19
  super do |req|
20
- req.headers = { "Content-Type" => "text/turtle" }
20
+ req.headers["Content-Type"] = "text/turtle"
21
21
  end
22
22
  end
23
23
 
data/lib/ldp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ldp
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
@@ -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 eq({ "Content-Type" => "text/turtle" })
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 eq({ "Content-Type" => "application/pdf" })
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 eq({ "Content-Type" => "application/pdf" })
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.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-01-27 00:00:00.000000000 Z
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
- - MIT
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.2.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: