ldp 0.0.6 → 0.0.7

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: e8f3d184e1548ea9060af3c059322168f6753e13
4
- data.tar.gz: 69d0817c390fbcbff78fb98adf180ddd1e0be33b
3
+ metadata.gz: c435d58f60d41a302a24df4ebf7f3bd9323d87d8
4
+ data.tar.gz: 25e877748727f653488862222cee9aebbca30046
5
5
  SHA512:
6
- metadata.gz: aab3b961a934cd34e826a6504c079e2531826fbfe0b6b4b13ca63e0cb6f3edefdc6595be6931994f471605c96097e5309dd13116d3dcbe86ec259dc7b9629e3f
7
- data.tar.gz: 0f8212e7fd4e83f494cda059ad2acb6395129b239a36df47d8abdb7d9d67ad93bb7377d1675f1a0cd2f70a4552cedd65553477ebe2016bf27cffdea53178364e
6
+ metadata.gz: 732e238782ff1a21407b629bc54a13ba63f621b6494fcde36d9d2b637e5562c946573108e852c3e2746e928a1afb35ece225a7a2d2879e78c872688a157c6f8e
7
+ data.tar.gz: 0149eaba7795e019401075761dfa9adfe5ad9b2496153e271c4753cb32d8d62017c922d1681bd1c3b6af946928d01038d3d8deb3071c7db4bef0e4dc84fc5ef8
data/lib/ldp.rb CHANGED
@@ -19,6 +19,7 @@ module Ldp
19
19
 
20
20
  class HttpError < RuntimeError; end
21
21
  class NotFound < HttpError; end
22
+ class EtagMismatch < HttpError; end
22
23
 
23
24
  class << self
24
25
  def logger
@@ -104,8 +104,14 @@ module Ldp::Client::Methods
104
104
  def check_for_errors resp
105
105
  resp.tap do |resp|
106
106
  unless resp.success?
107
- raise Ldp::NotFound.new(resp.body) if resp.status == 404
108
- raise Ldp::HttpError.new("STATUS: #{resp.status} #{resp.body[0, 1000]}...")
107
+ raise case resp.status
108
+ when 404
109
+ Ldp::NotFound.new(resp.body) if resp.status == 404
110
+ when 412
111
+ Ldp::EtagMismatch.new(resp.body) if resp.status == 412
112
+ else
113
+ Ldp::HttpError.new("STATUS: #{resp.status} #{resp.body[0, 1000]}...")
114
+ end
109
115
  end
110
116
  end
111
117
  end
data/lib/ldp/orm.rb CHANGED
@@ -69,7 +69,7 @@ module Ldp
69
69
  if result.is_a? RDF::Graph
70
70
  raise GraphDifferenceException.new "", result
71
71
  elsif !result
72
- raise SaveException.new @last_response
72
+ raise @last_response
73
73
  end
74
74
 
75
75
  result
@@ -103,7 +103,4 @@ module Ldp
103
103
  @diff = diff
104
104
  end
105
105
  end
106
-
107
- class SaveException < RuntimeError
108
- end
109
106
  end
data/lib/ldp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ldp
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -67,7 +67,7 @@ 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::SaveException, "STATUS: 412 Bad If-Match header value: 'ae43aa934dc4f4e15ea1b4dd1ca7a56791972836'...")
70
+ expect { subject.save! }.to raise_exception(Ldp::EtagMismatch, "Bad If-Match header value: 'ae43aa934dc4f4e15ea1b4dd1ca7a56791972836'")
71
71
  end
72
72
  end
73
73
 
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.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-22 00:00:00.000000000 Z
11
+ date: 2014-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -166,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
166
  version: '0'
167
167
  requirements: []
168
168
  rubyforge_project:
169
- rubygems_version: 2.2.2
169
+ rubygems_version: 2.4.1
170
170
  signing_key:
171
171
  specification_version: 4
172
172
  summary: Linked Data Platform client library