Sha256: 8b148c2eeba3fa88f6d27eb511c6f30f10fb695565365e62595bf360c6d3ebcc

Contents?: true

Size: 568 Bytes

Versions: 3

Compression:

Stored size: 568 Bytes

Contents

require "uri"
require "net/http"

require_relative "request"

module Ezid
  #
  # An EZID session
  #
  # @api private
  class Session

    attr_reader :cookie

    def initialize(response=nil)
      open(response) if response
    end

    def inspect
      super.sub(/@cookie="[^\"]+"/, "OPEN")
    end

    def open(response)
      # XXX raise exception if no cookie?
      @cookie = response.cookie if response.cookie
    end

    def close
      @cookie = nil
    end

    def closed?
      cookie.nil?
    end
    
    def open?
      !closed?
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ezid-client-0.3.0 lib/ezid/session.rb
ezid-client-0.2.0 lib/ezid/session.rb
ezid-client-0.1.1 lib/ezid/session.rb