class Exlibris::Primo::Tags

Manipulate a Primo tags using Exlibris::Primo::Tags

tags = Tags.new.base_url!("http://primo.library.edu").institution!("PRIMO").
  user_id!("USER_ID").record_id!("aleph0123456789")
tag.my_tags #=> Array of Primo tags

Attributes

record_id[R]
user_id[R]

Public Class Methods

new(*args) click to toggle source
Calls superclass method Exlibris::Primo::WriteAttributes::new
# File lib/exlibris/primo/tags.rb, line 20
def initialize *args
  super
end

Public Instance Methods

add_tag(tag) click to toggle source

Call web service to add a tag to Primo for the specified record

# File lib/exlibris/primo/tags.rb, line 58
def add_tag(tag)
  Exlibris::Primo::WebService::Request::AddTag.new(user_record_request_attributes.merge :value => tag).call
  reset_tags
end
add_tags(tags) click to toggle source

Call web service to add tags to Primo for the specified record

# File lib/exlibris/primo/tags.rb, line 49
def add_tags(tags)
  tags.each do |tag|
    add_tag tag
  end
end
record_tags() click to toggle source

Get all tags for the specified user

# File lib/exlibris/primo/tags.rb, line 34
def record_tags
  @record_tags ||= get_tags.everybody_tags
end
remove_tag(tag) click to toggle source

Call web service to remove tag from Primo for the specified record

# File lib/exlibris/primo/tags.rb, line 75
def remove_tag(tag)
  Exlibris::Primo::WebService::Request::RemoveTag.new(user_record_request_attributes.merge :value => tag).call
  reset_tags
end
remove_tags(tags) click to toggle source

Call web service to remove tags from Primo for the specified record

# File lib/exlibris/primo/tags.rb, line 66
def remove_tags(tags)
  tags.each do |tag|
    remove_tag tag
  end
end
remove_user_tags() click to toggle source

Remove all users tags

# File lib/exlibris/primo/tags.rb, line 83
def remove_user_tags
  Exlibris::Primo::WebService::Request::RemoveUserTags.new(user_request_attributes).call
  reset_tags
end
tags() click to toggle source

Get tags for the specified user and record

# File lib/exlibris/primo/tags.rb, line 27
def tags
  @tags ||= get_tags.my_tags
end
user_tags() click to toggle source

Get all tags for the specified user

# File lib/exlibris/primo/tags.rb, line 41
def user_tags
  @user_tags ||= 
    Exlibris::Primo::WebService::Request::GetAllMyTags.new(user_request_attributes).call.my_tags
end

Private Instance Methods

get_tags() click to toggle source
# File lib/exlibris/primo/tags.rb, line 88
def get_tags
  @get_tags ||= 
    Exlibris::Primo::WebService::Request::GetTags.new(user_record_request_attributes).call
end
reset_tags() click to toggle source
# File lib/exlibris/primo/tags.rb, line 94
def reset_tags
  @tags = nil
  @record_tags = nil
  @user_tags = nil
  @get_tags = nil
end