Sha256: 7c9041b31f25114d90f9541e39a40198889231bc325419a4714c2456ed09327f

Contents?: true

Size: 635 Bytes

Versions: 3

Compression:

Stored size: 635 Bytes

Contents

module Sip2
  #
  # Sip2 Patron Information
  #
  class PatronInformation
    attr_reader :raw_response

    def initialize(patron_response)
      @raw_response = patron_response
    end

    def patron_valid?
      raw_response[/\|BL([YN])\|/, 1] == 'Y'
    end

    def authenticated?
      raw_response[/\|CQ([YN])\|/, 1] == 'Y'
    end

    def email
      raw_response[/\|BE(.*?)\|/, 1]
    end

    def inspect
      format(
        '#<%s:0x%p @patron_valid="%s" @email="%s" @authenticated="%s">',
        self.class.name,
        object_id,
        patron_valid?,
        email,
        authenticated?
      )
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sip2-0.0.3 lib/sip2/patron_information.rb
sip2-0.0.2 lib/sip2/patron_information.rb
sip2-0.0.1 lib/sip2/patron_information.rb