Class: WebHDFS::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/webhdfs/proxy.rb

Overview

Proxy class for http requests

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(address, port) ⇒ Proxy

Constructor



7
8
9
10
11
# File 'lib/webhdfs/proxy.rb', line 7

def initialize(address, port)
  @address = address
  @port = port
  @user = @password = nil
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



4
5
6
# File 'lib/webhdfs/proxy.rb', line 4

def address
  @address
end

#passwordObject (readonly)

Returns the value of attribute password.



4
5
6
# File 'lib/webhdfs/proxy.rb', line 4

def password
  @password
end

#portObject (readonly)

Returns the value of attribute port.



4
5
6
# File 'lib/webhdfs/proxy.rb', line 4

def port
  @port
end

#userObject (readonly)

Returns the value of attribute user.



4
5
6
# File 'lib/webhdfs/proxy.rb', line 4

def user
  @user
end

Instance Method Details

#authentication?Boolean

Proxy has authentication?

Returns:

  • (Boolean)


20
21
22
23
24
25
26
# File 'lib/webhdfs/proxy.rb', line 20

def authentication?
  if @user && @password
    true
  else
    false
  end
end

#credentials(user, password) ⇒ Object

Set authentication credentials



14
15
16
17
# File 'lib/webhdfs/proxy.rb', line 14

def credentials(user, password)
  @user = user
  @password = password
end