module Neography::Rest::NodeProperties

Public Instance Methods

get_each_node_properties(id, *properties) click to toggle source
# File lib/neography/rest/node_properties.rb, line 25
def get_each_node_properties(id, *properties)
  retrieved_properties = properties.flatten.inject({}) do |memo, property|
    value = @connection.get("/node/%{id}/properties/%{property}" % {:id => get_id(id), :property => property})
    memo[property] = value unless value.nil?
    memo
  end
  return nil if retrieved_properties.empty?
  retrieved_properties
end
get_node_properties(id, *properties) click to toggle source
# File lib/neography/rest/node_properties.rb, line 17
def get_node_properties(id, *properties)
  if properties.none?
    @connection.get("/node/%{id}/properties" % {:id => get_id(id)})
  else
    get_each_node_properties(id, *properties)
  end
end
remove_each_node_properties(id, *properties) click to toggle source
# File lib/neography/rest/node_properties.rb, line 43
def remove_each_node_properties(id, *properties)
  properties.flatten.each do |property|
    @connection.delete("/node/%{id}/properties/%{property}" % {:id => get_id(id), :property => property})
  end
end
remove_node_properties(id, *properties) click to toggle source
# File lib/neography/rest/node_properties.rb, line 35
def remove_node_properties(id, *properties)
  if properties.none?
    @connection.delete("/node/%{id}/properties" % {:id => get_id(id)})
  else
    remove_each_node_properties(id, *properties)
  end
end
reset_node_properties(id, properties) click to toggle source
# File lib/neography/rest/node_properties.rb, line 12
def reset_node_properties(id, properties)
  options = { :body => properties.to_json, :headers => json_content_type }
  @connection.put("/node/%{id}/properties" % {:id => get_id(id)}, options)
end
set_node_properties(id, properties) click to toggle source
# File lib/neography/rest/node_properties.rb, line 5
def set_node_properties(id, properties)
  properties.each do |property, value|
    options = { :body => value.to_json, :headers => json_content_type }
    @connection.put("/node/%{id}/properties/%{property}" % {:id => get_id(id), :property => property}, options)
  end
end