class Orientdb4r::ExconNode
This class represents a single sever/node in the Distributed Multi-Master Architecture accessible view REST API and ‘excon’ library on the client side.
Attributes
proxy[RW]
Private Instance Methods
basic_auth_header(user, password)
click to toggle source
Gets value of the Basic Auth header.
# File lib/orientdb4r/rest/excon_node.rb, line 107 def basic_auth_header(user, password) b64 = Base64.encode64("#{user}:#{password}").delete("\r\n") "Basic #{b64}" end
connection()
click to toggle source
Gets Excon connection.
# File lib/orientdb4r/rest/excon_node.rb, line 83 def connection return @connection unless @connection.nil? options = {} options[:proxy] = proxy unless proxy.nil? @connection ||= Excon::Connection.new(url, options) #:read_timeout => self.class.read_timeout, #:write_timeout => self.class.write_timeout, #:connect_timeout => self.class.connect_timeout end
headers(options)
click to toggle source
Get request headers prepared with session ID and Basic Auth.
# File lib/orientdb4r/rest/excon_node.rb, line 97 def headers(options) rslt = {'Authorization' => basic_auth_header(options[:user], options[:password])} rslt['Cookie'] = "#{SESSION_COOKIE_NAME}=#{session_id}" if !session_id.nil? and !options[:no_session] rslt['Content-Type'] = options[:content_type] if options.include? :content_type rslt['User-Agent'] = user_agent unless user_agent.nil? rslt end