Class: Sip2::PatronInformation
- Inherits:
-
Object
- Object
- Sip2::PatronInformation
- Defined in:
- lib/sip2/patron_information.rb
Overview
Sip2 Patron Information
Instance Attribute Summary collapse
-
#raw_response ⇒ Object
readonly
Returns the value of attribute raw_response.
Instance Method Summary collapse
- #authenticated? ⇒ Boolean
- #email ⇒ Object
-
#initialize(patron_response) ⇒ PatronInformation
constructor
A new instance of PatronInformation.
- #inspect ⇒ Object
- #patron_valid? ⇒ Boolean
Constructor Details
#initialize(patron_response) ⇒ PatronInformation
Returns a new instance of PatronInformation.
8 9 10 |
# File 'lib/sip2/patron_information.rb', line 8 def initialize(patron_response) @raw_response = patron_response end |
Instance Attribute Details
#raw_response ⇒ Object (readonly)
Returns the value of attribute raw_response.
6 7 8 |
# File 'lib/sip2/patron_information.rb', line 6 def raw_response @raw_response end |
Instance Method Details
#authenticated? ⇒ Boolean
16 17 18 |
# File 'lib/sip2/patron_information.rb', line 16 def authenticated? raw_response[/\|CQ([YN])\|/, 1] == 'Y' end |
#email ⇒ Object
20 21 22 |
# File 'lib/sip2/patron_information.rb', line 20 def email raw_response[/\|BE(.*?)\|/, 1] end |
#inspect ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/sip2/patron_information.rb', line 24 def inspect format( '#<%s:0x%p @patron_valid="%s" @email="%s" @authenticated="%s">', self.class.name, object_id, patron_valid?, email, authenticated? ) end |
#patron_valid? ⇒ Boolean
12 13 14 |
# File 'lib/sip2/patron_information.rb', line 12 def patron_valid? raw_response[/\|BL([YN])\|/, 1] == 'Y' end |