Class: Keymaker::CreateRelationshipRequest
- Defined in:
- lib/keymaker/requests/create_relationship_request.rb
Overview
POST localhost:7474/db/data/node/85/relationships Accept: application/json Content-Type: application/json : “localhost:7474/db/data/node/84”, “type” : “LOVES”, “data” : {“foo” : “bar”}
Instance Attribute Summary
Attributes inherited from Request
Instance Method Summary collapse
Methods inherited from Request
Constructor Details
This class inherits a constructor from Keymaker::Request
Instance Method Details
#rel_properties ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/keymaker/requests/create_relationship_request.rb', line 23 def rel_properties {}.tap do |properties| properties[:to] = node_uri(opts[:end_node_id]) properties[:type] = opts[:rel_type] properties[:data] = opts[:data] if opts[:data] end end |
#submit ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/keymaker/requests/create_relationship_request.rb', line 12 def submit service.post(relationships_path_for_node(opts[:node_id]), rel_properties).on_error do |response| case response.status when (400..499) raise ClientError.new(response, response.body) when (500..599) raise ServerError.new(response, response.body) end end end |