ldp 0.0.4 → 0.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b564742703ded9a1ea57b61c4d35095152470b0d
4
- data.tar.gz: 92c8f28addad7872849b36acfdeac29bb2ebf280
3
+ metadata.gz: 17053f7fbf04e6b64d7ffeed9be3f913e9a26cc9
4
+ data.tar.gz: ce8e5c9c59bad81c8fb1fad3216578f8379027d1
5
5
  SHA512:
6
- metadata.gz: c47ff6ed7653614374db095e93defbfa21138b072862de841464c06b8c0494707ee5d39610d06bdb640d8b4214590aae81de5f264ccbb61349afe2ffffaeb594
7
- data.tar.gz: 2ad220371ea1d981c8ab3d29aca7f615e0bf573d56da2c56de84ba0d15a23a1173638eba23e97ef38d09eab26a7cef398037113453b017a8ffe5b01c138b25aa
6
+ metadata.gz: 5428c3dbfc518bd48967f849d0b4a42aad3d967d13c35f6725449189223bf0d3fd40f7c00ef349dbaa316b2a05c650cd33ba613b5969848c23e2f1bd2527bc91
7
+ data.tar.gz: 4bc45e92606ee0940cee48a937eb9ff53a15f2adf7bc533e81af5cc075410c4b8f46318bb8374c61f7969d30a07455655642fbaa95f7110e2ac07e8429ab78f1
@@ -55,14 +55,7 @@ module Ldp
55
55
  def save
56
56
  Ldp.instrument 'save.orm.ldp', subject: subject_uri do
57
57
  @last_response = resource.save
58
-
59
- diff = resource.check_for_differences_and_reload
60
-
61
- if diff.any?
62
- diff
63
- else
64
- @last_response.success?
65
- end
58
+ @last_response.success?
66
59
  end
67
60
  rescue Ldp::HttpError => e
68
61
  @last_response = e
@@ -48,30 +48,5 @@ module Ldp
48
48
  end
49
49
  end
50
50
  end
51
-
52
- def check_for_differences_and_reload
53
- self.class.check_for_differences_and_reload_resource self
54
- end
55
-
56
- def self.check_for_differences_and_reload_resource old_object
57
- new_object = old_object.reload
58
-
59
- bijection = new_object.graph.bijection_to(old_object.graph)
60
- diff = RDF::Graph.new
61
-
62
- old_object.graph.each do |statement|
63
- if statement.has_blank_nodes?
64
- subject = bijection.fetch(statement.subject, false) if statement.subject.node?
65
- object = bijection.fetch(statement.object, false) if statement.object.node?
66
- bijection_statement = RDF::Statement.new :subject => subject || statemnet.subject, :predicate => statement.predicate, :object => object || statement.object
67
-
68
- diff << statement if subject === false or object === false or new_object.graph.has_statement?(bijection_statement)
69
- elsif !new_object.graph.has_statement? statement
70
- diff << statement
71
- end
72
- end
73
-
74
- diff
75
- end
76
51
  end
77
52
  end
@@ -1,3 +1,3 @@
1
1
  module Ldp
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -56,12 +56,6 @@ describe Ldp::Orm do
56
56
  expect(subject.save).to be_true
57
57
  end
58
58
 
59
- it "should provide a graph of differences if the post-save graph doesn't match our graph" do
60
- subject.graph << RDF::Statement.new(:subject => subject.resource.subject_uri, :predicate => RDF::URI.new("info:some-predicate"), :object => RDF::Literal.new("xyz"))
61
- result = subject.save
62
- expect(result).to_not be_empty
63
- end
64
-
65
59
  it "should return false if the response was not successful" do
66
60
  conn_stubs.instance_variable_get(:@stack)[:put] = [] # erases the stubs for :put
67
61
  conn_stubs.put('/a_resource') {[412, nil, 'There was an error']}
@@ -70,11 +64,6 @@ describe Ldp::Orm do
70
64
  end
71
65
 
72
66
  describe "#save!" do
73
- it "should raise an exception if there are differences after saving the graph" do
74
- subject.graph << RDF::Statement.new(:subject => subject.resource.subject_uri, :predicate => RDF::URI.new("info:some-predicate"), :object => RDF::Literal.new("xyz"))
75
- expect { subject.save! }.to raise_exception(Ldp::GraphDifferenceException)
76
- end
77
-
78
67
  it "should raise an exception if the ETag didn't match" do
79
68
  conn_stubs.instance_variable_get(:@stack)[:put] = [] # erases the stubs for :put
80
69
  conn_stubs.put('/a_resource') {[412, {}, "Bad If-Match header value: 'ae43aa934dc4f4e15ea1b4dd1ca7a56791972836'"]}
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.4
4
+ version: 0.0.5
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-04-20 00:00:00.000000000 Z
11
+ date: 2014-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday