summon 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +5 -0
- data/Manifest.txt +4 -0
- data/lib/summon.rb +6 -1
- data/lib/summon/locales/en.rb +180 -0
- data/lib/summon/locales/fr.rb +9 -0
- data/lib/summon/locales/jp.rb +176 -0
- data/lib/summon/locales/xx.rb +180 -0
- data/lib/summon/schema.rb +24 -14
- data/lib/summon/schema/availability.rb +1 -1
- data/lib/summon/schema/citation.rb +1 -1
- data/lib/summon/schema/document.rb +4 -0
- data/lib/summon/schema/facet.rb +13 -0
- data/lib/summon/schema/range.rb +4 -0
- data/lib/summon/service.rb +6 -6
- data/lib/summon/transport/canned.json +8 -2
- data/spec/summon/schema/date_spec.rb +1 -1
- data/spec/summon/schema/document_spec.rb +3 -1
- data/spec/summon/schema/facet_spec.rb +28 -4
- data/spec/summon/schema/query_spec.rb +1 -1
- data/spec/summon/schema/range_spec.rb +1 -1
- data/spec/summon/schema/search_spec.rb +4 -4
- data/spec/summon/schema_spec.rb +41 -4
- data/spec/summon/service_spec.rb +5 -1
- data/spec/summon_spec.rb +13 -9
- data/summon.gemspec +3 -3
- metadata +6 -2
data/History.txt
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
=== 1.1.3 2010-01-11
|
|
2
|
+
* 2 major enhancements:
|
|
3
|
+
* support for passing locale to summon gem
|
|
4
|
+
* add japanese language translations
|
|
5
|
+
|
|
1
6
|
=== 1.1.1 2009-12-11
|
|
2
7
|
* 2 minor enhancements:
|
|
3
8
|
* add support to handle government document classification number (GovDocClassNum)
|
data/Manifest.txt
CHANGED
|
@@ -8,6 +8,10 @@ bin/summonh
|
|
|
8
8
|
ispec/integration_spec.rb
|
|
9
9
|
lib/summon.rb
|
|
10
10
|
lib/summon/cli.rb
|
|
11
|
+
lib/summon/locales/en.rb
|
|
12
|
+
lib/summon/locales/fr.rb
|
|
13
|
+
lib/summon/locales/jp.rb
|
|
14
|
+
lib/summon/locales/xx.rb
|
|
11
15
|
lib/summon/log.rb
|
|
12
16
|
lib/summon/schema.rb
|
|
13
17
|
lib/summon/schema/availability.rb
|
data/lib/summon.rb
CHANGED
|
@@ -6,7 +6,12 @@ require 'cgi'
|
|
|
6
6
|
require 'json'
|
|
7
7
|
|
|
8
8
|
module Summon
|
|
9
|
-
VERSION = "1.1.
|
|
9
|
+
VERSION = "1.1.3"
|
|
10
|
+
DEFAULT_LOCALE = 'en'
|
|
11
|
+
require 'summon/locales/en'
|
|
12
|
+
require 'summon/locales/fr'
|
|
13
|
+
require 'summon/locales/jp'
|
|
14
|
+
|
|
10
15
|
require 'summon/log'
|
|
11
16
|
require 'summon/service'
|
|
12
17
|
require 'summon/transport'
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
module Summon
|
|
2
|
+
module Locale
|
|
3
|
+
module EN
|
|
4
|
+
TRANSLATIONS = {
|
|
5
|
+
"ContentType" => "ContentType",
|
|
6
|
+
"IsScholarly" => "IsScholarly",
|
|
7
|
+
"Language" => "Language",
|
|
8
|
+
"Library" => "Library",
|
|
9
|
+
"PublicationDate" => "PublicationDate",
|
|
10
|
+
"SubjectTerms" => "SubjectTerms",
|
|
11
|
+
|
|
12
|
+
"Album" => "Album",
|
|
13
|
+
"Architectural Drawing" => "Architectural Drawing",
|
|
14
|
+
"Archival Material" => "Archival Material",
|
|
15
|
+
"Art" => "Art",
|
|
16
|
+
"Artifact" => "Artifact",
|
|
17
|
+
"Audio Recording" => "Audio Recording",
|
|
18
|
+
"Blueprint" => "Blueprint",
|
|
19
|
+
"Blueprints" => "Blueprints",
|
|
20
|
+
"Book" => "Book",
|
|
21
|
+
"Book Chapter" => "Book Chapter",
|
|
22
|
+
"Book Review" => "Book Review",
|
|
23
|
+
"Catalog" => "Catalog",
|
|
24
|
+
"Ceremonial Object" => "Ceremonial Object",
|
|
25
|
+
"Clothing" => "Clothing",
|
|
26
|
+
"Computer File" => "Computer File",
|
|
27
|
+
"Conference Proceeding" => "Conference Proceeding",
|
|
28
|
+
"Dissertation" => "Dissertation",
|
|
29
|
+
"Drawing" => "Drawing",
|
|
30
|
+
"eBook" => "eBook",
|
|
31
|
+
"Equipment" => "Equipment",
|
|
32
|
+
"Furnishing" => "Furnishing",
|
|
33
|
+
"Government Document" => "Government Document",
|
|
34
|
+
"Graphic Arts" => "Graphic Arts",
|
|
35
|
+
"Houseware" => "Houseware",
|
|
36
|
+
"Image" => "Image",
|
|
37
|
+
"Implements" => "Implements",
|
|
38
|
+
"Journal" => "Journal",
|
|
39
|
+
"Journal Article" => "Journal Article",
|
|
40
|
+
"Kit" => "Kit",
|
|
41
|
+
"Manuscript" => "Manuscript",
|
|
42
|
+
"Map" => "Map",
|
|
43
|
+
"Microfilm" => "Microfilm",
|
|
44
|
+
"Microform" => "Microform",
|
|
45
|
+
"Model" => "Model",
|
|
46
|
+
"Music Recording" => "Music Recording",
|
|
47
|
+
"Music Score" => "Music Score",
|
|
48
|
+
"Musical Instrument" => "Musical Instrument",
|
|
49
|
+
"Newsletter" => "Newsletter",
|
|
50
|
+
"Newspaper" => "Newspaper",
|
|
51
|
+
"Newspaper Article" => "Newspaper Article",
|
|
52
|
+
"Painting" => "Painting",
|
|
53
|
+
"Pamphlet" => "Pamphlet",
|
|
54
|
+
"Paper" => "Paper",
|
|
55
|
+
"Patent" => "Patent",
|
|
56
|
+
"Personal Article" => "Personal Article",
|
|
57
|
+
"Photograph" => "Photograph",
|
|
58
|
+
"Play" => "Play",
|
|
59
|
+
"Poem" => "Poem",
|
|
60
|
+
"Postcard" => "Postcard",
|
|
61
|
+
"Poster" => "Poster",
|
|
62
|
+
"Presentation" => "Presentation",
|
|
63
|
+
"Publication" => "Publication",
|
|
64
|
+
"Publication Article" => "Publication Article",
|
|
65
|
+
"Realia" => "Realia",
|
|
66
|
+
"Report" => "Report",
|
|
67
|
+
"Special Collection" => "Special Collection",
|
|
68
|
+
"Spoken Word Recording" => "Spoken Word Recording",
|
|
69
|
+
"Standard" => "Standard",
|
|
70
|
+
"Tool" => "Tool",
|
|
71
|
+
"Trade Publication Article" => "Trade Publication Article",
|
|
72
|
+
"Transcript" => "Transcript",
|
|
73
|
+
"Video Recording" => "Video Recording",
|
|
74
|
+
"Web Resource" => "Web Resource",
|
|
75
|
+
|
|
76
|
+
"Language" => "Language",
|
|
77
|
+
"Afrikaans" => "Afrikaans",
|
|
78
|
+
"Albanian" => "Albanian",
|
|
79
|
+
"Amharic" => "Amharic",
|
|
80
|
+
"Arabic" => "Arabic",
|
|
81
|
+
"Aragonese" => "Aragonese",
|
|
82
|
+
"Armenian" => "Armenian",
|
|
83
|
+
"Aymara" => "Aymara",
|
|
84
|
+
"Azerbaijani" => "Azerbaijani",
|
|
85
|
+
"Bambara" => "Bambara",
|
|
86
|
+
"Basque" => "Basque",
|
|
87
|
+
"Belarusian" => "Belarusian",
|
|
88
|
+
"Bengali" => "Bengali",
|
|
89
|
+
"Bosnian" => "Bosnian",
|
|
90
|
+
"Breton" => "Breton",
|
|
91
|
+
"Bulgarian" => "Bulgarian",
|
|
92
|
+
"Burmese" => "Burmese",
|
|
93
|
+
"Catalan" => "Catalan",
|
|
94
|
+
"Chechen" => "Chechen",
|
|
95
|
+
"Chinese" => "Chinese",
|
|
96
|
+
"Church Slavic" => "Church Slavic",
|
|
97
|
+
"Cree" => "Cree",
|
|
98
|
+
"Croatian" => "Croatian",
|
|
99
|
+
"Czech" => "Czech",
|
|
100
|
+
"Danish" => "Danish",
|
|
101
|
+
"Dutch" => "Dutch",
|
|
102
|
+
"English" => "English",
|
|
103
|
+
"Esperanto" => "Esperanto",
|
|
104
|
+
"Estonian" => "Estonian",
|
|
105
|
+
"Fijian" => "Fijian",
|
|
106
|
+
"Finnish" => "Finnish",
|
|
107
|
+
"French" => "French",
|
|
108
|
+
"Fulah" => "Fulah",
|
|
109
|
+
"Galician" => "Galician",
|
|
110
|
+
"Ganda" => "Ganda",
|
|
111
|
+
"Georgian" => "Georgian",
|
|
112
|
+
"German" => "German",
|
|
113
|
+
"Greek" => "Greek",
|
|
114
|
+
"Haitian" => "Haitian",
|
|
115
|
+
"Hebrew" => "Hebrew",
|
|
116
|
+
"Hindi" => "Hindi",
|
|
117
|
+
"Hungarian" => "Hungarian",
|
|
118
|
+
"Icelandic" => "Icelandic",
|
|
119
|
+
"Indonesian" => "Indonesian",
|
|
120
|
+
"Inuktitut" => "Inuktitut",
|
|
121
|
+
"inupiaq" => "inupiaq",
|
|
122
|
+
"Irish" => "Irish",
|
|
123
|
+
"Italian" => "Italian",
|
|
124
|
+
"Japanese" => "Japanese",
|
|
125
|
+
"Javanese" => "Javanese",
|
|
126
|
+
"Korean" => "Korean",
|
|
127
|
+
"Kurdish" => "Kurdish",
|
|
128
|
+
"Lao" => "Lao",
|
|
129
|
+
"Latin" => "Latin",
|
|
130
|
+
"Latvian" => "Latvian",
|
|
131
|
+
"Lithuanian" => "Lithuanian",
|
|
132
|
+
"Macedonian" => "Macedonian",
|
|
133
|
+
"Malay" => "Malay",
|
|
134
|
+
"Maltese" => "Maltese",
|
|
135
|
+
"Maori" => "Maori",
|
|
136
|
+
"Marathi" => "Marathi",
|
|
137
|
+
"Mongolian" => "Mongolian",
|
|
138
|
+
"Navajo" => "Navajo",
|
|
139
|
+
"Ndonga" => "Ndonga",
|
|
140
|
+
"Nepali" => "Nepali",
|
|
141
|
+
"Norwegian" => "Norwegian",
|
|
142
|
+
"Norwegian Bokmål" => "Norwegian Bokmål",
|
|
143
|
+
"Ojibwa" => "Ojibwa",
|
|
144
|
+
"Pali" => "Pali",
|
|
145
|
+
"Panjabi" => "Panjabi",
|
|
146
|
+
"Persian" => "Persian",
|
|
147
|
+
"Polish" => "Polish",
|
|
148
|
+
"Portuguese" => "Portuguese",
|
|
149
|
+
"Pushto" => "Pushto",
|
|
150
|
+
"Quechua" => "Quechua",
|
|
151
|
+
"Romanian" => "Romanian",
|
|
152
|
+
"Russian" => "Russian",
|
|
153
|
+
"Sanskrit" => "Sanskrit",
|
|
154
|
+
"Serbian" => "Serbian",
|
|
155
|
+
"Slovak" => "Slovak",
|
|
156
|
+
"Slovenian" => "Slovenian",
|
|
157
|
+
"Spanish" => "Spanish",
|
|
158
|
+
"Sundanese" => "Sundanese",
|
|
159
|
+
"Swahili" => "Swahili",
|
|
160
|
+
"Swedish" => "Swedish",
|
|
161
|
+
"Tagalog" => "Tagalog",
|
|
162
|
+
"Tamil" => "Tamil",
|
|
163
|
+
"Telugu" => "Telugu",
|
|
164
|
+
"Thai" => "Thai",
|
|
165
|
+
"Tibetan" => "Tibetan",
|
|
166
|
+
"Tswana" => "Tswana",
|
|
167
|
+
"Turkish" => "Turkish",
|
|
168
|
+
"Ukrainian" => "Ukrainian",
|
|
169
|
+
"Urdu" => "Urdu",
|
|
170
|
+
"Vietnamese" => "Vietnamese",
|
|
171
|
+
"Welsh" => "Welsh",
|
|
172
|
+
"Western Frisian" => "Western Frisian",
|
|
173
|
+
"Wolof" => "Wolof",
|
|
174
|
+
"Yiddish" => "Yiddish",
|
|
175
|
+
"Yoruba" => "Yoruba",
|
|
176
|
+
"Zulu" => "Zulu"
|
|
177
|
+
}
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
end
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
module Summon
|
|
2
|
+
module Locale
|
|
3
|
+
module JP
|
|
4
|
+
TRANSLATIONS = {
|
|
5
|
+
"Thai" => "タイ語",
|
|
6
|
+
"Esperanto" => "エスペラント語",
|
|
7
|
+
"Irish" => "アイルランド語",
|
|
8
|
+
"Czech" => "チェコ語",
|
|
9
|
+
"Georgian" => "グルジア語",
|
|
10
|
+
"Video Recording" => "ビデオ録画",
|
|
11
|
+
"Newsletter" => "会報",
|
|
12
|
+
"Hindi" => "ヒンディー語",
|
|
13
|
+
"Icelandic" => "アイスランド語",
|
|
14
|
+
"Drawing" => "図面",
|
|
15
|
+
"Kurdish" => "クルド語",
|
|
16
|
+
"Ganda" => "ガンダ語",
|
|
17
|
+
"Poem" => "詩",
|
|
18
|
+
"Afrikaans" => "アフリカーンス語",
|
|
19
|
+
"Patent" => "特許",
|
|
20
|
+
"eBook" => "電子書籍",
|
|
21
|
+
"Standard" => "規格",
|
|
22
|
+
"Belarusian" => "ベラルーシ語",
|
|
23
|
+
"Marathi" => "マラーティー語",
|
|
24
|
+
"IsScholarly" => "IsScholarly ",
|
|
25
|
+
"Manuscript" => "原稿",
|
|
26
|
+
"Special Collection" => "特別コレクション",
|
|
27
|
+
"Tswana" => "ツワナ語",
|
|
28
|
+
"Sanskrit" => "サンスクリット語",
|
|
29
|
+
"Pamphlet" => "パンフレット",
|
|
30
|
+
"Hungarian" => "ハンガリー語",
|
|
31
|
+
"Dutch" => "オランダ語",
|
|
32
|
+
"Catalog" => "カタログ",
|
|
33
|
+
"Newspaper" => "新聞",
|
|
34
|
+
"Azerbaijani" => "アゼルバイジャン語",
|
|
35
|
+
"Swedish" => "スウェーデン語",
|
|
36
|
+
"Breton" => "ブルトン語",
|
|
37
|
+
"Chechen" => "チェチェン語",
|
|
38
|
+
"Artifact" => "工芸品",
|
|
39
|
+
"English" => "英語",
|
|
40
|
+
"Slovenian" => "スロベニア語",
|
|
41
|
+
"Pushto" => "パシュトー語",
|
|
42
|
+
"Lao" => "ラオ語",
|
|
43
|
+
"Conference Proceeding" => "議事録",
|
|
44
|
+
"Burmese" => "ビルマ語",
|
|
45
|
+
"Quechua" => "ケチュア語",
|
|
46
|
+
"Aragonese" => "アラゴン方言",
|
|
47
|
+
"ContentType" => "コンテンツタイプ",
|
|
48
|
+
"Galician" => "ガリシア語",
|
|
49
|
+
"Implements" => "器具",
|
|
50
|
+
"Book" => "本",
|
|
51
|
+
"German" => "ドイツ語",
|
|
52
|
+
"Indonesian" => "インドネシア語",
|
|
53
|
+
"Microform" => "マイクロフォーム",
|
|
54
|
+
"Newspaper Article" => "新聞記事",
|
|
55
|
+
"Computer File" => "コンピュータファイル",
|
|
56
|
+
"Armenian" => "アルメニア語",
|
|
57
|
+
"French" => "フランス語",
|
|
58
|
+
"Audio Recording" => "音声録音",
|
|
59
|
+
"Malay" => "マレー語",
|
|
60
|
+
"Model" => "モデル",
|
|
61
|
+
"Blueprint" => "ブループリント",
|
|
62
|
+
"Spanish" => "スペイン語",
|
|
63
|
+
"Bosnian" => "ボスニア語",
|
|
64
|
+
"Government Document" => "政府文書",
|
|
65
|
+
"Fijian" => "フィージー語",
|
|
66
|
+
"PublicationDate" => "公開日",
|
|
67
|
+
"Art" => "美術",
|
|
68
|
+
"Report" => "レポート",
|
|
69
|
+
"Music Recording" => "音楽録音",
|
|
70
|
+
"Basque" => "バスク語",
|
|
71
|
+
"Russian" => "ロシア語",
|
|
72
|
+
"Maltese" => "マルタ語",
|
|
73
|
+
"Macedonian" => "マケドニア語",
|
|
74
|
+
"Houseware" => "家庭用品",
|
|
75
|
+
"Play" => "演劇",
|
|
76
|
+
"Ceremonial Object" => "崇拝物",
|
|
77
|
+
"Arabic" => "アラビア語",
|
|
78
|
+
"Hebrew" => "ヘブライ語",
|
|
79
|
+
"Tibetan" => "チベット語",
|
|
80
|
+
"Albanian" => "アルバニア語",
|
|
81
|
+
"Music Score" => "楽譜",
|
|
82
|
+
"Wolof" => "ウォロフ語",
|
|
83
|
+
"Vietnamese" => "ベトナム語",
|
|
84
|
+
"Turkish" => "トルコ語",
|
|
85
|
+
"Panjabi" => "パンジャブ語",
|
|
86
|
+
"Maori" => "マオリ語",
|
|
87
|
+
"Finnish" => "フィンランド語",
|
|
88
|
+
"Archival Material" => "収蔵資料",
|
|
89
|
+
"Catalan" => "カタロニア語",
|
|
90
|
+
"Chinese" => "中国語",
|
|
91
|
+
"Western Frisian" => "西フリジア語",
|
|
92
|
+
"Image" => "画像",
|
|
93
|
+
"Amharic" => "アムハラ語",
|
|
94
|
+
"SubjectTerms" => "サブジェクト用語",
|
|
95
|
+
"Urdu" => "ウルドゥー語",
|
|
96
|
+
"Lithuanian" => "リトアニア語",
|
|
97
|
+
"Japanese" => "日本語",
|
|
98
|
+
"Book Review" => "書評",
|
|
99
|
+
"Photograph" => "写真",
|
|
100
|
+
"Dissertation" => "博士論文",
|
|
101
|
+
"Furnishing" => "装身具",
|
|
102
|
+
"Croatian" => "クロアチア語",
|
|
103
|
+
"Sundanese" => "スンダ語",
|
|
104
|
+
"Ndonga" => "ドンガ語",
|
|
105
|
+
"Ukrainian" => "ウクライナ語",
|
|
106
|
+
"Ojibwa" => "オジブエ語",
|
|
107
|
+
"Javanese" => "ジャワ語",
|
|
108
|
+
"Kit" => "キット",
|
|
109
|
+
"Poster" => "ポスター",
|
|
110
|
+
"Trade Publication Article" => "業界誌",
|
|
111
|
+
"Italian" => "イタリア語",
|
|
112
|
+
"Estonian" => "エストニア語",
|
|
113
|
+
"Publication Article" => "出版記事",
|
|
114
|
+
"Equipment" => "装置",
|
|
115
|
+
"Architectural Drawing" => "意匠図",
|
|
116
|
+
"Swahili" => "スワヒリ語",
|
|
117
|
+
"Persian" => "ペルシア語",
|
|
118
|
+
"Nepali" => "ネパール語",
|
|
119
|
+
"Latvian" => "ラトビア語",
|
|
120
|
+
"Danish" => "デンマーク語",
|
|
121
|
+
"Graphic Arts" => "グラフィックアート",
|
|
122
|
+
"Tagalog" => "タガログ語",
|
|
123
|
+
"Serbian" => "セルビア語",
|
|
124
|
+
"Bambara" => "バンバラ語",
|
|
125
|
+
"Greek" => "ギリシャ語",
|
|
126
|
+
"Welsh" => "ウェールズ語",
|
|
127
|
+
"Slovak" => "スロバキア語",
|
|
128
|
+
"Book Chapter" => "章",
|
|
129
|
+
"Telugu" => "テルグ語",
|
|
130
|
+
"Tamil" => "タミル語",
|
|
131
|
+
"Navajo" => "ナバホ語",
|
|
132
|
+
"Inuktitut" => "イヌクティトゥト語",
|
|
133
|
+
"Church Slavic" => "古代教会スラブ語",
|
|
134
|
+
"Korean" => "韓国語",
|
|
135
|
+
"Language" => "本文言語",
|
|
136
|
+
"Tool" => "ツール",
|
|
137
|
+
"Painting" => "絵画",
|
|
138
|
+
"Blueprints" => "ブループリント",
|
|
139
|
+
"Paper" => "研究論文",
|
|
140
|
+
"Map" => "地図",
|
|
141
|
+
"Romanian" => "ルーマニア語",
|
|
142
|
+
"Norwegian" => "ノルウェー語",
|
|
143
|
+
"Mongolian" => "モンゴル語",
|
|
144
|
+
"Album" => "アルバム",
|
|
145
|
+
"Presentation" => "プレゼンテーション",
|
|
146
|
+
"Yoruba" => "ヨルバ語",
|
|
147
|
+
"Polish" => "ポーランド語",
|
|
148
|
+
"Journal Article" => "学術論文",
|
|
149
|
+
"Clothing" => "衣料品",
|
|
150
|
+
"Haitian" => "ハイチ語",
|
|
151
|
+
"Zulu" => "ズールー語",
|
|
152
|
+
"Portuguese" => "ポルトガル語",
|
|
153
|
+
"Pali" => "パーリ語",
|
|
154
|
+
"Cree" => "クリー語",
|
|
155
|
+
"Musical Instrument" => "楽器",
|
|
156
|
+
"Web Resource" => "ウェブ資料",
|
|
157
|
+
"Latin" => "ラテン語",
|
|
158
|
+
"Personal Article" => "個人誌",
|
|
159
|
+
"Postcard" => "ポストカード",
|
|
160
|
+
"Bulgarian" => "ブルガリア語",
|
|
161
|
+
"Fulah" => "フラニ語",
|
|
162
|
+
"Library" => "蔵書",
|
|
163
|
+
"Yiddish" => "イディッシュ語",
|
|
164
|
+
"Journal" => "雑誌",
|
|
165
|
+
"Aymara" => "アイマラ語",
|
|
166
|
+
"Transcript" => "転写物",
|
|
167
|
+
"Publication" => "出版物",
|
|
168
|
+
"Microfilm" => "マイクロフィルム",
|
|
169
|
+
"Spoken Word Recording" => "朗読の録音",
|
|
170
|
+
"Norwegian Bokmål" => "ブ-クモール語(ノルウェー語)",
|
|
171
|
+
"Realia" => "実物教材",
|
|
172
|
+
"Bengali" => "ベンガル語",
|
|
173
|
+
}
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
end
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
module Summon
|
|
2
|
+
module Locale
|
|
3
|
+
module XX
|
|
4
|
+
TRANSLATIONS = {
|
|
5
|
+
"ContentType" => "ContentType",
|
|
6
|
+
"IsScholarly" => "IsScholarly",
|
|
7
|
+
"Language" => "Language",
|
|
8
|
+
"Library" => "Library",
|
|
9
|
+
"PublicationDate" => "PublicationDate",
|
|
10
|
+
"SubjectTerms" => "SubjectTerms",
|
|
11
|
+
|
|
12
|
+
"Album" => "Album",
|
|
13
|
+
"Architectural Drawing" => "Architectural Drawing",
|
|
14
|
+
"Archival Material" => "Archival Material",
|
|
15
|
+
"Art" => "Art",
|
|
16
|
+
"Artifact" => "Artifact",
|
|
17
|
+
"Audio Recording" => "Audio Recording",
|
|
18
|
+
"Blueprint" => "Blueprint",
|
|
19
|
+
"Blueprints" => "Blueprints",
|
|
20
|
+
"Book" => "Book",
|
|
21
|
+
"Book Chapter" => "Book Chapter",
|
|
22
|
+
"Book Review" => "Book Review",
|
|
23
|
+
"Catalog" => "Catalog",
|
|
24
|
+
"Ceremonial Object" => "Ceremonial Object",
|
|
25
|
+
"Clothing" => "Clothing",
|
|
26
|
+
"Computer File" => "Computer File",
|
|
27
|
+
"Conference Proceeding" => "Conference Proceeding",
|
|
28
|
+
"Dissertation" => "Dissertation",
|
|
29
|
+
"Drawing" => "Drawing",
|
|
30
|
+
"eBook" => "eBook",
|
|
31
|
+
"Equipment" => "Equipment",
|
|
32
|
+
"Furnishing" => "Furnishing",
|
|
33
|
+
"Government Document" => "Government Document",
|
|
34
|
+
"Graphic Arts" => "Graphic Arts",
|
|
35
|
+
"Houseware" => "Houseware",
|
|
36
|
+
"Image" => "Image",
|
|
37
|
+
"Implements" => "Implements",
|
|
38
|
+
"Journal" => "Journal",
|
|
39
|
+
"Journal Article" => "Journal Article",
|
|
40
|
+
"Kit" => "Kit",
|
|
41
|
+
"Manuscript" => "Manuscript",
|
|
42
|
+
"Map" => "Map",
|
|
43
|
+
"Microfilm" => "Microfilm",
|
|
44
|
+
"Microform" => "Microform",
|
|
45
|
+
"Model" => "Model",
|
|
46
|
+
"Music Recording" => "Music Recording",
|
|
47
|
+
"Music Score" => "Music Score",
|
|
48
|
+
"Musical Instrument" => "Musical Instrument",
|
|
49
|
+
"Newsletter" => "Newsletter",
|
|
50
|
+
"Newspaper" => "Newspaper",
|
|
51
|
+
"Newspaper Article" => "Newspaper Article",
|
|
52
|
+
"Painting" => "Painting",
|
|
53
|
+
"Pamphlet" => "Pamphlet",
|
|
54
|
+
"Paper" => "Paper",
|
|
55
|
+
"Patent" => "Patent",
|
|
56
|
+
"Personal Article" => "Personal Article",
|
|
57
|
+
"Photograph" => "Photograph",
|
|
58
|
+
"Play" => "Play",
|
|
59
|
+
"Poem" => "Poem",
|
|
60
|
+
"Postcard" => "Postcard",
|
|
61
|
+
"Poster" => "Poster",
|
|
62
|
+
"Presentation" => "Presentation",
|
|
63
|
+
"Publication" => "Publication",
|
|
64
|
+
"Publication Article" => "Publication Article",
|
|
65
|
+
"Realia" => "Realia",
|
|
66
|
+
"Report" => "Report",
|
|
67
|
+
"Special Collection" => "Special Collection",
|
|
68
|
+
"Spoken Word Recording" => "Spoken Word Recording",
|
|
69
|
+
"Standard" => "Standard",
|
|
70
|
+
"Tool" => "Tool",
|
|
71
|
+
"Trade Publication Article" => "Trade Publication Article",
|
|
72
|
+
"Transcript" => "Transcript",
|
|
73
|
+
"Video Recording" => "Video Recording",
|
|
74
|
+
"Web Resource" => "Web Resource",
|
|
75
|
+
|
|
76
|
+
"Language" => "Language",
|
|
77
|
+
"Afrikaans" => "Afrikaans",
|
|
78
|
+
"Albanian" => "Albanian",
|
|
79
|
+
"Amharic" => "Amharic",
|
|
80
|
+
"Arabic" => "Arabic",
|
|
81
|
+
"Aragonese" => "Aragonese",
|
|
82
|
+
"Armenian" => "Armenian",
|
|
83
|
+
"Aymara" => "Aymara",
|
|
84
|
+
"Azerbaijani" => "Azerbaijani",
|
|
85
|
+
"Bambara" => "Bambara",
|
|
86
|
+
"Basque" => "Basque",
|
|
87
|
+
"Belarusian" => "Belarusian",
|
|
88
|
+
"Bengali" => "Bengali",
|
|
89
|
+
"Bosnian" => "Bosnian",
|
|
90
|
+
"Breton" => "Breton",
|
|
91
|
+
"Bulgarian" => "Bulgarian",
|
|
92
|
+
"Burmese" => "Burmese",
|
|
93
|
+
"Catalan" => "Catalan",
|
|
94
|
+
"Chechen" => "Chechen",
|
|
95
|
+
"Chinese" => "Chinese",
|
|
96
|
+
"Church Slavic" => "Church Slavic",
|
|
97
|
+
"Cree" => "Cree",
|
|
98
|
+
"Croatian" => "Croatian",
|
|
99
|
+
"Czech" => "Czech",
|
|
100
|
+
"Danish" => "Danish",
|
|
101
|
+
"Dutch" => "Dutch",
|
|
102
|
+
"English" => "English",
|
|
103
|
+
"Esperanto" => "Esperanto",
|
|
104
|
+
"Estonian" => "Estonian",
|
|
105
|
+
"Fijian" => "Fijian",
|
|
106
|
+
"Finnish" => "Finnish",
|
|
107
|
+
"French" => "French",
|
|
108
|
+
"Fulah" => "Fulah",
|
|
109
|
+
"Galician" => "Galician",
|
|
110
|
+
"Ganda" => "Ganda",
|
|
111
|
+
"Georgian" => "Georgian",
|
|
112
|
+
"German" => "German",
|
|
113
|
+
"Greek" => "Greek",
|
|
114
|
+
"Haitian" => "Haitian",
|
|
115
|
+
"Hebrew" => "Hebrew",
|
|
116
|
+
"Hindi" => "Hindi",
|
|
117
|
+
"Hungarian" => "Hungarian",
|
|
118
|
+
"Icelandic" => "Icelandic",
|
|
119
|
+
"Indonesian" => "Indonesian",
|
|
120
|
+
"Inuktitut" => "Inuktitut",
|
|
121
|
+
"inupiaq" => "inupiaq",
|
|
122
|
+
"Irish" => "Irish",
|
|
123
|
+
"Italian" => "Italian",
|
|
124
|
+
"Japanese" => "Japanese",
|
|
125
|
+
"Javanese" => "Javanese",
|
|
126
|
+
"Korean" => "Korean",
|
|
127
|
+
"Kurdish" => "Kurdish",
|
|
128
|
+
"Lao" => "Lao",
|
|
129
|
+
"Latin" => "Latin",
|
|
130
|
+
"Latvian" => "Latvian",
|
|
131
|
+
"Lithuanian" => "Lithuanian",
|
|
132
|
+
"Macedonian" => "Macedonian",
|
|
133
|
+
"Malay" => "Malay",
|
|
134
|
+
"Maltese" => "Maltese",
|
|
135
|
+
"Maori" => "Maori",
|
|
136
|
+
"Marathi" => "Marathi",
|
|
137
|
+
"Mongolian" => "Mongolian",
|
|
138
|
+
"Navajo" => "Navajo",
|
|
139
|
+
"Ndonga" => "Ndonga",
|
|
140
|
+
"Nepali" => "Nepali",
|
|
141
|
+
"Norwegian" => "Norwegian",
|
|
142
|
+
"Norwegian Bokmål" => "Norwegian Bokmål",
|
|
143
|
+
"Ojibwa" => "Ojibwa",
|
|
144
|
+
"Pali" => "Pali",
|
|
145
|
+
"Panjabi" => "Panjabi",
|
|
146
|
+
"Persian" => "Persian",
|
|
147
|
+
"Polish" => "Polish",
|
|
148
|
+
"Portuguese" => "Portuguese",
|
|
149
|
+
"Pushto" => "Pushto",
|
|
150
|
+
"Quechua" => "Quechua",
|
|
151
|
+
"Romanian" => "Romanian",
|
|
152
|
+
"Russian" => "Russian",
|
|
153
|
+
"Sanskrit" => "Sanskrit",
|
|
154
|
+
"Serbian" => "Serbian",
|
|
155
|
+
"Slovak" => "Slovak",
|
|
156
|
+
"Slovenian" => "Slovenian",
|
|
157
|
+
"Spanish" => "Spanish",
|
|
158
|
+
"Sundanese" => "Sundanese",
|
|
159
|
+
"Swahili" => "Swahili",
|
|
160
|
+
"Swedish" => "Swedish",
|
|
161
|
+
"Tagalog" => "Tagalog",
|
|
162
|
+
"Tamil" => "Tamil",
|
|
163
|
+
"Telugu" => "Telugu",
|
|
164
|
+
"Thai" => "Thai",
|
|
165
|
+
"Tibetan" => "Tibetan",
|
|
166
|
+
"Tswana" => "Tswana",
|
|
167
|
+
"Turkish" => "Turkish",
|
|
168
|
+
"Ukrainian" => "Ukrainian",
|
|
169
|
+
"Urdu" => "Urdu",
|
|
170
|
+
"Vietnamese" => "Vietnamese",
|
|
171
|
+
"Welsh" => "Welsh",
|
|
172
|
+
"Western Frisian" => "Western Frisian",
|
|
173
|
+
"Wolof" => "Wolof",
|
|
174
|
+
"Yiddish" => "Yiddish",
|
|
175
|
+
"Yoruba" => "Yoruba",
|
|
176
|
+
"Zulu" => "Zulu"
|
|
177
|
+
}
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
end
|
data/lib/summon/schema.rb
CHANGED
|
@@ -13,7 +13,7 @@ module Summon
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
module Initializer
|
|
16
|
-
def new(values = {})
|
|
16
|
+
def new(service, values = {})
|
|
17
17
|
dup = {}
|
|
18
18
|
for k, v in values
|
|
19
19
|
dup[k.to_s] = v
|
|
@@ -21,21 +21,21 @@ module Summon
|
|
|
21
21
|
instance = allocate
|
|
22
22
|
instance.instance_eval do
|
|
23
23
|
@src = values
|
|
24
|
+
@service = service
|
|
24
25
|
end
|
|
25
26
|
for attribute in @attrs
|
|
26
|
-
instance.instance_variable_set("@#{attribute.name}", attribute.get(dup))
|
|
27
|
-
end
|
|
27
|
+
instance.instance_variable_set("@#{attribute.name}", attribute.get(service, dup))
|
|
28
|
+
end
|
|
28
29
|
instance
|
|
29
30
|
end
|
|
30
31
|
end
|
|
31
32
|
|
|
32
|
-
module ClassMethods
|
|
33
|
-
|
|
33
|
+
module ClassMethods
|
|
34
34
|
def attr(name, options = {})
|
|
35
35
|
if name.to_s =~ /^(.*)\?$/
|
|
36
36
|
name = $1
|
|
37
37
|
options[:boolean] = true
|
|
38
|
-
end
|
|
38
|
+
end
|
|
39
39
|
symbol = name.to_sym
|
|
40
40
|
@attrs << ::Summon::Schema::Attr.new(symbol, options)
|
|
41
41
|
define_method(name) do |*args|
|
|
@@ -63,7 +63,17 @@ module Summon
|
|
|
63
63
|
self.class.attrs.inject({}) do |json, attr|
|
|
64
64
|
json.merge attr.name => self.send(attr.name)
|
|
65
65
|
end.to_json(*a)
|
|
66
|
-
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def locale
|
|
69
|
+
@service.locale
|
|
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
|
|
67
77
|
end
|
|
68
78
|
|
|
69
79
|
class Attr
|
|
@@ -79,14 +89,14 @@ module Summon
|
|
|
79
89
|
@single = options[:single].nil? ? !(name.to_s.downcase =~ /s$/) : options[:single]
|
|
80
90
|
end
|
|
81
91
|
|
|
82
|
-
def get(json)
|
|
92
|
+
def get(service, json)
|
|
83
93
|
raw = json[@json_name || @camel_name]
|
|
84
94
|
raw = json[@pascal_name] if raw.nil?
|
|
85
95
|
if raw.nil?
|
|
86
96
|
@single ? nil : []
|
|
87
97
|
else
|
|
88
98
|
raw = @single && raw.kind_of?(Array) ? raw.first : raw
|
|
89
|
-
transform(raw) || raw
|
|
99
|
+
transform(service, raw) || raw
|
|
90
100
|
end
|
|
91
101
|
end
|
|
92
102
|
|
|
@@ -96,14 +106,14 @@ module Summon
|
|
|
96
106
|
end
|
|
97
107
|
end
|
|
98
108
|
|
|
99
|
-
def transform(raw)
|
|
109
|
+
def transform(service, raw)
|
|
100
110
|
if @transform
|
|
101
|
-
ctor = proc do |h|
|
|
102
|
-
::Summon.const_get(@transform).new(h)
|
|
111
|
+
ctor = proc do |s,h|
|
|
112
|
+
::Summon.const_get(@transform).new(s,h)
|
|
103
113
|
end
|
|
104
|
-
raw.kind_of?(Array) ? raw.map(&ctor) : ctor.call(raw)
|
|
114
|
+
raw.kind_of?(Array) ? raw.map {|a| [service, a]}.map(&ctor) : ctor.call(service, raw)
|
|
105
115
|
end
|
|
106
116
|
end
|
|
107
117
|
end
|
|
108
118
|
end
|
|
109
|
-
end
|
|
119
|
+
end
|
|
@@ -8,7 +8,7 @@ class Summon::Availability < Summon::Schema
|
|
|
8
8
|
|
|
9
9
|
def self.parse_results(results)
|
|
10
10
|
results["Result"]["RecordSummary"].map do |record|
|
|
11
|
-
new(record["Record"].merge(:token => record["ID"]))
|
|
11
|
+
new(@service, record["Record"].merge(:token => record["ID"]))
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
end
|
data/lib/summon/schema/facet.rb
CHANGED
|
@@ -9,6 +9,7 @@ class Summon::Facet < Summon::Schema
|
|
|
9
9
|
attr :remove_command
|
|
10
10
|
attr :remove_value_filters_command
|
|
11
11
|
|
|
12
|
+
|
|
12
13
|
def to_s
|
|
13
14
|
"Facet(#{display_name}, #{field_name})"
|
|
14
15
|
end
|
|
@@ -20,6 +21,10 @@ class Summon::Facet < Summon::Schema
|
|
|
20
21
|
def empty?
|
|
21
22
|
@counts.empty?
|
|
22
23
|
end
|
|
24
|
+
|
|
25
|
+
def local_name
|
|
26
|
+
translate(@display_name)
|
|
27
|
+
end
|
|
23
28
|
end
|
|
24
29
|
|
|
25
30
|
class Summon::FacetCount < Summon::Schema
|
|
@@ -32,6 +37,14 @@ class Summon::FacetCount < Summon::Schema
|
|
|
32
37
|
attr :apply_negated_command
|
|
33
38
|
attr :remove_command
|
|
34
39
|
|
|
40
|
+
def local_value
|
|
41
|
+
translate(@value)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def escaped_local_value
|
|
45
|
+
Summon.escape(@local_value)
|
|
46
|
+
end
|
|
47
|
+
|
|
35
48
|
def escaped_value
|
|
36
49
|
Summon.escape(@value)
|
|
37
50
|
end
|
data/lib/summon/schema/range.rb
CHANGED
data/lib/summon/service.rb
CHANGED
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
module Summon
|
|
3
3
|
class Service
|
|
4
4
|
|
|
5
|
-
attr_reader :transport, :url, :access_id, :client_key
|
|
5
|
+
attr_reader :transport, :url, :access_id, :client_key, :locale
|
|
6
6
|
|
|
7
|
-
def initialize(options = {})
|
|
7
|
+
def initialize(options = {})
|
|
8
8
|
@url = options[:url] || "http://api.summon.serialssolutions.com"
|
|
9
|
-
@access_id = options[:access_id]
|
|
9
|
+
@access_id = options[:access_id]
|
|
10
10
|
@secret_key = options[:secret_key]
|
|
11
11
|
@client_key = options[:client_key]
|
|
12
|
-
@
|
|
12
|
+
@locale = options[:locale] || Summon::DEFAULT_LOCALE
|
|
13
|
+
@log = Log.new(options[:log])
|
|
13
14
|
@transport = options[:transport] || Summon::Transport::Http.new(:url => @url, :access_id => @access_id, :secret_key => @secret_key, :client_key => @client_key, :session_id => options[:session_id], :log => @log)
|
|
14
15
|
end
|
|
15
16
|
|
|
@@ -19,7 +20,7 @@ module Summon
|
|
|
19
20
|
|
|
20
21
|
def search(params = {})
|
|
21
22
|
connect("/search", params) do |result|
|
|
22
|
-
Summon::Search.new(result)
|
|
23
|
+
Summon::Search.new(self,result)
|
|
23
24
|
end
|
|
24
25
|
end
|
|
25
26
|
|
|
@@ -37,7 +38,6 @@ module Summon
|
|
|
37
38
|
def connect(path, params = {})
|
|
38
39
|
yield @transport.get(path, params)
|
|
39
40
|
end
|
|
40
|
-
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"pageCount": 55301653,
|
|
3
3
|
"didYouMeanSuggestions": [
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
{
|
|
5
|
+
"originalQuery": "louis rmstrong",
|
|
6
|
+
"newSearchCommand": "s.cmd=setTextQuery%28louis+armstrong%29",
|
|
7
|
+
"suggestedQuery": "louis armstrong"
|
|
8
|
+
}],
|
|
6
9
|
"queryTime": 360,
|
|
7
10
|
"documents": [
|
|
8
11
|
{
|
|
@@ -31,6 +34,9 @@
|
|
|
31
34
|
"PublicationDate": [
|
|
32
35
|
"20020316"
|
|
33
36
|
],
|
|
37
|
+
"Author": [
|
|
38
|
+
"Hunter, Lisa"
|
|
39
|
+
],
|
|
34
40
|
"Genre": [
|
|
35
41
|
"Obituary",
|
|
36
42
|
"Obituary"
|
|
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe Summon::Date do
|
|
4
4
|
it "should do stuff w/ date" do
|
|
5
|
-
date = Summon::Date.new({"month"=>"01", "text"=>"c2000.", "day"=>"02", "year"=>"2000"})
|
|
5
|
+
date = Summon::Date.new(@service, {"month"=>"01", "text"=>"c2000.", "day"=>"02", "year"=>"2000"})
|
|
6
6
|
|
|
7
7
|
date.day.should == 2
|
|
8
8
|
date.month.should == 1
|
|
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe Summon::Document do
|
|
4
4
|
it "should map" do
|
|
5
|
-
doc = Summon::Document.new(JSON.parse(EXAMPLE_DOCUMENT_JSON))
|
|
5
|
+
doc = Summon::Document.new(@service, JSON.parse(EXAMPLE_DOCUMENT_JSON))
|
|
6
6
|
doc.remove_src
|
|
7
7
|
doc.publication_date.remove_src
|
|
8
8
|
doc.authors.each {|a| a.remove_src }
|
|
@@ -235,6 +235,7 @@ patent_number:
|
|
|
235
235
|
publication_date: !ruby/object:Summon::Date
|
|
236
236
|
day: "02"
|
|
237
237
|
month: "01"
|
|
238
|
+
service:
|
|
238
239
|
src:
|
|
239
240
|
text: c2000.
|
|
240
241
|
year: "2000"
|
|
@@ -243,6 +244,7 @@ publication_title: Batman Books
|
|
|
243
244
|
publishers:
|
|
244
245
|
- Spirulina Records
|
|
245
246
|
- Swingsistersound
|
|
247
|
+
service:
|
|
246
248
|
snippet: This is the snippet
|
|
247
249
|
src:
|
|
248
250
|
start_page: pp23
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
2
|
|
|
3
3
|
describe Summon::Facet do
|
|
4
|
-
|
|
5
4
|
it "should map" do
|
|
6
|
-
facet = Summon::Facet.new(JSON.parse(EXAMPLE_FACET_JSON))
|
|
5
|
+
facet = Summon::Facet.new(@service, JSON.parse(EXAMPLE_FACET_JSON))
|
|
7
6
|
facet.remove_src
|
|
8
7
|
facet.counts.each {|f| f.remove_src }
|
|
9
8
|
facet.to_yaml.should == EXPECTED_FACET_YAML
|
|
@@ -14,12 +13,33 @@ describe Summon::Facet do
|
|
|
14
13
|
first.remove_command.should == "eatMyShorts()"
|
|
15
14
|
end
|
|
16
15
|
|
|
16
|
+
describe "translate display name" do
|
|
17
|
+
it "should return the default value" do
|
|
18
|
+
mock(:service, :locale => 'en').tap do |service|
|
|
19
|
+
@facet = Summon::Facet.new(service, JSON.parse(EXAMPLE_FACET_JSON))
|
|
20
|
+
@facet.local_name.should == @facet.display_name
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "should return the Frech locale" do
|
|
25
|
+
mock(:service, :locale => 'fr').tap do |service|
|
|
26
|
+
@facet = Summon::Facet.new(service, JSON.parse(EXAMPLE_FACET_JSON))
|
|
27
|
+
|
|
28
|
+
@facet.display_name.should == "ContentType"
|
|
29
|
+
@facet.local_name.should == "Type de la Contente"
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
|
|
17
35
|
it "should now how to escape values" do
|
|
18
|
-
|
|
36
|
+
service = mock(:service, :locale => 'en')
|
|
37
|
+
|
|
38
|
+
count = Summon::FacetCount.new(service, :value => "the quick, brown, fox")
|
|
19
39
|
count.value.should == "the quick, brown, fox"
|
|
20
40
|
count.escaped_value.should == 'the quick\, brown\, fox'
|
|
21
41
|
|
|
22
|
-
Summon::FacetCount.new(:value => ': everything (else) and $1 or {is} it\ ').escaped_value.should ==
|
|
42
|
+
Summon::FacetCount.new(service, :value => ': everything (else) and $1 or {is} it\ ').escaped_value.should ==
|
|
23
43
|
'\: everything \(else\) and \$1 or \{is\} it\\ '
|
|
24
44
|
end
|
|
25
45
|
|
|
@@ -82,6 +102,7 @@ counts:
|
|
|
82
102
|
further_limiting: true
|
|
83
103
|
negated: false
|
|
84
104
|
remove_command: eatMyShorts()
|
|
105
|
+
service:
|
|
85
106
|
src:
|
|
86
107
|
value: Book
|
|
87
108
|
- !ruby/object:Summon::FacetCount
|
|
@@ -92,6 +113,7 @@ counts:
|
|
|
92
113
|
further_limiting: true
|
|
93
114
|
negated: false
|
|
94
115
|
remove_command: eatMyShorts()
|
|
116
|
+
service:
|
|
95
117
|
src:
|
|
96
118
|
value: JournalArticle
|
|
97
119
|
- !ruby/object:Summon::FacetCount
|
|
@@ -102,6 +124,7 @@ counts:
|
|
|
102
124
|
further_limiting: true
|
|
103
125
|
negated: false
|
|
104
126
|
remove_command: eatMyShorts()
|
|
127
|
+
service:
|
|
105
128
|
src:
|
|
106
129
|
value: Journal Article
|
|
107
130
|
display_name: ContentType
|
|
@@ -110,6 +133,7 @@ page_number: 1
|
|
|
110
133
|
page_size: 10
|
|
111
134
|
remove_command: removeFacetField(ContentType_sfacet)
|
|
112
135
|
remove_value_filters_command: removeFacetValueFilters(ContentType)
|
|
136
|
+
service:
|
|
113
137
|
src:
|
|
114
138
|
YAML
|
|
115
139
|
end
|
|
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe Summon::RangeFacet do
|
|
4
4
|
it "maps" do
|
|
5
|
-
range = Summon::RangeFacet.new(JSON.parse(<<-JSON))
|
|
5
|
+
range = Summon::RangeFacet.new(@service, JSON.parse(<<-JSON))
|
|
6
6
|
{
|
|
7
7
|
"displayName": "PublicationDate",
|
|
8
8
|
"removeCommand": "removeFacetField(PublicationDate)",
|
|
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe Summon::Search do
|
|
4
4
|
it "maps" do
|
|
5
|
-
search = Summon::Search.new(JSON.parse(<<-JSON))
|
|
5
|
+
search = Summon::Search.new(@service, JSON.parse(<<-JSON))
|
|
6
6
|
{
|
|
7
7
|
"pageCount": 0,
|
|
8
8
|
"didYouMeanSuggestions": [
|
|
@@ -34,7 +34,7 @@ JSON
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
it "should handle an error case" do
|
|
37
|
-
search = Summon::Search.new(
|
|
37
|
+
search = Summon::Search.new(@service,
|
|
38
38
|
"version" => "1.0.0",
|
|
39
39
|
"errors" => [
|
|
40
40
|
{
|
|
@@ -55,8 +55,8 @@ JSON
|
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
it "should be empty w/ no docs" do
|
|
58
|
-
Summon::Search.new({}).should be_empty
|
|
59
|
-
Summon::Search.new({"documents" => [{}]}).should_not be_empty
|
|
58
|
+
Summon::Search.new(@service, {}).should be_empty
|
|
59
|
+
Summon::Search.new(@service, {"documents" => [{}]}).should_not be_empty
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
end
|
data/spec/summon/schema_spec.rb
CHANGED
|
@@ -11,7 +11,47 @@ describe Summon::Schema do
|
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def init(values)
|
|
14
|
-
@class.new(values)
|
|
14
|
+
@class.new(mock(:service, :locale => 'en'), values)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe "Locale" do
|
|
18
|
+
|
|
19
|
+
it "should have a french local when set to fr" do
|
|
20
|
+
Class.new(Summon::Schema).new(mock(:service, :locale => 'fr')).tap do |o|
|
|
21
|
+
o.locale.should == 'fr'
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "should translate ContentType to french" do
|
|
26
|
+
Class.new(Summon::Schema).new(mock(:service, :locale => 'fr')).tap do |o|
|
|
27
|
+
o.translate("ContentType").should == 'Type de la Contente'
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it "should be able to switch translation languages" do
|
|
32
|
+
mock(:service, :locale => 'fr').tap do |service|
|
|
33
|
+
Class.new(Summon::Schema).new(service).tap do |o|
|
|
34
|
+
o.translate("ContentType").should == 'Type de la Contente'
|
|
35
|
+
service.stub!(:locale).and_return('en')
|
|
36
|
+
o.translate("ContentType").should == 'ContentType'
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it "should go to the default language if the locale is not available" do
|
|
42
|
+
Class.new(Summon::Schema).new(mock(:service, :locale => 'fr')).tap do |o|
|
|
43
|
+
o.translate("ContentType").should == 'Type de la Contente'
|
|
44
|
+
o.translate("Book").should == 'Book'
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it "should default to english if it does not recognize the locale" do
|
|
49
|
+
mock(:service, :locale => 'xx').tap do |service|
|
|
50
|
+
Class.new(Summon::Schema).new(service).tap do |o|
|
|
51
|
+
o.translate("ContentType").should == 'ContentType'
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
15
55
|
end
|
|
16
56
|
|
|
17
57
|
it "pulls its attributes from a hash" do
|
|
@@ -137,7 +177,4 @@ describe Summon::Schema do
|
|
|
137
177
|
end
|
|
138
178
|
init({}).foos.should == []
|
|
139
179
|
end
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
180
|
end
|
data/spec/summon/service_spec.rb
CHANGED
|
@@ -14,5 +14,9 @@ describe Summon::Service do
|
|
|
14
14
|
it "has a default url which is the public production summon url" do
|
|
15
15
|
Summon::Service.new.url.should == "http://api.summon.serialssolutions.com"
|
|
16
16
|
end
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
it "should have a locale set to the locale specified" do
|
|
19
|
+
Summon::Service.new.locale.should == 'en'
|
|
20
|
+
end
|
|
21
|
+
|
|
18
22
|
end
|
data/spec/summon_spec.rb
CHANGED
|
@@ -5,10 +5,10 @@ describe "Summon Gem Integration Test" do
|
|
|
5
5
|
service = Summon::Service.new(:transport => Summon::Transport::Canned.new)
|
|
6
6
|
search = service.search
|
|
7
7
|
search.should_not be_nil
|
|
8
|
-
search.record_count.should ==
|
|
9
|
-
search.page_count.should ==
|
|
10
|
-
search.total_request_time.should ==
|
|
11
|
-
search.query_time.should ==
|
|
8
|
+
search.record_count.should == 553016530
|
|
9
|
+
search.page_count.should == 55301653
|
|
10
|
+
search.total_request_time.should == 380
|
|
11
|
+
search.query_time.should == 360
|
|
12
12
|
search.suggestions.should_not be_nil
|
|
13
13
|
search.suggestions.length.should == 1
|
|
14
14
|
dym = search.suggestions.first
|
|
@@ -17,12 +17,12 @@ describe "Summon Gem Integration Test" do
|
|
|
17
17
|
|
|
18
18
|
documents = search.documents
|
|
19
19
|
documents.should_not be_nil
|
|
20
|
-
documents.length.should ==
|
|
20
|
+
documents.length.should == 10
|
|
21
21
|
d = documents[0]
|
|
22
|
-
d.id.should ==
|
|
23
|
-
d.content_type.should ==
|
|
22
|
+
d.id.should == 'proquest_dll_1839009301'
|
|
23
|
+
d.content_type.should == 'Newspaper Article'
|
|
24
24
|
d.authors.map{|a| a.name}.should == ["Hunter, Lisa"]
|
|
25
|
-
d.open_url.should == "ctx_ver=Z39.88-2004&rfr_id=info:sid
|
|
25
|
+
d.open_url.should == "ctx_ver=Z39.88-2004&rfr_id=info:sid/summon.serialssolutions.com&rft_val_fmt=info:ofi/fmt:kevLmtx:journal&rft.genre=article&rft.atitle=OBITUARIES&rft.jtitle=Arizona+Republic&rft.date=2002-03-16&rft.issn=0892-8711&rft.spage=B.5&rft.externalDBID=AREP&rft.externalDocID=1839009301"
|
|
26
26
|
d.fulltext?.should be(false)
|
|
27
27
|
|
|
28
28
|
|
|
@@ -30,7 +30,7 @@ describe "Summon Gem Integration Test" do
|
|
|
30
30
|
facets.should_not be_nil
|
|
31
31
|
facets.length.should >= 5
|
|
32
32
|
ctype = facets[2]
|
|
33
|
-
ctype.display_name.should == "
|
|
33
|
+
ctype.display_name.should == "Language"
|
|
34
34
|
ctype.combine_mode.should == 'or'
|
|
35
35
|
end
|
|
36
36
|
|
|
@@ -45,4 +45,8 @@ describe "Summon Gem Integration Test" do
|
|
|
45
45
|
Summon.unescape(Summon.escape(unescaped)).should == unescaped
|
|
46
46
|
Summon.escape(Summon.unescape(escaped)).should == escaped
|
|
47
47
|
end
|
|
48
|
+
|
|
49
|
+
it "should have a default locale" do
|
|
50
|
+
Summon::DEFAULT_LOCALE.should == 'en'
|
|
51
|
+
end
|
|
48
52
|
end
|
data/summon.gemspec
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
4
|
s.name = %q{summon}
|
|
5
|
-
s.version = "1.1.
|
|
5
|
+
s.version = "1.1.3"
|
|
6
6
|
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
8
8
|
s.authors = ["Charles Lowell"]
|
|
9
|
-
s.date = %q{
|
|
9
|
+
s.date = %q{2010-01-11}
|
|
10
10
|
s.description = %q{Ruby language bindings for Serials Solutions Summon Unified Discovery Service}
|
|
11
11
|
s.email = ["cowboyd@thefrontside.net"]
|
|
12
12
|
s.executables = ["summon", "summonh"]
|
|
13
13
|
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt"]
|
|
14
|
-
s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "bin/summon", "bin/summonh", "ispec/integration_spec.rb", "lib/summon.rb", "lib/summon/cli.rb", "lib/summon/log.rb", "lib/summon/schema.rb", "lib/summon/schema/availability.rb", "lib/summon/schema/citation.rb", "lib/summon/schema/date.rb", "lib/summon/schema/document.rb", "lib/summon/schema/error.rb", "lib/summon/schema/facet.rb", "lib/summon/schema/query.rb", "lib/summon/schema/range.rb", "lib/summon/schema/search.rb", "lib/summon/schema/suggestion.rb", "lib/summon/service.rb", "lib/summon/transport.rb", "lib/summon/transport/canned.json", "lib/summon/transport/canned.rb", "lib/summon/transport/errors.rb", "lib/summon/transport/headers.rb", "lib/summon/transport/http.rb", "lib/summon/transport/qstring.rb", "script/console", "script/destroy", "script/generate", "spec/spec.opts", "spec/spec_helper.rb", "spec/summon/log_spec.rb", "spec/summon/schema/availability_spec.rb", "spec/summon/schema/citation_spec.rb", "spec/summon/schema/date_spec.rb", "spec/summon/schema/document_spec.rb", "spec/summon/schema/facet_spec.rb", "spec/summon/schema/query_spec.rb", "spec/summon/schema/range_spec.rb", "spec/summon/schema/search_spec.rb", "spec/summon/schema_spec.rb", "spec/summon/service_spec.rb", "spec/summon/transport/headers_spec.rb", "spec/summon/transport/http_spec.rb", "spec/summon/transport/qstring_spec.rb", "spec/summon_spec.rb", "summon.gemspec"]
|
|
14
|
+
s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "bin/summon", "bin/summonh", "ispec/integration_spec.rb", "lib/summon.rb", "lib/summon/cli.rb", "lib/summon/locales/en.rb", "lib/summon/locales/fr.rb", "lib/summon/locales/jp.rb", "lib/summon/locales/xx.rb", "lib/summon/log.rb", "lib/summon/schema.rb", "lib/summon/schema/availability.rb", "lib/summon/schema/citation.rb", "lib/summon/schema/date.rb", "lib/summon/schema/document.rb", "lib/summon/schema/error.rb", "lib/summon/schema/facet.rb", "lib/summon/schema/query.rb", "lib/summon/schema/range.rb", "lib/summon/schema/search.rb", "lib/summon/schema/suggestion.rb", "lib/summon/service.rb", "lib/summon/transport.rb", "lib/summon/transport/canned.json", "lib/summon/transport/canned.rb", "lib/summon/transport/errors.rb", "lib/summon/transport/headers.rb", "lib/summon/transport/http.rb", "lib/summon/transport/qstring.rb", "script/console", "script/destroy", "script/generate", "spec/spec.opts", "spec/spec_helper.rb", "spec/summon/log_spec.rb", "spec/summon/schema/availability_spec.rb", "spec/summon/schema/citation_spec.rb", "spec/summon/schema/date_spec.rb", "spec/summon/schema/document_spec.rb", "spec/summon/schema/facet_spec.rb", "spec/summon/schema/query_spec.rb", "spec/summon/schema/range_spec.rb", "spec/summon/schema/search_spec.rb", "spec/summon/schema_spec.rb", "spec/summon/service_spec.rb", "spec/summon/transport/headers_spec.rb", "spec/summon/transport/http_spec.rb", "spec/summon/transport/qstring_spec.rb", "spec/summon_spec.rb", "summon.gemspec"]
|
|
15
15
|
s.homepage = %q{http://summon.rubyforge.org}
|
|
16
16
|
s.post_install_message = %q{
|
|
17
17
|
For comprehensive documentation on Summon API options and usage visit:
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: summon
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Charles Lowell
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date:
|
|
12
|
+
date: 2010-01-11 00:00:00 +02:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
@@ -65,6 +65,10 @@ files:
|
|
|
65
65
|
- ispec/integration_spec.rb
|
|
66
66
|
- lib/summon.rb
|
|
67
67
|
- lib/summon/cli.rb
|
|
68
|
+
- lib/summon/locales/en.rb
|
|
69
|
+
- lib/summon/locales/fr.rb
|
|
70
|
+
- lib/summon/locales/jp.rb
|
|
71
|
+
- lib/summon/locales/xx.rb
|
|
68
72
|
- lib/summon/log.rb
|
|
69
73
|
- lib/summon/schema.rb
|
|
70
74
|
- lib/summon/schema/availability.rb
|