Module: Keymaker::Node::ClassMethods

Extended by:
Forwardable
Defined in:
lib/keymaker/node.rb

Instance Method Summary collapse

Instance Method Details

#execute_cypher(query, params = {}, return_type = :results_only) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/keymaker/node.rb', line 50

def execute_cypher(query, params={}, return_type=:results_only)
  executed_query = neo_service.execute_query(query, params)
  if executed_query.present?
    case return_type
    when :results_only
      executed_query["data"].flatten
    # TODO: Make this less specific
    when :full_user
      {"user" => executed_query["data"].flatten[0]["data"], "neo_id" => executed_query["data"].flatten[1]}
    end
  else
    return []
  end
end

#propertiesObject



41
42
43
# File 'lib/keymaker/node.rb', line 41

def properties
  property_traits.keys
end

#property(attribute, type = String) ⇒ Object



45
46
47
48
# File 'lib/keymaker/node.rb', line 45

def property(attribute,type=String)
  property_traits[attribute] = type
  attr_accessor attribute
end