Class: Orientdb4r::RestNode

Inherits:
Node
  • Object
show all
Defined in:
lib/orientdb4r/rest/node.rb

Overview

This class represents a single sever/node in the Distributed Multi-Master Architecture accessible view REST API.

Direct Known Subclasses

ExconNode, RestClientNode

Constant Summary collapse

'OSESSIONID'

Instance Attribute Summary collapse

Attributes inherited from Node

#host, #port, #session_id

Instance Method Summary collapse

Methods inherited from Node

#cleanup, #to_s

Methods included from Utils

#blank?, #compare_versions, #random_string, #verify_and_sanitize_options, #verify_options

Constructor Details

#initialize(host, port, ssl) ⇒ RestNode

Constructor.

Raises:

  • (ArgumentError)


17
18
19
20
21
# File 'lib/orientdb4r/rest/node.rb', line 17

def initialize(host, port, ssl)
  super(host, port)
  raise ArgumentError, 'ssl flag cannot be blank' if blank?(ssl)
  @ssl = ssl
end

Instance Attribute Details

#sslObject (readonly)

Returns the value of attribute ssl.



11
12
13
# File 'lib/orientdb4r/rest/node.rb', line 11

def ssl
  @ssl
end

#user_agentObject

HTTP header ‘User-Agent’



13
14
15
# File 'lib/orientdb4r/rest/node.rb', line 13

def user_agent
  @user_agent
end

Instance Method Details

#request(options) ⇒ Object

Sends a HTTP request to the remote server. Use following if possible:

  • session_id

  • Keep-Alive (if possible)

Raises:

  • (NotImplementedError)


37
38
39
# File 'lib/orientdb4r/rest/node.rb', line 37

def request(options)
  raise NotImplementedError, 'this should be overridden by subclass'
end

#urlObject

:nodoc:



24
25
26
# File 'lib/orientdb4r/rest/node.rb', line 24

def url #:nodoc:
  "http#{'s' if ssl}://#{host}:#{port}"
end