source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | lantins/resque-exceptional | https://github.com/lantins/resque-exceptional | test/exceptional_test.rb | Ruby | mit | 18 | master | 10,467 | require 'test_helper'
# Tests the failure backend works with resque, does not contact the api.
class ExceptionalTest < Minitest::Test
def setup
@exception = TestApp.grab_exception
@worker = FakeWorker.new
@queue = 'test_queue'
@payload = { 'class' => 'TestJob', 'args' => ['foo', 'bar'] }
@failure... |
github | lantins/resque-exceptional | https://github.com/lantins/resque-exceptional | lib/resque/failure/exceptional.rb | Ruby | mit | 18 | master | 6,065 | module Resque
module Failure
# A Resque failure backend that sends exception data to getexceptional.com
class Exceptional < Base
Version = '0.2.2' # Failure backend version number.
# Raised if the api_key is not set.
class APIKeyError < StandardError
end
class << self
a... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | Gemfile | Ruby | mit | 18 | master | 529 | source "http://rubygems.org"
# Declare your gem's dependencies in exlibris-primo.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec
gem 'jruby-openssl', "~> 0.9.0", platform: :jruby
group :test do
gem... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | exlibris-primo.gemspec | Ruby | mit | 18 | master | 1,277 | $:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "exlibris/primo/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "exlibris-primo"
s.version = Exlibris::Primo::VERSION
s.authors = ["Scot Dalton"]
s.email =... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | Rakefile | Ruby | mit | 18 | master | 421 | #!/usr/bin/env rake
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
Bundler::GemHelper.install_tasks
require 'rake/testtask'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.test_files = FileList['test/*_test.r... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/eshelf.rb | Ruby | mit | 18 | master | 3,588 | module Exlibris
module Primo
#
# Manipulate a user's Primo eshelf using Exlibris::Primo::Eshelf
#
# eshelf = Eshelf.new.base_url!("http://primo.library.edu").institution!("PRIMO").user_id!("USER_ID")
# eshelf.records #=> Array for Primo records
#
class EShelf
include Config::... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/reviews.rb | Ruby | mit | 18 | master | 2,526 | module Exlibris
module Primo
#
# Manipulate a Primo reviews using Exlibris::Primo::Reviews
#
# reviews = Reviews.new.base_url!("http://primo.library.edu").institution!("PRIMO").
# user_id!("USER_ID").record_id!("aleph0123456789")
# reviews.reviews #=> Array of Primo reviews
... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/tag.rb | Ruby | mit | 18 | master | 650 | module Exlibris
module Primo
#
# Primo Tag
#
class Tag
include Config::Attributes
include Namespaces
include WriteAttributes
include XmlUtil
def initialize *args
@raw_xml = args.last.delete(:raw_xml)
super
end
def user_id
@user_id = x... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/tags.rb | Ruby | mit | 18 | master | 2,528 | module Exlibris
module Primo
#
# 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
#
class Tags
... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/request_attributes.rb | Ruby | mit | 18 | master | 844 | module Exlibris
module Primo
#
# Common request attributes based on attr_readers.
#
module RequestAttributes
def request_attributes
@request_attributes ||= {:base_url => base_url, :institution => institution}
end
protected :request_attributes
def user_request_attribu... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/config.rb | Ruby | mit | 18 | master | 1,971 | require 'erb'
module Exlibris
module Primo
#
# Specify global configuration settings for
#
module Config
class << self
include WriteAttributes
attr_accessor :base_url, :institution, :institutions, :libraries, :availability_statuses, :sources,
:facet_labels, :facet_top_l... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/write_attributes.rb | Ruby | mit | 18 | master | 1,019 | module Exlibris
module Primo
#
# Write passed in arguments to instance attributes
#
module WriteAttributes
def initialize *args
# Just call super w/o any args for now. Eventually, we'll want to check the arity and adjust.
# self.class.superclass.instance_method(:initialize).a... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/abstract.rb | Ruby | mit | 18 | master | 608 | module Exlibris
module Primo
#
# If a class is abstract, it can't be instantiated.
#
module Abstract
def self.included(klass)
klass.class_eval do
extend ClassAttributes
end
end
module ClassAttributes
def abstract
@abstract ||= false
... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/holding.rb | Ruby | mit | 18 | master | 4,429 | module Exlibris
module Primo
#
# Primo Holding.
#
# Object representing a holding in Primo.
#
# Primo holdings can be extended to create Primo source holdings.
# create a local class representing the source in the
# module Exlibris::Primo::Source which extends Exlibris::Primo::Holdin... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/namespaces.rb | Ruby | mit | 18 | master | 1,279 | module Exlibris
module Primo
#
# Primo namespaces used in Primo XML
#
module Namespaces
def self.included(klass)
klass.class_eval do
extend ClassAttributes
end
end
module ClassAttributes
def response_namespaces
@response_namespaces = {
... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/search.rb | Ruby | mit | 18 | master | 2,328 | module Exlibris
module Primo
#
# Search Primo using Exlibris::Primo::Search
#
# search = Search.new.base_url!("http://primo.library.edu").
# add_query_term("Digital divide", "any", "contains")
# search.records #=> Array of Primo records
# search.facets #=> Array of Primo ... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/facet_value.rb | Ruby | mit | 18 | master | 1,178 | module Exlibris
module Primo
require 'iso-639'
#
# Primo facet value that holds the name of the value
# and the number of records that limiting by this facet
# value would return.
#
class FacetValue
include Config::Attributes
include WriteAttributes
include XmlUtil
... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/link.rb | Ruby | mit | 18 | master | 805 | module Exlibris
module Primo
#
# Abstract class representing a link in Primo.
#
class Link
include Abstract
include Config::Attributes
include WriteAttributes
self.abstract = true
attr_accessor :institution, :record_id, :original_id,
:url, :display, :notes, :sub... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/xml_util.rb | Ruby | mit | 18 | master | 1,816 | module Exlibris
module Primo
#
# Utility for parsing and building XML
#
module XmlUtil
require 'nokogiri'
def self.included(klass)
klass.class_eval do
extend ClassAttributes
end
end
module ClassAttributes
def xml_options
@xml_option... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/review.rb | Ruby | mit | 18 | master | 988 | module Exlibris
module Primo
#
# Primo Review
#
class Review
include Config::Attributes
include Namespaces
include WriteAttributes
include XmlUtil
def initialize *args
@raw_xml = args.last.delete(:raw_xml)
super
end
def user_id
@user_... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/facet.rb | Ruby | mit | 18 | master | 858 | module Exlibris
module Primo
#
# Primo facet holds the name of the facet
# and size (often approximate).
#
class Facet
include Config::Attributes
include WriteAttributes
include XmlUtil
attr_accessor :accurate
alias accurate? accurate
def initialize *args
... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/record.rb | Ruby | mit | 18 | master | 1,064 | module Exlibris
module Primo
#
# Primo record
# Includes PNX elements such as
# holdings, links, openurl, frbr status
# dedupmgr status.
#
class Record
include Config::Attributes
include Namespaces
include WriteAttributes
include XmlUtil
include Exlibris::Prim... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/client/base.rb | Ruby | mit | 18 | master | 676 | module Exlibris
module Primo
module WebService
module Client
class Base
include Abstract
include Config::Attributes
include Endpoint
include SavonClient
include SoapActions
include Wsdl
self.abstract = true
attr_writer... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/client/eshelf.rb | Ruby | mit | 18 | master | 455 | module Exlibris
module Primo
module WebService
module Client
#
#
#
class Eshelf < Base
self.add_soap_actions :get_eshelf, :add_to_eshelf, :remove_from_eshelf,
:add_folder_to_eshelf, :remove_folder_from_eshelf
end
#
#
... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/client/tags.rb | Ruby | mit | 18 | master | 295 | module Exlibris
module Primo
module WebService
module Client
#
#
#
class Tags < Base
self.add_soap_actions :get_tags, :get_all_my_tags, :get_tags_for_record, :add_tag, :remove_tag, :remove_user_tags
end
end
end
end
end |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/client/reviews.rb | Ruby | mit | 18 | master | 331 | module Exlibris
module Primo
module WebService
module Client
#
#
#
class Reviews < Base
self.add_soap_actions :get_reviews, :get_all_my_reviews, :get_reviews_for_record,
:get_reviews_by_rating, :add_review, :remove_review
end
end
en... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/client/search.rb | Ruby | mit | 18 | master | 268 | module Exlibris
module Primo
module WebService
module Client
#
#
#
class Search < Base
self.endpoint = :searcher
self.add_soap_actions :search_brief, :get_record
end
end
end
end
end |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/client/base/endpoint.rb | Ruby | mit | 18 | master | 637 | module Exlibris
module Primo
module WebService
module Client
module Endpoint
def self.included(klass)
klass.class_eval do
extend ClassAttributes
end
end
module ClassAttributes
def endpoint
@endpoint ||= na... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/client/base/wsdl.rb | Ruby | mit | 18 | master | 232 | module Exlibris
module Primo
module WebService
module Client
module Wsdl
def wsdl
@wsdl ||= "#{endpoint}?wsdl"
end
protected :wsdl
end
end
end
end
end |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/client/base/soap_actions.rb | Ruby | mit | 18 | master | 1,552 | module Exlibris
module Primo
module WebService
module Client
module SoapActions
def self.included(klass)
klass.class_eval do
extend ClassAttributes
end
end
module ClassAttributes
def soap_actions
@soap_act... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/client/base/savon_client.rb | Ruby | mit | 18 | master | 530 | module Exlibris
module Primo
module WebService
module Client
module SavonClient
require 'savon'
def client
#
# We're not using WSDL at the moment, since
# we don't want to make an extra HTTP call.
#
# @client ||= Savo... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/response/search.rb | Ruby | mit | 18 | master | 699 | module Exlibris
module Primo
module WebService
module Response
#
#
#
class Search < Base
include DidUMean
include Facets
include Records
include SearchStats
end
#
#
#
class FullView < Search
... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/response/eshelf.rb | Ruby | mit | 18 | master | 1,350 | module Exlibris
module Primo
module WebService
module Response
#
#
#
class Eshelf < Base
self.abstract = true
end
#
#
#
class GetEshelfStructure < Eshelf
def basket_id
@basket_id ||= basket_folder["folde... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/response/facets.rb | Ruby | mit | 18 | master | 620 | module Exlibris
module Primo
module WebService
module Response
module Facets
def facets
@facets ||= (facet_list) ? facet_list.xpath("//search:FACET", response_namespaces).collect { |facet|
accurate = (facet.parent["ACCURATE_COUNTERS"].eql? "true")
Ex... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/response/search_stats.rb | Ruby | mit | 18 | master | 1,225 | module Exlibris
module Primo
module WebService
module Response
module SearchStats
def total_time
@total_time ||= search_set["TOTAL_TIME"] if search_set
end
alias :time :total_time
def hit_time
@hit_time ||= search_set["HIT_TIME"] if se... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/response/reviews.rb | Ruby | mit | 18 | master | 904 | module Exlibris
module Primo
module WebService
module Response
#
#
#
class Reviews < Base
self.abstract = true
end
#
#
#
class GetReviews < Reviews
def reviews
@reviews ||= xml.root.xpath("//tags_r... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/response/did_u_mean.rb | Ruby | mit | 18 | master | 431 | module Exlibris
module Primo
module WebService
module Response
module DidUMean
def did_u_mean
@did_u_mean ||= querytransform["QUERY"].strip unless querytransform.nil?
end
def querytransform
@querytransform ||= xml.at_xpath("//search:QU... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/response/tags.rb | Ruby | mit | 18 | master | 1,113 | module Exlibris
module Primo
module WebService
module Response
#
#
#
class Tags < Base
self.abstract = true
end
#
#
#
class GetTags < Tags
def my_tags
@my_tags ||= xml.root.xpath("//tags_reviews:My... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/response/records.rb | Ruby | mit | 18 | master | 372 | module Exlibris
module Primo
module WebService
module Response
module Records
def records
@records ||= xml.xpath("//pnx:record", response_namespaces).collect { |record|
Exlibris::Primo::Record.new(:raw_xml => record.to_xml, :namespaces => record.namespaces) }
... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/response/base.rb | Ruby | mit | 18 | master | 741 | module Exlibris
module Primo
module WebService
module Response
class Base
include Abstract
include Error
include Namespaces
include Util
include XmlUtil
self.abstract = true
attr_reader :savon_response, :soap_action, :code, :body... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/response/base/util.rb | Ruby | mit | 18 | master | 381 | module Exlibris
module Primo
module WebService
module Response
module Util
def response_key
"#{soap_action}_response".to_sym
end
protected :response_key
def return_key
"#{soap_action}_return".to_sym
end
pr... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/response/base/error.rb | Ruby | mit | 18 | master | 521 | module Exlibris
module Primo
module WebService
module Response
module Error
def error?
(error_code && (not error_code.eql? "0"))
end
def error
@error ||= xml_without_namespaces.root.at_xpath("//ERROR")
end
def error_code
... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/request/reviews.rb | Ruby | mit | 18 | master | 1,450 | module Exlibris
module Primo
module WebService
module Request
#
# Abstract class for reviews interaction
#
class Reviews < UserRecord
self.abstract = true
self.has_client
end
#
# Get reviews from from Primo for a specifi... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/request/eshelf.rb | Ruby | mit | 18 | master | 1,811 | module Exlibris
module Primo
module WebService
module Request
#
# Abstract class for eshelf interaction
#
class Eshelf < UserBase
self.add_base_elements :folder_id
self.abstract = true
self.has_client
end
#
# Abstract ... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/request/tags.rb | Ruby | mit | 18 | master | 1,260 | module Exlibris
module Primo
module WebService
module Request
#
# Abstract class for tags interaction
#
class Tags < UserRecord
self.abstract = true
self.has_client
end
#
# Get tags from from Primo for a specified user
#... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/request/base.rb | Ruby | mit | 18 | master | 2,098 | module Exlibris
module Primo
module WebService
module Request
#
# Abstract base class for Primo interactions
#
class Base
include Abstract
include BaseElements
include Client
include Call
include Config::Attributes
... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/request/search.rb | Ruby | mit | 18 | master | 1,369 | module Exlibris
module Primo
module WebService
module Request
#
# Search Primo
#
class Search < Base
self.has_client
self.soap_action = :search_brief
include DisplayFields
include Languages
include Locations
includ... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/request/base/call.rb | Ruby | mit | 18 | master | 566 | module Exlibris
module Primo
module WebService
module Request
module Call
#
# Returns an response Exlibris::Primo::WebService::Response that corresponds
# to the request.
#
def call
# Get the Response class that matches the Request clas... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/request/base/soap_action.rb | Ruby | mit | 18 | master | 630 | module Exlibris
module Primo
module WebService
module Request
module SoapAction
def self.included(klass)
klass.class_eval do
extend ClassAttributes
end
end
module ClassAttributes
def soap_action
@soap_acti... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/request/base/base_elements.rb | Ruby | mit | 18 | master | 2,042 | module Exlibris
module Primo
module WebService
module Request
module BaseElements
def self.included(klass)
klass.class_eval do
extend ClassAttributes
end
end
module ClassAttributes
def base_elements
@base_... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/request/base/client.rb | Ruby | mit | 18 | master | 1,179 | module Exlibris
module Primo
module WebService
module Request
module Client
def self.included(klass)
klass.class_eval do
extend ClassAttributes
end
end
module ClassAttributes
def client
@client ||= (has_cl... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/request/search/query_term.rb | Ruby | mit | 18 | master | 1,096 | module Exlibris
module Primo
module WebService
module Request
#
#
#
class QueryTerm
include WriteAttributes
include XmlUtil
attr_accessor :index, :precision, :value
attr_writer :include_values, :exclude_values
de... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/request/search/sort_bys.rb | Ruby | mit | 18 | master | 724 | module Exlibris
module Primo
module WebService
module Request
module SortBys
#
# Returns a lambda that takes a Nokogiri::XML::Builder as an argument
# and appends sort bys XML to it.
#
def sort_bys_xml
lambda { |xml|
xml.S... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/request/search/languages.rb | Ruby | mit | 18 | master | 737 | module Exlibris
module Primo
module WebService
module Request
module Languages
#
# Returns a lambda that takes a Nokogiri::XML::Builder as an argument
# and appends languages XML to it.
#
def languages_xml
lambda { |xml|
x... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/request/search/location.rb | Ruby | mit | 18 | master | 241 | module Exlibris
module Primo
module WebService
module Request
#
#
#
class Location
include WriteAttributes
attr_accessor :kind, :value
end
end
end
end
end |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/request/search/search_elements.rb | Ruby | mit | 18 | master | 3,090 | module Exlibris
module Primo
module WebService
module Request
module SearchElements
def self.included(klass)
klass.class_eval do
extend ClassAttributes
end
end
module ClassAttributes
def search_elements
@s... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/request/search/query_terms.rb | Ruby | mit | 18 | master | 1,057 | module Exlibris
module Primo
module WebService
module Request
module QueryTerms
attr_writer :boolean_operator
def boolean_operator
@boolean_operator ||= "AND"
end
#
# Returns a lambda that takes a Nokogiri::XML::Builder as an... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/request/search/locations.rb | Ruby | mit | 18 | master | 892 | module Exlibris
module Primo
module WebService
module Request
module Locations
#
# Returns a lambda that takes a Nokogiri::XML::Builder as an argument
# and appends locations XML to it.
#
def locations_xml
lambda { |xml|
#... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/web_service/request/search/display_fields.rb | Ruby | mit | 18 | master | 730 | module Exlibris
module Primo
module WebService
module Request
module DisplayFields
#
# Returns a lambda that takes a Nokogiri::XML::Builder as an argument
# and appends display fields XML to it.
#
def display_fields_xml
lambda { |xml|
... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/pnx/links.rb | Ruby | mit | 18 | master | 1,639 | module Exlibris
module Primo
module Pnx
#
# Handle links in links tags.
#
module Links
#
# Parse linktorsrc tags to find full text links
#
def fulltexts
@fulltexts ||=
links("linktorsrc").collect { |link_attributes|
Exlibr... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/pnx/subfields.rb | Ruby | mit | 18 | master | 364 | module Exlibris
module Primo
module Pnx
#
# Handle PNX subfields
#
module Subfields
#
# Return a Hash of subfields as keys with their corresponding values
#
def parse_subfields s
Hash[s.scan(/\${2}([^\$])([^\$]+)/)]
end
protected ... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/pnx/dedup_mgr.rb | Ruby | mit | 18 | master | 3,234 | module Exlibris
module Primo
module Pnx
#
# Handle PNX dedupmgr elements
#
module DedupMgr
def self.included(klass)
klass.class_eval do
extend ClassAttributes
end
end
module ClassAttributes
def duplicated_control_attribute... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/pnx/elements.rb | Ruby | mit | 18 | master | 2,126 | module Exlibris
module Primo
module Pnx
#
# Provides access to PNX elements
#
module Elements
#
# Parses elements from PNX base on the pattern
# parentname_childname e.g.
# record.display_title #=> "Travels with my aunt"
# based on the XML
... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/pnx/holdings.rb | Ruby | mit | 18 | master | 1,639 | module Exlibris
module Primo
module Pnx
#
# Handle holdings in availlibrary tags.
#
module Holdings
#
# Gather Holdings for this record.
#
def holdings
@holdings ||= xml.root.xpath("display/availlibrary").collect do |availlibrary|
su... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/pnx/frbr.rb | Ruby | mit | 18 | master | 556 | module Exlibris
module Primo
module Pnx
#
# Handle frbr records
#
module Frbr
#
# Is this a frbr'd record
#
def frbr?
if (respond_to? :facets_frbrgroupid) && (facets_frbrtype != "6")
@frbr = true
else
@frbr = false... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/pnx/openurl.rb | Ruby | mit | 18 | master | 599 | module Exlibris
module Primo
module Pnx
#
# Handle OpenURL elements
#
module Openurl
#
# Parse addata to provide an OpenURL query string
#
def openurl
@openurl ||= ""
if @openurl.blank?
xml.root.xpath("addata/*").each do |ad... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/chain_gang/record.rb | Ruby | mit | 18 | master | 313 | module Exlibris
module Primo
module ChainGang
module Record
attr_reader :record_id
#
# Set the record_id
#
def record_id!(record_id)
@record_id = record_id
self
end
alias :record_id= :record_id!
end
end
end
end |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/chain_gang/user.rb | Ruby | mit | 18 | master | 295 | module Exlibris
module Primo
module ChainGang
module User
attr_reader :user_id
#
# Set the user id
#
def user_id!(user_id)
@user_id = user_id
self
end
alias :user_id= :user_id!
end
end
end
end |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/chain_gang/base.rb | Ruby | mit | 18 | master | 3,892 | module Exlibris
module Primo
module ChainGang
# = 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://... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/chain_gang/search.rb | Ruby | mit | 18 | master | 9,583 | module Exlibris
module Primo
module ChainGang
# = Primo ChainGang Search
# These search attributes are included in
# Exlibris::Primo::Search and allow for chaining methods together.
#
# == Examples
#
# Search.new.title("Travels", "title", "contains").
# ... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | lib/exlibris/primo/source/aleph.rb | Ruby | mit | 18 | master | 3,235 | module Exlibris
module Primo
module Source
# == Overview
# Exlibris::Primo::Source::Aleph is an Exlibris::Primo::Holding that provides a link to Aleph
# and a request link based on config settings in the Primo config file.
#
# == Example Config
# source_id:
# base_... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/eshelf_test.rb | Ruby | mit | 18 | master | 2,261 | require 'test_helper'
class EshelfTest < Test::Unit::TestCase
def setup
@base_url = "http://bobcatdev.library.nyu.edu"
@isbn = "0143039008"
@user_id = "N12162279"
@institution = "NYU"
@eshelf_records = ["nyu_aleph000980206", "nyu_aleph000864162", "dedupmrg35761381"]
@eshelf_record = "nyu_aleph... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/config_test.rb | Ruby | mit | 18 | master | 4,171 | require 'test_helper'
class ConfigTest < Test::Unit::TestCase
def test_config
reset_primo_configuration
Exlibris::Primo.configure do |config|
config.base_url = "test_url"
config.institution = "TEST_INSTITUTION"
config.libraries = { "LIB_CODE1" => "Manually Library Decoded 1", "LIB_CODE2" => ... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/search_test.rb | Ruby | mit | 18 | master | 13,042 | require 'test_helper'
class SearchTest < Test::Unit::TestCase
def setup
@base_url = "http://bobcatdev.library.nyu.edu"
@isbn = "0143039008"
@user_id = "N12162279"
@institution = "NYU"
@record_id = "nyu_aleph000062856"
@title = "Travels with My Aunt"
@author = "Graham Greene"
@title_sta... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/test_helper.rb | Ruby | mit | 18 | master | 32,682 | require 'coveralls'
Coveralls.wear!
require 'test/unit'
require File.expand_path("../../lib/exlibris-primo.rb", __FILE__)
# VCR is used to 'record' HTTP interactions with
# third party services used in tests, and play em
# back. Useful for efficiency, also useful for
# testing code against API's that not everyone
# h... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/xml_util_test.rb | Ruby | mit | 18 | master | 2,151 | require 'test_helper'
class XmlUtilTest < Test::Unit::TestCase
def test_to_xml
assert_nothing_raised {
record = Exlibris::Primo::Record.new(:raw_xml => "<record><control><recordid>123456</recordid></control></record>\n")
assert_equal "<record><control><recordid>123456</recordid></control></record>", r... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/tags_test.rb | Ruby | mit | 18 | master | 1,879 | require 'test_helper'
class TagsTest < Test::Unit::TestCase
def setup
@base_url = "http://bobcatdev.library.nyu.edu"
@user_id = "N12162279"
@institution = "NYU"
@record_id = "nyu_aleph000062856"
@tags = ["tag1", "tag2", "tag 3"]
@tag = "tag4"
@extra_tag = "tag 5"
end
def test_tags
... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/review_test.rb | Ruby | mit | 18 | master | 676 | require 'test_helper'
class ReviewTest < Test::Unit::TestCase
def test_new_review
assert_nothing_raised {
review = Exlibris::Primo::Review.new(:raw_xml => "<Review><value>Testreview</value><docId>nyu_aleph000062856</docId><userId/><status>2</status><rating>1</rating><userDisplayName/><allowUserName>false</a... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/link_test.rb | Ruby | mit | 18 | master | 2,305 | require 'test_helper'
class LinkTest < Test::Unit::TestCase
def setup
@institution = "INSTITUTION"
@record_id = "aleph002895625"
@url = "http://example.com"
end
def test_new_base
assert_raise(NotImplementedError) {
Exlibris::Primo::Link.new
}
end
def test_new_fulltext
assert_no... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/reviews_test.rb | Ruby | mit | 18 | master | 1,670 | require 'test_helper'
class ReviewsTest < Test::Unit::TestCase
def setup
@base_url = "http://bobcatdev.library.nyu.edu"
@user_id = "N12162279"
@institution = "NYU"
@record_id = "nyu_aleph000062856"
end
def test_reviews
reviews = Exlibris::Primo::Reviews.
new(:base_url => @base_url, :ins... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/record_test.rb | Ruby | mit | 18 | master | 338 | require 'test_helper'
class RecordTest < Test::Unit::TestCase
def test_new_record
assert_nothing_raised {
record = Exlibris::Primo::Record.new(:raw_xml => record_xml)
assert_equal "nyu_aleph000062856", record.recordid
assert((not record.holdings.empty?))
assert_equal(1, record.holdings.siz... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/tag_test.rb | Ruby | mit | 18 | master | 418 | require 'test_helper'
class TagTest < Test::Unit::TestCase
def test_new_tag
assert_nothing_raised {
tag = Exlibris::Primo::Tag.new(:raw_xml => "<Tag><value>spies</value><docId>nyu_aleph000062856</docId><userId/><status/></Tag>")
assert_equal "", tag.user_id
assert_equal "nyu_aleph000062856", tag... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/facet_test.rb | Ruby | mit | 18 | master | 1,022 | require 'test_helper'
class FacetTest < Test::Unit::TestCase
def test_new
facet = Exlibris::Primo::Facet.new(:raw_xml => "<FACET NAME=\"creator\" COUNT=\"3\">"+
"<FACET_VALUES KEY=\"Author1, FirstName\" VALUE=\"3\"/>"+
"<FACET_VALUES KEY=\"Author2, FirstName\" VALUE=\"1\"/>"+
"</FACET>")
ass... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/holding_test.rb | Ruby | mit | 18 | master | 1,026 | require 'test_helper'
class HoldingTest < Test::Unit::TestCase
def setup
@record_id = "aleph002895625"
end
def test_new_holding
holding = Exlibris::Primo::Holding.new :record_id => @record_id,
:original_id => @record_id, :title => "Holding Title", :author => "Holding Author",
:display_type =... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/facet_value_test.rb | Ruby | mit | 18 | master | 2,830 | require 'test_helper'
class FacetValueTest < Test::Unit::TestCase
def test_new
facet = Exlibris::Primo::Facet.new(:raw_xml => "<FACET NAME=\"creator\" COUNT=\"3\" />")
facet_value = Exlibris::Primo::FacetValue.new(:raw_xml => "<FACET_VALUES KEY=\"Greene, G\" VALUE=\"1\"/>", :facet => facet)
assert_equal "... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/search_primo_central_test.rb | Ruby | mit | 18 | master | 1,813 | require 'test_helper'
class SearchPrimoCentralTest < Test::Unit::TestCase
def setup
@base_url = "http://primo-fe1.library.nd.edu:1701"
@institution = "NDU"
@search_term = "van gogh"
@mla_doc_id = "mla2012444463"
end
def test_primo_central
VCR.use_cassette('search primo central') do
sear... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/source/aleph_test.rb | Ruby | mit | 18 | master | 2,505 | module Source
require 'test_helper'
class AlephTest < Test::Unit::TestCase
def setup
@record_id = "aleph002895625"
@source_id = "aleph"
@original_source_id = "USM01"
@source_record_id = "002895625"
@ils_api_id = "USM01002895625"
@library_code = "LIB_CODE2"
@collection =... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/web_service/request/soap_action_test.rb | Ruby | mit | 18 | master | 5,542 | module WebService
module Request
require 'test_helper'
class ActionTest < Test::Unit::TestCase
def setup
@base_url = "http://bobcatdev.library.nyu.edu"
@isbn = "0143039008"
@user_id = "N12162279"
@institution = "NYU"
@doc_id = "nyu_aleph000062856"
@dedupmg... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/web_service/request/tags_test.rb | Ruby | mit | 18 | master | 830 | module WebService
module Request
require 'test_helper'
class TagsTest < Test::Unit::TestCase
def setup
@base_url = "http://bobcatdev.library.nyu.edu"
@institution = "NYU"
@user_id = "N12162279"
@doc_id = "nyu_aleph000062856"
end
def test_get_tags
requ... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/web_service/request/reviews_test.rb | Ruby | mit | 18 | master | 845 | module WebService
module Request
require 'test_helper'
class ReviewsTest < Test::Unit::TestCase
def setup
@base_url = "http://bobcatdev.library.nyu.edu"
@institution = "NYU"
@user_id = "N12162279"
@doc_id = "nyu_aleph000062856"
end
def test_get_reviews
... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/web_service/request/client_test.rb | Ruby | mit | 18 | master | 2,483 | module WebService
module Request
require 'test_helper'
class ClientTest < Test::Unit::TestCase
def setup
@base_url = "http://bobcatdev.library.nyu.edu"
@institution = "University"
@ip = "127.0.0.1"
@group = "Department"
@on_campus = "true"
@is_logged_in = ... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/web_service/request/abstract_test.rb | Ruby | mit | 18 | master | 2,757 | module WebService
module Request
require 'test_helper'
class AbstractTest < Test::Unit::TestCase
def setup
@base_url = "http://bobcatdev.library.nyu.edu"
@user_id = "N12162279"
@institution = "NYU"
@doc_id = "nyu_aleph000062856"
@dedupmgr_id = "dedupmrg17343091"
... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/web_service/request/search_test.rb | Ruby | mit | 18 | master | 10,458 | module WebService
module Request
require 'test_helper'
class SearchTest < Test::Unit::TestCase
def setup
@base_url = "http://bobcatdev.library.nyu.edu"
@institution = "NYU"
@isbn = "0143039008"
@issn = "0090-5720"
@title = "Travels with My Aunt"
@author = ... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/web_service/request/eshelf_test.rb | Ruby | mit | 18 | master | 762 | module WebService
module Request
require 'test_helper'
class EshelfTest < Test::Unit::TestCase
def setup
@base_url = "http://bobcatdev.library.nyu.edu"
@institution = "NYU"
@user_id = "N12162279"
@doc_id = "nyu_aleph000062856"
end
def test_get_eshelf
... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/web_service/request/query_term_test.rb | Ruby | mit | 18 | master | 1,058 | module WebService
module Request
require 'test_helper'
class QueryTermTest < Test::Unit::TestCase
def setup
@isbn = "0143039008"
@issn = "0090-5720"
@title = "Travels with My Aunt"
@author = "Graham Greene"
@genre = "Book"
end
def test_set_attributes
... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/web_service/request/build_xml_test.rb | Ruby | mit | 18 | master | 671 | module WebService
module Request
require 'test_helper'
class BuildXmlTest < Test::Unit::TestCase
def setup
@base_url = "http://bobcatdev.library.nyu.edu"
@institution = "University"
@group = "Department"
end
def test_request_build_xml
search_request = Exl... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/web_service/request/location_test.rb | Ruby | mit | 18 | master | 729 | module WebService
module Request
require 'test_helper'
class LocationTest < Test::Unit::TestCase
def setup
@kind = "local"
@value = "scope:(VOLCANO)"
end
def test_set_attributes
location = Exlibris::Primo::WebService::Request::Location.new()
location.kind = @... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/web_service/request/base_elements_test.rb | Ruby | mit | 18 | master | 11,550 | module WebService
module Request
require 'test_helper'
class BaseElementsTest < Test::Unit::TestCase
def setup
@base_url = "http://bobcatdev.library.nyu.edu"
@institution = "University"
@ip = "127.0.0.1"
@group = "Department"
@on_campus = "true"
@is_logged... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/web_service/response/records_test.rb | Ruby | mit | 18 | master | 2,261 | module WebService
module Response
require 'test_helper'
class RecordsTest < Test::Unit::TestCase
def setup
@base_url = "http://bobcatdev.library.nyu.edu"
@isbn = "0143039008"
@user_id = "N12162279"
@institution = "NYU"
@doc_id = "nyu_aleph000062856"
@dedup... |
github | scotdalton/exlibris-primo | https://github.com/scotdalton/exlibris-primo | test/web_service/response/search_test.rb | Ruby | mit | 18 | master | 1,513 | module WebService
module Response
require 'test_helper'
class SearchTest < Test::Unit::TestCase
def setup
@base_url = "http://bobcatdev.library.nyu.edu"
@isbn = "0143039008"
@user_id = "N12162279"
@institution = "NYU"
@doc_id = "nyu_aleph000062856"
@dedupm... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.