Sha256: b96c5fb5f6d8f4da13060ab1c09de76e23d5661558ef697c47092102b8caf835
Contents?: true
Size: 1.26 KB
Versions: 5
Compression:
Stored size: 1.26 KB
Contents
module N4j::Entity::Representation extend ActiveSupport::Concern included do include Comparable end module ClassMethods end def <=>(another_object) if self.class.ancestors.include?(N4j::Entity) url <=> another_object.url else super(another_object) end end def to_key persisted? ? [path[/\d+\Z/]] : nil end def url from_neo4j['self'] || place_in_batch_path end def path from_neo4j_relative['self'] || place_in_batch_path end def place_in_batch_path (place_in_batch ? "{#{place_in_batch}}" : nil) end def create_path raise 'Override in Node/Relationship' end def update_path from_neo4j_relative['properties'] end def body_hash raise 'Override in Node/Relationship' end def persist_hash(opts = {}) if needs_persist? persisted? ? update_hash(opts) : create_hash(opts) end end def create_hash(opts={}) { :to => create_path, :method => 'POST', :body => body_hash }.merge(opts) end def update_hash(opts={}) {:to => update_path, :method => 'PUT', :body => body_hash}.merge(opts) end def destroy_hash(opts={}) {:to => path, :method => 'DELETE'}.merge(opts) end def show_hash(opts={}) {:to => path, :method => 'GET'}.merge(opts) end end
Version data entries
5 entries across 5 versions & 1 rubygems