Class: Voyager::Connection

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Connection

Returns a new instance of Connection.



6
7
8
9
10
11
12
13
# File 'lib/voyager_connection.rb', line 6

def initialize(options = {})
  @http_client = options[:http_client] || HTTPClient.new
  @cookie_path = options[:cookie_path]

  set_cookie_path if @cookie_path


end

Instance Attribute Details

#http_clientObject (readonly)

Returns the value of attribute http_client.



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

def http_client
  @http_client
end

Instance Method Details

#clean_session!(server = "http://vetiver.cc.columbia.edu:7014") ⇒ Object



22
23
24
25
# File 'lib/voyager_connection.rb', line 22

def clean_session!(server = "http://vetiver.cc.columbia.edu:7014")
  @http_client.get_content(server + "/vxws/SessionCleanupService")

end

#request(url, options = {}) ⇒ Object



16
17
18
19
20
# File 'lib/voyager_connection.rb', line 16

def request(url, options = {})
  request = @http_client.get_content(url, options)
  @http_client.cookie_manager.save_all_cookies(true) if @cookie_path
  return request
end