Module: Exlibris::Primo::ChainGang::Base

Included in:
EShelf, Reviews, Search, Tags
Defined in:
lib/exlibris/primo/chain_gang/base.rb

Overview

Primo ChainGang Base Attributes

These base attributes are included in Search, Eshelf, Tags and Reviews and allow for chaining methods together.

Examples

search = Search.new.base_url!("http://primo.library.edu").
  institution!("PRIMO").ip!("127.0.0.1") 
  #=> #<Exlibris::Primo::Search @base_url="http://primo.library.edu", 
        @institution="PRIMO", @request_attributes={:base_url => "http://primo.library.edu", 
          :institution => "PRIMO", :ip => "127.0.0.1"}>

eshelf = Eshelf.new.base_url!("http://primo.library.edu").
  institution!("PRIMO").ip!("127.0.0.1")
  #=> #<Exlibris::Primo::Eshelf @base_url="http://primo.library.edu", 
        @institution="PRIMO", @request_attributes={:base_url => "http://primo.library.edu", 
          :institution => "PRIMO", :ip => "127.0.0.1"}>

reviews = Reviews.new.base_url!("http://primo.library.edu").
  institution!("PRIMO").ip!("127.0.0.1")
  #=> #<Exlibris::Primo::Reviews @base_url="http://primo.library.edu", 
        @institution="PRIMO", @request_attributes={:base_url => "http://primo.library.edu", 
          :institution => "PRIMO", :ip => "127.0.0.1"}>

tags = Tags.new.base_url!("http://primo.library.edu").
  institution!("PRIMO").ip!("127.0.0.1")
  #=> #<Exlibris::Primo::Tags @base_url="http://primo.library.edu", 
        @institution="PRIMO", @request_attributes={:base_url => "http://primo.library.edu", 
          :institution => "PRIMO", :ip => "127.0.0.1"}>

Instance Method Summary collapse

Instance Method Details

#base_url!(base_url) ⇒ Object Also known as: base_url=

Set base URL for the Primo request.


40
41
42
43
44
# File 'lib/exlibris/primo/chain_gang/base.rb', line 40

def base_url!(base_url)
  @base_url = base_url
  request_attributes[:base_url] = "#{base_url}"
  self
end

#group!(group) ⇒ Object Also known as: group=

Set the group for the Primo request.


71
72
73
74
# File 'lib/exlibris/primo/chain_gang/base.rb', line 71

def group!(group)
  request_attributes[:group] = "#{group}"
  self
end

#institution!(institution) ⇒ Object Also known as: institution=

Set institution for the Primo request.


50
51
52
53
54
# File 'lib/exlibris/primo/chain_gang/base.rb', line 50

def institution!(institution)
  @institution = institution
  request_attributes[:institution] = "#{institution}"
  self
end

#ip!(ip) ⇒ Object Also known as: ip=, client_ip!, client_ip=

Set client IP for the Primo request.


60
61
62
63
# File 'lib/exlibris/primo/chain_gang/base.rb', line 60

def ip!(ip)
  request_attributes[:ip] = "#{ip}"
  self
end

#logged_inObject

Specifies that the Primo request user is logged in.


105
106
107
108
# File 'lib/exlibris/primo/chain_gang/base.rb', line 105

def logged_in
  request_attributes[:is_logged_in] = "true"
  self
end

#logged_outObject Also known as: logged_off

Specifies that the Primo request user is logged out.


113
114
115
116
# File 'lib/exlibris/primo/chain_gang/base.rb', line 113

def logged_out
  request_attributes[:is_logged_in] = "false"
  self
end

#off_campusObject

Specifies that the Primo request is coming from off campus.


97
98
99
100
# File 'lib/exlibris/primo/chain_gang/base.rb', line 97

def off_campus
  request_attributes[:on_campus] = "false"
  self
end

#on_campusObject

Specifies that the Primo request is coming from on campus.


89
90
91
92
# File 'lib/exlibris/primo/chain_gang/base.rb', line 89

def on_campus
  request_attributes[:on_campus] = "true"
  self
end

#pds_handle!(pds_handle) ⇒ Object Also known as: pds_handle=

Set the PDS handle for the Primo request.


80
81
82
83
# File 'lib/exlibris/primo/chain_gang/base.rb', line 80

def pds_handle!(pds_handle)
  request_attributes[:pds_handle] = "#{pds_handle}"
  self
end