Class: Delfos::Neo4j::QueryExecution::Transactional
- Inherits:
-
Object
- Object
- Delfos::Neo4j::QueryExecution::Transactional
- Includes:
- HttpQuery
- Defined in:
- lib/delfos/neo4j/query_execution/transactional.rb
Constant Summary collapse
- VALID_RESPONSE_MATCHER =
/\A2\d\d\z/
Class Method Summary collapse
Instance Method Summary collapse
Methods included from HttpQuery
Class Method Details
.check_for_error(uri, response) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/delfos/neo4j/query_execution/transactional.rb', line 25 def self.check_for_error(uri, response) return if response.code[VALID_RESPONSE_MATCHER] if response.code == "404" raise ExpiredTransaction.new(uri, response) end raise InvalidCommit.new(uri, response) end |
Instance Method Details
#perform ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/delfos/neo4j/query_execution/transactional.rb', line 35 def perform self.class.check_for_error(uri, response) raise InvalidQuery.new(json["errors"], query, params) if errors? transaction_url = URI.parse header("location") if header("location") commit_url = URI.parse json["commit"] if json["commit"] expires = Time.parse json["transaction"]["expires"] if json["transaction"] [transaction_url, commit_url, expires] end |