class Ashikawa::Core::Edge

A certain Edge within a certain Collection

Attributes

from_id[R]

The ID of the ‘from’ document

@return [String] @api public @example Get the ID for the ‘from’ Document

document = Ashikawa::Core::Edge.new(database, raw_document)
document.from_id # => 'my_fancy_collection/2345678'
to_id[R]

The ID of the ‘to’ document

@return [String] @api public @example Get the ID for the ‘to’ Document

document = Ashikawa::Core::Edge.new(database, raw_document)
document.to_id # => 'my_fancy_collection/2345678'

Public Class Methods

new(_database, raw_edge, _additional_data = {}) click to toggle source

Initialize an Edge with the database and raw data

@param [Database] _database @param [Hash] raw_edge @param [Hash] _additional_data @option _additional_data [Graph] graph The graph this edge is associated with @api public @example Create an Edge

document = Ashikawa::Core::Edge.new(database, raw_edge)
Calls superclass method Ashikawa::Core::Document::new
# File lib/ashikawa-core/edge.rb, line 37
def initialize(_database, raw_edge, _additional_data = {})
  @from_id = raw_edge['_from']
  @to_id = raw_edge['_to']
  super
end

Protected Instance Methods

send_request_for_document(opts) click to toggle source

Send a request for this edge with the given opts

@param [Hash] opts Options for this request @return [Hash] The parsed response from the server @api private

# File lib/ashikawa-core/edge.rb, line 50
def send_request_for_document(opts)
  if graph
    @database.send_request("gharial/#{graph.name}/edge/#{@id}", opts)
  else
    @database.send_request("edge/#{@id}", opts)
  end
end