summon 1.1.14 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/.gitignore +7 -0
  2. data/{History.txt → Changelog.md} +53 -20
  3. data/Gemfile +3 -0
  4. data/Gemfile.lock +28 -0
  5. data/{README.rdoc → README.md} +21 -21
  6. data/Rakefile +5 -22
  7. data/lib/summon.rb +2 -8
  8. data/lib/summon/cli.rb +2 -0
  9. data/lib/summon/schema.rb +0 -9
  10. data/lib/summon/schema/document.rb +15 -15
  11. data/lib/summon/schema/facet.rb +0 -11
  12. data/lib/summon/schema/range.rb +1 -5
  13. data/lib/summon/service.rb +1 -2
  14. data/lib/summon/version.rb +4 -0
  15. data/spec/spec_helper.rb +2 -2
  16. data/spec/summon/schema/document_spec.rb +1 -0
  17. data/spec/summon/schema/facet_spec.rb +1 -21
  18. data/spec/summon/schema/lib_guide_tab_spec.rb +142 -0
  19. data/spec/summon/schema_spec.rb +0 -40
  20. data/spec/summon/service_spec.rb +0 -13
  21. data/spec/summon_spec.rb +1 -4
  22. data/spike.rb +0 -0
  23. data/summon.gemspec +14 -28
  24. metadata +61 -58
  25. data/Manifest.txt +0 -70
  26. data/PostInstall.txt +0 -5
  27. data/lib/summon/locales/dadk.rb +0 -175
  28. data/lib/summon/locales/dede.rb +0 -178
  29. data/lib/summon/locales/en.rb +0 -180
  30. data/lib/summon/locales/eses.rb +0 -175
  31. data/lib/summon/locales/fifi.rb +0 -175
  32. data/lib/summon/locales/fr.rb +0 -9
  33. data/lib/summon/locales/frfr.rb +0 -175
  34. data/lib/summon/locales/isis.rb +0 -175
  35. data/lib/summon/locales/itit.rb +0 -175
  36. data/lib/summon/locales/jp.rb +0 -176
  37. data/lib/summon/locales/nlnl.rb +0 -175
  38. data/lib/summon/locales/nono.rb +0 -175
  39. data/lib/summon/locales/ptpt.rb +0 -175
  40. data/lib/summon/locales/svse.rb +0 -175
  41. data/lib/summon/locales/zacn.rb +0 -175
  42. data/lib/summon/locales/zhcn.rb +0 -175
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ .bundle/
2
+ .idea
3
+ doc
4
+ pkg
5
+ .specification
6
+ .DS_Store
7
+ .rvmrc
@@ -1,65 +1,98 @@
1
- === 1.1.14 2010-10-20
1
+ ### 1.2.0 2011-04-09
2
+
3
+ * removed translations
4
+ * modernize the gemming process
5
+ * support for spotlighting
6
+ * Copyright field in document is now multi-value
7
+
8
+ ### 1.1.17 2011-01-28
9
+ * 1 minor enhancement
10
+ * copyright field is multi-value (document schema)
11
+
12
+ ### 1.1.16 2011-01-27
13
+ * 8 minor enhancements
14
+ * document schema changes
15
+ * renamed dissertation_advisor => dissertation_advisors
16
+ * renamed dissertation_category => dissertation_categories
17
+ * renamed dissertation_degree => dissertation_degrees
18
+ * renamed dissertation_degree_date => dissertation_degrees_dates
19
+ * renamed dissertation_school = dissertation_schools
20
+ * removed dissertation_degree_date_decade
21
+ * removed dissertation_degree_date_century
22
+ * removed dissertation_degree_date_year
23
+
24
+ ### 1.1.15 2011-01-26
25
+ * 1 major enhancement
26
+ * added spotlight_children to document schema
27
+ * 6 minor enhancements
28
+ * added meeting_name to document schema
29
+ * added deweys to document schema
30
+ * added eisbns to document schema
31
+ * added eissns to document schema
32
+ * added copyright to document schema
33
+
34
+ ### 1.1.14 2010-10-20
2
35
  * 1 minor enhancement
3
36
  * German translation updates
4
37
 
5
- === 1.1.13 2010-10-20
38
+ ### 1.1.13 2010-10-20
6
39
  * 1 minor enhancement
7
40
  * fix service cloning
8
41
 
9
- === 1.1.12 2010-10-19
42
+ ### 1.1.12 2010-10-19
10
43
  * 1 minor enhancement
11
44
  * added lib_guide_tabs to document schema
12
45
 
13
- === 1.1.11 2010-09-03
46
+ ### 1.1.11 2010-09-03
14
47
  * 1 minor enhancement
15
48
  * added dbid field accessor to the document schema
16
49
 
17
- === 1.1.10 2010-05-06
50
+ ### 1.1.10 2010-05-06
18
51
  * 4 minor enhancements
19
52
  * updated "en" and "xx" locales
20
53
  * Added additional translation stubs
21
54
  * Added full on translations
22
55
  # Added Edition to document schema
23
56
 
24
- === 1.1.9 2010-05-03
57
+ ### 1.1.9 2010-05-03
25
58
  * 2 minor enhancement
26
- * fix japanese translation for Publication Date
59
+ * fix japanese translation for Publication Date
27
60
  * Added publication_place to document schema
28
61
 
29
- === 1.1.8 2010-03-08
62
+ ### 1.1.8 2010-03-08
30
63
  * 1 minor enhancements
31
64
  * added from_library? to see if a document is from the library catalog
32
65
 
33
- === 1.1.7 2010-02-18
66
+ ### 1.1.7 2010-02-18
34
67
  * 1 minor enhancement
35
68
  * allow locale to be specified as either a string or a symbol
36
-
37
- === 1.1.6 2010-01-14
69
+
70
+ ### 1.1.6 2010-01-14
38
71
  * 1 minor enhancement
39
72
  * tweak database recommendation lists to make it support multiple recommendations
40
-
41
- === 1.1.5 2010-01-13
73
+
74
+ ### 1.1.5 2010-01-13
42
75
  * 1 major enhancement
43
76
  * add support for database recomendation lists
44
-
45
- === 1.1.4 2010-01-12
77
+
78
+ ### 1.1.4 2010-01-12
46
79
  * 4 minor enhancements:
47
80
  * add ISICitedReferencesCount for documents on which they're available
48
81
  * add ISICitedReferencesURI for document on which available
49
82
  * add command line option for setting s.role API parameter
50
83
  * map Document::URI field
51
-
52
- === 1.1.3 2010-01-11
84
+
85
+ ### 1.1.3 2010-01-11
53
86
  * 2 major enhancements:
54
87
  * support for passing locale to summon gem
55
88
  * add japanese language translations
56
89
 
57
- === 1.1.1 2009-12-11
90
+ ### 1.1.1 2009-12-11
58
91
  * 2 minor enhancements:
59
92
  * add support to handle government document classification number (GovDocClassNum)
60
93
  * map error.code into error object to allow for finer grained error messages
61
94
 
62
- === 1.1.0 2009-11-10
95
+ ### 1.1.0 2009-11-10
63
96
  * 2 major enhancements:
64
97
  * add support for Thumbnails in the thumbnail_small, thumbnail_medium, and thumbnail_large fields
65
98
  * add availability service for querying physical catalogue records.
@@ -71,7 +104,7 @@
71
104
  * empty parameter was causing a NameError on the return trip
72
105
  * added range? predicate to range facets so that they can be identified as ranges
73
106
 
74
- === 1.0.0 2009-09-28
107
+ ### 1.0.0 2009-09-28
75
108
 
76
109
  * 1 major enhancement:
77
110
  * Initial Release
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,28 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ summon (1.2.0)
5
+ json (>= 1.2.0)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ diff-lcs (1.1.2)
11
+ json (1.4.6)
12
+ rake (0.8.7)
13
+ rspec (2.4.0)
14
+ rspec-core (~> 2.4.0)
15
+ rspec-expectations (~> 2.4.0)
16
+ rspec-mocks (~> 2.4.0)
17
+ rspec-core (2.4.0)
18
+ rspec-expectations (2.4.0)
19
+ diff-lcs (~> 1.1.2)
20
+ rspec-mocks (2.4.0)
21
+
22
+ PLATFORMS
23
+ ruby
24
+
25
+ DEPENDENCIES
26
+ rake
27
+ rspec (>= 2.0.0)
28
+ summon!
@@ -1,34 +1,34 @@
1
- = summon
1
+ # summon
2
2
 
3
3
  * http://summon.rubyforge.org
4
4
  * http://www.serialssolutions.com/summon
5
5
  * http://api.summon.serialssolutions.com
6
6
 
7
- == DESCRIPTION:
7
+ ## DESCRIPTION:
8
8
 
9
9
  Ruby language bindings for Serials Solutions Summon Unified Discovery Service
10
10
 
11
- == FEATURES/PROBLEMS:
11
+ ## FEATURES/PROBLEMS:
12
12
 
13
13
  * perform searches using the Summon public API from within ruby.
14
14
 
15
- == SYNOPSIS:
15
+ ## SYNOPSIS:
16
16
 
17
- === From the Command Line
17
+ ### From the Command Line
18
18
 
19
- #help
20
- summon --help
21
-
22
- #simple text query
23
- summon "Will Shakespeare"
24
-
25
- #books only please!
26
- summon "Will Shakespeare" --s.cmd="addFacetValueFilters(ContentType, Book)"
27
-
28
- #lots of results.
29
- summon "Will Shakespeare" --s.cmd="addFacetValueFilters(ContentType, Book) setPageSize(100)"
19
+ #help
20
+ summon --help
21
+
22
+ #simple text query
23
+ summon "Will Shakespeare"
24
+
25
+ #books only please!
26
+ summon "Will Shakespeare" --s.cmd="addFacetValueFilters(ContentType, Book)"
30
27
 
31
- === Inside Code
28
+ #lots of results.
29
+ summon "Will Shakespeare" --s.cmd="addFacetValueFilters(ContentType, Book) setPageSize(100)"
30
+
31
+ ### Inside Code
32
32
 
33
33
  require 'summon'
34
34
  @service = Summon::Service.new(:access_id => 'myaccessid', :secret_key => 'mysecretkey')
@@ -43,15 +43,15 @@ Ruby language bindings for Serials Solutions Summon Unified Discovery Service
43
43
  #search using commands
44
44
  search = @service.search("s.cmd" => "addTextQuery(Elephants) addFacetValueFilters(ContentType,Book)")
45
45
 
46
- == REQUIREMENTS:
46
+ ## REQUIREMENTS:
47
47
 
48
48
  * ruby >= 1.8.6
49
49
 
50
- == INSTALL:
50
+ ## INSTALL:
51
51
 
52
- * sudo gem install summon
52
+ sudo gem install summon
53
53
 
54
- == LICENSE:
54
+ ## LICENSE:
55
55
 
56
56
  (The MIT License)
57
57
 
data/Rakefile CHANGED
@@ -1,25 +1,8 @@
1
- require 'rubygems'
2
- gem 'hoe', '>= 2.1.0'
3
- require 'hoe'
4
- require 'fileutils'
5
- require './lib/summon'
1
+ require 'bundler/setup'
2
+ Bundler::GemHelper.install_tasks
6
3
 
7
- Hoe.plugin :newgem
8
4
 
9
- # Generate all the Rake tasks
10
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
11
- $hoe = Hoe.spec 'summon' do
12
- self.developer 'Charles Lowell', 'cowboyd@thefrontside.net'
13
- self.post_install_message = File.read('PostInstall.txt')
14
- self.rubyforge_name = self.name
15
- self.extra_deps = [
16
- ['json','>= 1.2.0']
17
- ]
18
- self.extra_dev_deps = [
19
- ['rspec', '>= 1.2.9']
20
- ]
21
- self.version = Summon::VERSION
22
- end
5
+ require 'rspec/core/rake_task'
23
6
 
24
- require 'newgem/tasks'
25
- Dir['tasks/**/*.rake'].each { |t| load t }
7
+ RSpec::Core::RakeTask.new(:spec)
8
+ task :default => :spec
data/lib/summon.rb CHANGED
@@ -6,14 +6,8 @@ require 'cgi'
6
6
  require 'json'
7
7
 
8
8
  module Summon
9
- VERSION = "1.1.14"
10
- DEFAULT_LOCALE = 'en'
11
-
12
- locale_dir = File.dirname(__FILE__) + '/summon/locales'
13
- Dir["#{locale_dir}/*.rb"].each { |file|
14
- require file
15
- }
16
9
 
10
+ require 'summon/version'
17
11
  require 'summon/log'
18
12
  require 'summon/service'
19
13
  require 'summon/transport'
@@ -29,7 +23,7 @@ module Summon
29
23
  require 'summon/schema/citation'
30
24
  require 'summon/schema/error'
31
25
  require 'summon/schema/recommendation_list'
32
-
26
+
33
27
  def self.escape(value)
34
28
  value.gsub(/(,|\(|\)|\{|\}|\$|\:)/, '\\\\\1').gsub("\\", '\\')
35
29
  end
data/lib/summon/cli.rb CHANGED
@@ -20,6 +20,7 @@ module Summon
20
20
  "s.fvf" => [],
21
21
  "s.fvgf" => [],
22
22
  "s.rff" => [],
23
+ "s.sl" => [],
23
24
  "s.hs" => "*",
24
25
  "s.he" => "*",
25
26
  "s.role" => "none"
@@ -47,6 +48,7 @@ module Summon
47
48
  opts.on("--s.fvgf=FIELD,MODE,VALUES", "Facet Value Group Filter: advanced functionality. see official api docs. e.g. 'SubjectTerms,or,northern+america,u.s.,canada'")
48
49
  opts.on("--s.rff=<facetField>, <minValue>:<maxValue>[:<inclusive>][, <minValue>:<maxValue>[:<inclusive>]]*", "Range Facet Field: e.g. PublicationDate,1971:1980,1981:1990,1991:2000,2001:2010") {|rff| params["s.rff"] << rff}
49
50
  opts.on("--s.rf=<fieldName>, <minValue>:<maxValue>[:<inclusive>]", "Range Filter: filter the result list to values lying within the range. e.g. PublicationDate,1971:1980")
51
+ opts.on("--s.sl=<fieldName>,<value>,<min>,<max>") { |sl| params["s.sl"] << sl }
50
52
  opts.on("--s.hl=BOOLEAN", "Highlight: turn highlighting on or off: e.g. --s.hl=false") {|hl| params["s.hl"] = hl}
51
53
  opts.on("--s.hs=DELIMITER", String, "Highlight Start: demarcate the beginning of a term hit. default is *") {|d| params["s.hs"] = d}
52
54
  opts.on("--s.he=DELIMITER", String, "Highlight End: demarcate the beginning of a term hit. default is *") {|d| params["s.he"] = d}
data/lib/summon/schema.rb CHANGED
@@ -65,15 +65,6 @@ module Summon
65
65
  end.to_json(*a)
66
66
  end
67
67
 
68
- def locale
69
- @service.locale.gsub(/-/, "")
70
- end
71
-
72
- def translate(value)
73
- default = Summon::Locale.const_get(Summon::DEFAULT_LOCALE.upcase)
74
- translator = Summon::Locale.const_defined?(locale.upcase) ? Summon::Locale.const_get(locale.upcase) : default
75
- translator::TRANSLATIONS[value] ? translator::TRANSLATIONS[value] : default::TRANSLATIONS[value] ? default::TRANSLATIONS[value] : value
76
- end
77
68
  end
78
69
 
79
70
  class Attr
@@ -18,27 +18,29 @@ class Summon::Document < Summon::Schema
18
18
  attr :page_count
19
19
  attr :publication_date, :json_name => "PublicationDate_xml", :transform => :Date
20
20
  attr :publication_place
21
-
21
+ attr :meeting_name, :single => false
22
+
22
23
  attr :isi_cited_references_count, :json_name => "ISICitedReferencesCount"
23
24
  attr :isi_cited_references_uri, :json_name => "ISICitedReferencesURI"
24
25
 
25
- attr :dissertation_advisor
26
- attr :dissertation_category
27
- attr :dissertation_degree
28
- attr :dissertation_degree_date
29
- attr :dissertation_degree_date_decade
30
- attr :dissertation_degree_date_century
31
- attr :dissertation_degree_date_year
32
- attr :dissertation_school
26
+ attr :dissertation_advisors, :json_name => "DissertationAdvisor"
27
+ attr :dissertation_categories, :json_name => "DissertationCategory"
28
+ attr :dissertation_degrees, :json_name => "DissertationDegree"
29
+ attr :dissertation_degrees_dates, :json_name => "DissertationDegreeDate"
30
+ attr :dissertation_schools, :json_name => "DissertationSchool"
33
31
 
34
32
  attr :library
35
33
  attr :call_numbers, :json_name => "LCCallNum"
34
+ attr :deweys, :json_name => "DEWEY"
36
35
  attr :doi, :json_name => "DOI"
37
36
  attr :isbns, :json_name => "ISBN"
38
37
  attr :issns, :json_name => "ISSN"
38
+ attr :eisbns, :json_name => "EISBN"
39
+ attr :eissns, :json_name => "EISSN"
39
40
  attr :patent_number
40
41
  attr :gov_doc_class_nums, :json_name => "GovDocClassNum"
41
42
 
43
+ attr :copyright, :single => false
42
44
 
43
45
  attr :subject_terms
44
46
  attr :genres, :json_name => "Genre"
@@ -59,6 +61,8 @@ class Summon::Document < Summon::Schema
59
61
  attr :dbid, :json_name => "DBID", :single => false
60
62
 
61
63
  attr :lib_guide_tab, :json_name => "LibGuideTab_xml", :single => false
64
+
65
+ attr :spotlight_children, :single => false, :transform => :Document
62
66
 
63
67
  def isbn
64
68
  @isbns.first
@@ -96,10 +100,6 @@ class Summon::Document < Summon::Schema
96
100
  "Title: #{title}"
97
101
  end
98
102
 
99
- def local_content_type
100
- translate(@content_type)
101
- end
102
-
103
103
  def lib_guide_tabs
104
104
  @lib_guide_tab.map {|n| Summon::LibGuideTab.new(n["name"], n["uri"])}
105
105
  end
@@ -107,7 +107,7 @@ class Summon::Document < Summon::Schema
107
107
  def from_library?
108
108
  @availability_id != nil
109
109
  end
110
-
110
+
111
111
  end
112
112
 
113
113
  class Summon::Author < Struct.new(:name)
@@ -124,4 +124,4 @@ class Summon::LibGuideTab < Struct.new(:name, :uri)
124
124
  def uri(*args)
125
125
  super()
126
126
  end
127
- end
127
+ end
@@ -22,9 +22,6 @@ class Summon::Facet < Summon::Schema
22
22
  @counts.empty?
23
23
  end
24
24
 
25
- def local_name
26
- translate(@display_name)
27
- end
28
25
  end
29
26
 
30
27
  class Summon::FacetCount < Summon::Schema
@@ -37,14 +34,6 @@ class Summon::FacetCount < Summon::Schema
37
34
  attr :apply_negated_command
38
35
  attr :remove_command
39
36
 
40
- def local_value
41
- translate(@value)
42
- end
43
-
44
- def escaped_local_value
45
- Summon.escape(@local_value)
46
- end
47
-
48
37
  def escaped_value
49
38
  Summon.escape(@value)
50
39
  end
@@ -17,10 +17,6 @@ class Summon::RangeFacet < Summon::Schema
17
17
  false
18
18
  end
19
19
 
20
- def local_name
21
- translate(@display_name)
22
- end
23
-
24
20
  # #COMPATIBILITY
25
21
  #
26
22
  # alias_method :name, :display_name
@@ -57,4 +53,4 @@ class Summon::RangeCount < Summon::Schema
57
53
  def excluded?
58
54
  false
59
55
  end
60
- end
56
+ end