Class: Keymaker::CreateRelationshipRequest

Inherits:
Request
  • Object
show all
Defined in:
lib/keymaker/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

#config, #opts, #service

Instance Method Summary collapse

Methods inherited from Request

#initialize

Constructor Details

This class inherits a constructor from Keymaker::Request

Instance Method Details

#rel_propertiesObject



16
17
18
19
20
21
22
# File 'lib/keymaker/create_relationship_request.rb', line 16

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

#submitObject



12
13
14
# File 'lib/keymaker/create_relationship_request.rb', line 12

def submit
  service.post(relationships_path_for_node(opts[:node_id]), rel_properties)
end