Sha256: c45940b63409601f09a13ee03ed86d89c5e5be010f12041c43c617c323c13934

Contents?: true

Size: 862 Bytes

Versions: 1

Compression:

Stored size: 862 Bytes

Contents

module Voyager
  class Connection

    attr_reader :http_client

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

      set_cookie_path if @cookie_path
      

    end


    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

    private


    def set_cookie_path
      cookie_directory = File.dirname(@cookie_path)

      FileUtils.mkdir_p(cookie_directory) unless File.exists?(cookie_directory)

      @http_client.set_cookie_store(@cookie_path)
      
      
    end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
voyager_api-0.3.0 lib/voyager_connection.rb