Class: Neo4j::Core::CypherSession::Transactions::HTTP
- Inherits:
-
Base
- Object
- Transaction::Base
- Base
- Neo4j::Core::CypherSession::Transactions::HTTP
- Defined in:
- lib/neo4j/core/cypher_session/transactions/http.rb
Instance Attribute Summary
Attributes inherited from Transaction::Base
Instance Method Summary collapse
-
#apply_id_from_url!(url) ⇒ Object
Takes the transaction URL from Neo4j and parses out the ID.
-
#commit ⇒ Object
Should perhaps have transaction adaptors only define #close commit/delete are, I think, an implementation detail.
- #delete ⇒ Object
- #id ⇒ Object
- #query_path(commit = false) ⇒ Object
- #started? ⇒ Boolean
Methods inherited from Base
#after_commit, #after_commit_registry, #post_close!, #queries, #query
Methods inherited from Transaction::Base
#autoclosed!, #close, #closed?, #expired?, #failed?, #initialize, #inspect, #mark_expired, #mark_failed, #root?
Constructor Details
This class inherits a constructor from Neo4j::Transaction::Base
Instance Method Details
#apply_id_from_url!(url) ⇒ Object
Takes the transaction URL from Neo4j and parses out the ID
30 31 32 33 |
# File 'lib/neo4j/core/cypher_session/transactions/http.rb', line 30 def apply_id_from_url!(url) root.instance_variable_set('@id', url.match(%r{/(\d+)/?$})[1].to_i) if url # @id = url.match(%r{/(\d+)/?$})[1].to_i if url end |
#commit ⇒ Object
Should perhaps have transaction adaptors only define #close commit/delete are, I think, an implementation detail
11 12 13 |
# File 'lib/neo4j/core/cypher_session/transactions/http.rb', line 11 def commit adaptor.requestor.request(:post, query_path(true)) if started? end |
#delete ⇒ Object
15 16 17 |
# File 'lib/neo4j/core/cypher_session/transactions/http.rb', line 15 def delete adaptor.requestor.request(:delete, query_path) if started? end |
#id ⇒ Object
39 40 41 |
# File 'lib/neo4j/core/cypher_session/transactions/http.rb', line 39 def id root.instance_variable_get('@id') end |
#query_path(commit = false) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/neo4j/core/cypher_session/transactions/http.rb', line 19 def query_path(commit = false) if id "/db/data/transaction/#{id}" else '/db/data/transaction' end.tap do |path| path << '/commit' if commit end end |
#started? ⇒ Boolean
35 36 37 |
# File 'lib/neo4j/core/cypher_session/transactions/http.rb', line 35 def started? !!id end |