celsius-primo 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 60572b626b426983981f2f8e7f2489aa8c6cbbf1
4
- data.tar.gz: d4b20436eab7429b947e12d3d96061d00ccbd34e
3
+ metadata.gz: 4277500e7234aac3afa225684ede09aaf77e99fc
4
+ data.tar.gz: d7d6546d49383c0f645b65e23ffb2d092af3c6c8
5
5
  SHA512:
6
- metadata.gz: 57068a673ebdcc946a7d206cecbb3e933d9e77364e28e59f0035a09397fb0cf9ffd1a15d10154cda183fda3139742daae40f4eefdc28c9c0b46f8c29ad067275
7
- data.tar.gz: eae44fccc77a5da32fae8c2f430576a78824bbaa25806199836350cca2cb8a136c0a97863ee6eb6609fda71bf5760755d399989b94b323664b14159dd69adce3
6
+ metadata.gz: 5f9eac504685fced5f04eab16a437d283d1931285627a761e4cfeab099c7b95cab6124dbb2c30dc49286af9ad2ce7d565c113e80cbc18af1da0f877905e8ea34
7
+ data.tar.gz: 4d795059e87617ccec01c34e4b962e42546c744be9bc9ab4a042f9740d7040535876a58fe710d803ba794f2db589c0167409c691136dad060331b8250c0b7158
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
17
  spec.require_paths = ["lib"]
18
18
 
19
- spec.add_dependency "celsius", ">= 0.4.0"
19
+ spec.add_dependency "celsius", ">= 0.4.3"
20
20
  spec.add_dependency "httpi", ">= 2.1.0", "< 3.0.0"
21
21
  spec.add_dependency "ox", ">= 2.1.0"
22
22
 
@@ -6,24 +6,22 @@ class Celsius::Primo::SoapApi::Searcher::SearchBrief::SearchRequestTransformatio
6
6
 
7
7
  def call
8
8
  if match_queries = Celsius::Hash.deep_find_key(source, :match)
9
- binding.pry
10
- raise "unimplemented!"
11
- end
12
- end
9
+ query_terms_node = transformation.inner_search_request.locate("PrimoSearchRequest/QueryTerms").first
13
10
 
14
- =begin
15
- process "//match" do |match|
16
- index_field = index_field_mapping(match.nodes.first.value)
11
+ match_queries.each do |match_query|
12
+ index_field = index_field_mapping(match_query.keys.first)
13
+ value = match_query.values.first
17
14
 
18
- find(@search_request, "PrimoSearchRequest/QueryTerms") << element_from_xml(
19
- <<-xml
20
- <QueryTerm>
21
- <IndexField>#{index_field}</IndexField>
22
- <PrecisionOperator>exact</PrecisionOperator>
23
- <Value>#{match.nodes.first.text}</Value>
24
- </QueryTerm>
25
- xml
26
- )
15
+ query_terms_node << Ox.parse(
16
+ <<-xml
17
+ <QueryTerm>
18
+ <IndexField>#{index_field}</IndexField>
19
+ <PrecisionOperator>exact</PrecisionOperator>
20
+ <Value>#{value}</Value>
21
+ </QueryTerm>
22
+ xml
23
+ )
24
+ end
25
+ end
27
26
  end
28
- =end
29
27
  end
@@ -6,23 +6,23 @@ class Celsius::Primo::SoapApi::Searcher::SearchBrief::SearchRequestTransformatio
6
6
 
7
7
  def call
8
8
  if range_queries = Celsius::Hash.deep_find_key(source, :range)
9
- binding.pry
10
- end
11
- end
9
+ query_terms_node = transformation.inner_search_request.locate("PrimoSearchRequest/QueryTerms").first
12
10
 
13
- =begin
14
- process "//range" do |range|
15
- index_field = index_field_mapping(range.nodes.first.value)
11
+ range_queries.each do |range_query|
12
+ lower_bound = Celsius::Hash.smart_fetch(range_query.values.first, :gte)
13
+ upper_bound = Celsius::Hash.smart_fetch(range_query.values.first, :lte)
14
+ index_field = index_field_mapping(range_query.keys.first)
16
15
 
17
- find(@search_request, "PrimoSearchRequest/QueryTerms") << element_from_xml(
18
- <<-xml
19
- <QueryTerm>
20
- <IndexField>#{index_field}</IndexField>
21
- <PrecisionOperator>contains</PrecisionOperator>
22
- <Value>[#{find(range, "/gte").text} TO #{find(range, "/lte").text}]</Value>
23
- </QueryTerm>
24
- xml
25
- )
16
+ query_terms_node << Ox.parse(
17
+ <<-xml
18
+ <QueryTerm>
19
+ <IndexField>#{index_field}</IndexField>
20
+ <PrecisionOperator>contains</PrecisionOperator>
21
+ <Value>[#{lower_bound} TO #{upper_bound}]</Value>
22
+ </QueryTerm>
23
+ xml
24
+ )
25
+ end
26
+ end
26
27
  end
27
- =end
28
28
  end
@@ -1,5 +1,5 @@
1
1
  module Celsius
2
2
  module Primo
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
@@ -0,0 +1,85 @@
1
+ ---
2
+ facets:
3
+ facet_tlevel:
4
+ terms:
5
+ field: facet_tlevel
6
+ shard_size: 75
7
+ facet_creator:
8
+ terms:
9
+ field: facet_creator
10
+ shard_size: 75
11
+ facet_local31:
12
+ terms:
13
+ field: facet_local31
14
+ shard_size: 75
15
+ facet_topic:
16
+ terms:
17
+ field: facet_topic
18
+ shard_size: 75
19
+ facet_creationdate:
20
+ terms:
21
+ field: facet_creationdate
22
+ shard_size: 75
23
+ facet_domain:
24
+ terms:
25
+ field: facet_domain
26
+ shard_size: 75
27
+ facet_lang:
28
+ terms:
29
+ field: facet_lang
30
+ shard_size: 75
31
+ facet_local15:
32
+ terms:
33
+ field: facet_local15
34
+ shard_size: 75
35
+ facet_local32:
36
+ terms:
37
+ field: facet_local32
38
+ shard_size: 75
39
+ facet_local33:
40
+ terms:
41
+ field: facet_local33
42
+ shard_size: 75
43
+ from: 0
44
+ query:
45
+ bool:
46
+ must:
47
+ - query_string:
48
+ default_operator: AND
49
+ fields:
50
+ - _all
51
+ query: linux
52
+ - query_string:
53
+ default_operator: AND
54
+ fields:
55
+ - creator
56
+ query: gehrke
57
+ - query_string:
58
+ default_operator: AND
59
+ fields:
60
+ - title
61
+ query: linux
62
+ - query_string:
63
+ default_operator: AND
64
+ fields:
65
+ - subject
66
+ query: linux
67
+ - query_string:
68
+ default_operator: AND
69
+ fields:
70
+ - created
71
+ query: 2002
72
+ - query_string:
73
+ default_operator: AND
74
+ fields:
75
+ - identifier
76
+ query: TWR11793
77
+ - range:
78
+ facet_creationdate:
79
+ gte: 2002
80
+ lte: 2002
81
+ - match:
82
+ facet_creator: Gehrke, Frank
83
+ size: 20
84
+ sort:
85
+ - created
@@ -0,0 +1,172 @@
1
+ ---
2
+ took:
3
+ hits:
4
+ hits:
5
+ - _type: record
6
+ _source:
7
+ control:
8
+ sourcerecordid: 000857752
9
+ sourceid: PAD_ALEPH
10
+ recordid: PAD_ALEPH000857752
11
+ originalsourceid: PAD01
12
+ ilsapiid: PAD01000857752
13
+ sourcesystem: Aleph
14
+ display:
15
+ type: print
16
+ title: 'Linux - das Buch : [SuSE Linux 8.x]'
17
+ creator:
18
+ - Klappheck, Günter
19
+ - Glinsky, Peter
20
+ - Gehrke, Frank
21
+ edition: 1. Aufl.
22
+ publisher: 'Düsseldorf : Sybex'
23
+ creationdate: '2002'
24
+ format: '767 S. : Ill. ; 25 cm + 1 CD-ROM (12 cm)'
25
+ subject: SuSE LINUX 8.x
26
+ description: 'CD-ROM u.d.T.: Linux'
27
+ language: ger
28
+ lds01: '{"ht_number":null,"label":"Das Buch - viel Wissen","volume_count":null,"label_additions":null}'
29
+ lds02: 'Linux - das Buch : [SuSE Linux 8.x]'
30
+ lds10: TWR11793
31
+ search:
32
+ creatorcontrib:
33
+ - Klappheck, Günter
34
+ - Glinsky, Peter
35
+ - Gehrke, Frank
36
+ - Klappheck, Günther
37
+ title:
38
+ - 'Linux - das Buch : [SuSE Linux 8.x]'
39
+ - Linux
40
+ - "<<Das>> Buch - viel Wissen"
41
+ description: 'CD-ROM u.d.T.: Linux'
42
+ subject: SuSE LINUX 8.x
43
+ general: TWR
44
+ sourceid: PAD_ALEPH
45
+ recordid: PAD_ALEPH000857752
46
+ isbn:
47
+ - 3-8155-0186-5
48
+ - '9783815501863'
49
+ - '3815501865'
50
+ rsrctype: print
51
+ format: '767 S. : Ill. ; 25 cm + 1 CD-ROM (12 cm)'
52
+ creationdate: '2002'
53
+ searchscope: PAD_ALEPH
54
+ scope: PAD_ALEPH
55
+ lsr02: 'false'
56
+ lsr03: 'false'
57
+ lsr04: 'true'
58
+ lsr05: HT013404430
59
+ lsr09: '20030107'
60
+ lsr10: TWR11793
61
+ lsr15: TWR
62
+ lsr31: monograph
63
+ lsr32: other
64
+ lsr33: print
65
+ lsr34: 'Düsseldorf : Sybex'
66
+ sort:
67
+ title: 'Linux - das Buch : [SuSE Linux 8.x]'
68
+ creationdate: '2002'
69
+ author: Klappheck, Günter
70
+ lso01: '20030107'
71
+ lso03: TWR
72
+ lso48: PAD01000857752
73
+ facets:
74
+ language: ger
75
+ creationdate: '2002'
76
+ topic: SuSE LINUX 8.x
77
+ toplevel: printmedia
78
+ rsrctype:
79
+ - other
80
+ - books
81
+ creatorcontrib:
82
+ - Klappheck, Günter
83
+ - Glinsky, Peter
84
+ - Gehrke, Frank
85
+ format: '767 S. : Ill. ; 25 cm + 1 CD-ROM (12 cm)'
86
+ lfc15: TWR
87
+ lfc31: monograph
88
+ lfc32: other
89
+ lfc33: print
90
+ frbrgroupid: '282155386'
91
+ frbrtype: '6'
92
+ delivery:
93
+ delcategory: physical_item
94
+ addata:
95
+ lad01: '{"author_statement":["Günter Klappheck ; Peter Glinsky ; Frank Gehrke"],"person_creator_display":["Klappheck,
96
+ Günter","Glinsky, Peter","Gehrke, Frank"]}'
97
+ _id: PAD_ALEPH000857752
98
+ creator:
99
+ - Klappheck, Günter
100
+ - Glinsky, Peter
101
+ - Gehrke, Frank
102
+ created: '2002'
103
+ description: 'CD-ROM u.d.T.: Linux'
104
+ edition: 1. Aufl.
105
+ format: '767 S. : Ill. ; 25 cm + 1 CD-ROM (12 cm)'
106
+ identifier:
107
+ - PAD01000857752
108
+ - PAD_ALEPH000857752
109
+ isbn:
110
+ - 3-8155-0186-5
111
+ - '9783815501863'
112
+ - '3815501865'
113
+ issn:
114
+ language: ger
115
+ title: 'Linux - das Buch : [SuSE Linux 8.x]'
116
+ publisher: Sybex
117
+ subject: SuSE LINUX 8.x
118
+ placeOfPublication: Düsseldorf
119
+ total: 1
120
+ facets:
121
+ facet_tlevel:
122
+ _type: terms
123
+ terms:
124
+ - term: printmedia
125
+ count: 1
126
+ facet_creator:
127
+ _type: terms
128
+ terms:
129
+ - term: Klappheck, Günter
130
+ count: 1
131
+ - term: Gehrke, Frank
132
+ count: 1
133
+ - term: Glinsky, Peter
134
+ count: 1
135
+ facet_local31:
136
+ _type: terms
137
+ terms:
138
+ - term: monograph
139
+ count: 1
140
+ facet_topic:
141
+ _type: terms
142
+ terms:
143
+ - term: SuSE LINUX 8.x
144
+ count: 1
145
+ facet_creationdate:
146
+ _type: terms
147
+ terms:
148
+ - term: '2002'
149
+ count: 1
150
+ facet_domain:
151
+ _type: terms
152
+ terms: []
153
+ facet_lang:
154
+ _type: terms
155
+ terms:
156
+ - term: ger
157
+ count: 1
158
+ facet_local15:
159
+ _type: terms
160
+ terms:
161
+ - term: TWR
162
+ count: 1
163
+ facet_local32:
164
+ _type: terms
165
+ terms:
166
+ - term: other
167
+ count: 1
168
+ facet_local33:
169
+ _type: terms
170
+ terms:
171
+ - term: print
172
+ count: 1
@@ -3105,4 +3105,192 @@ http_interactions:
3105
3105
  \n&lt;/addata&gt;\n&lt;/record&gt;&lt;/PrimoNMBib&gt;&lt;sear:LINKS&gt;&lt;sear:thumbnail/&gt;&lt;sear:linktotoc&gt;errorPage&lt;/sear:linktotoc&gt;&lt;/sear:LINKS&gt;&lt;/sear:DOC&gt;&lt;/sear:DOCSET&gt;&lt;/sear:RESULT&gt;&lt;sear:searchToken&gt;0&lt;/sear:searchToken&gt;&lt;/sear:JAGROOT&gt;&lt;/sear:SEGMENTS&gt;</searchBriefReturn></ns1:searchBriefResponse></soapenv:Body></soapenv:Envelope>"
3106
3106
  http_version:
3107
3107
  recorded_at: Thu, 22 Jan 2015 11:49:54 GMT
3108
+ - request:
3109
+ method: post
3110
+ uri: http://primo.kobv.de/primo_library/libweb/webservices/services/searcher
3111
+ body:
3112
+ encoding: UTF-8
3113
+ string: |
3114
+ <?xml version="1.0" encoding="UTF-8"?>
3115
+ <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:impl="http://primo.kobv.de/PrimoWebServices/services/searcher" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ins0="http://xml.apache.org/xml-soap">
3116
+ <env:Body>
3117
+ <impl:searchBrief>
3118
+ <searchRequestStr>
3119
+ <![CDATA[
3120
+ <searchRequest xmlns="http://www.exlibris.com/primo/xsd/wsRequest" xmlns:uic="http://www.exlibris.com/primo/xsd/primoview/uicomponents">
3121
+ <PrimoSearchRequest xmlns="http://www.exlibris.com/primo/xsd/search/request">
3122
+ <QueryTerms>
3123
+ <BoolOpeator>AND</BoolOpeator>
3124
+ <QueryTerm>
3125
+ <IndexField>facet_creator</IndexField>
3126
+ <PrecisionOperator>exact</PrecisionOperator>
3127
+ <Value>Gehrke, Frank</Value>
3128
+ </QueryTerm>
3129
+ <QueryTerm>
3130
+ <IndexField>any</IndexField>
3131
+ <PrecisionOperator>contains</PrecisionOperator>
3132
+ <Value>linux</Value>
3133
+ </QueryTerm>
3134
+ <QueryTerm>
3135
+ <IndexField>creator</IndexField>
3136
+ <PrecisionOperator>contains</PrecisionOperator>
3137
+ <Value>gehrke</Value>
3138
+ </QueryTerm>
3139
+ <QueryTerm>
3140
+ <IndexField>title</IndexField>
3141
+ <PrecisionOperator>contains</PrecisionOperator>
3142
+ <Value>linux</Value>
3143
+ </QueryTerm>
3144
+ <QueryTerm>
3145
+ <IndexField>sub</IndexField>
3146
+ <PrecisionOperator>contains</PrecisionOperator>
3147
+ <Value>linux</Value>
3148
+ </QueryTerm>
3149
+ <QueryTerm>
3150
+ <IndexField>cdate</IndexField>
3151
+ <PrecisionOperator>contains</PrecisionOperator>
3152
+ <Value>2002</Value>
3153
+ </QueryTerm>
3154
+ <QueryTerm>
3155
+ <IndexField>any</IndexField>
3156
+ <PrecisionOperator>contains</PrecisionOperator>
3157
+ <Value>TWR11793</Value>
3158
+ </QueryTerm>
3159
+ <QueryTerm>
3160
+ <IndexField>facet_creationdate</IndexField>
3161
+ <PrecisionOperator>contains</PrecisionOperator>
3162
+ <Value>[2002 TO 2002]</Value>
3163
+ </QueryTerm>
3164
+ </QueryTerms>
3165
+ <StartIndex>1</StartIndex>
3166
+ <BulkSize>20</BulkSize>
3167
+ <DidUMeanEnabled>false</DidUMeanEnabled>
3168
+ <HighlightingEnabled>false</HighlightingEnabled>
3169
+ <Languages>
3170
+ <Language>ger</Language>
3171
+ <Language>eng</Language>
3172
+ </Languages>
3173
+ <SortByList>
3174
+ <SortField>scdate</SortField>
3175
+ </SortByList>
3176
+ <Locations>
3177
+ <uic:Location type="local" value="scope:(PAD_ALEPH)"/>
3178
+ </Locations>
3179
+ </PrimoSearchRequest>
3180
+ <onCampus>false</onCampus>
3181
+ <institution>PAD</institution>
3182
+ </searchRequest>
3183
+ ]]>
3184
+ </searchRequestStr>
3185
+ </impl:searchBrief>
3186
+ </env:Body>
3187
+ </env:Envelope>
3188
+ headers:
3189
+ Content-Type:
3190
+ - application/xml
3191
+ Soapaction:
3192
+ - searchBrief
3193
+ Accept-Encoding:
3194
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
3195
+ Accept:
3196
+ - "*/*"
3197
+ User-Agent:
3198
+ - Ruby
3199
+ response:
3200
+ status:
3201
+ code: 200
3202
+ message: OK
3203
+ headers:
3204
+ Server:
3205
+ - Apache-Coyote/1.1
3206
+ Set-Cookie:
3207
+ - JSESSIONID=05E2A0832CC90D99365B6D7690844DA1; Path=/primo_library/libweb/;
3208
+ HttpOnly
3209
+ Vary:
3210
+ - Accept-Encoding
3211
+ Content-Type:
3212
+ - text/xml;charset=utf-8
3213
+ Transfer-Encoding:
3214
+ - chunked
3215
+ Date:
3216
+ - Thu, 22 Jan 2015 15:37:07 GMT
3217
+ body:
3218
+ encoding: UTF-8
3219
+ string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"
3220
+ xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><soapenv:Body><ns1:searchBriefResponse
3221
+ soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:ns1=\"http://primo.kobv.de/PrimoWebServices/services/searcher\"><searchBriefReturn
3222
+ xsi:type=\"soapenc:string\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">&lt;sear:SEGMENTS
3223
+ xmlns:sear=&quot;http://www.exlibrisgroup.com/xsd/jaguar/search&quot;&gt;&lt;sear:JAGROOT&gt;&lt;sear:RESULT&gt;&lt;sear:QUERYTRANSFORMS/&gt;&lt;sear:FACETLIST
3224
+ ACCURATE_COUNTERS=&quot;true&quot;&gt;&lt;sear:FACET NAME=&quot;creator&quot;
3225
+ COUNT=&quot;3&quot;&gt;&lt;sear:FACET_VALUES KEY=&quot;Klappheck, G&#xFC;nter&quot;
3226
+ VALUE=&quot;1&quot;/&gt;&lt;sear:FACET_VALUES KEY=&quot;Gehrke, Frank&quot;
3227
+ VALUE=&quot;1&quot;/&gt;&lt;sear:FACET_VALUES KEY=&quot;Glinsky, Peter&quot;
3228
+ VALUE=&quot;1&quot;/&gt;&lt;/sear:FACET&gt;&lt;sear:FACET NAME=&quot;lang&quot;
3229
+ COUNT=&quot;1&quot;&gt;&lt;sear:FACET_VALUES KEY=&quot;ger&quot; VALUE=&quot;1&quot;/&gt;&lt;/sear:FACET&gt;&lt;sear:FACET
3230
+ NAME=&quot;rtype&quot; COUNT=&quot;2&quot;&gt;&lt;sear:FACET_VALUES KEY=&quot;books&quot;
3231
+ VALUE=&quot;1&quot;/&gt;&lt;sear:FACET_VALUES KEY=&quot;other&quot; VALUE=&quot;1&quot;/&gt;&lt;/sear:FACET&gt;&lt;sear:FACET
3232
+ NAME=&quot;topic&quot; COUNT=&quot;1&quot;&gt;&lt;sear:FACET_VALUES KEY=&quot;SuSE
3233
+ LINUX 8.x&quot; VALUE=&quot;1&quot;/&gt;&lt;/sear:FACET&gt;&lt;sear:FACET
3234
+ NAME=&quot;tlevel&quot; COUNT=&quot;1&quot;&gt;&lt;sear:FACET_VALUES KEY=&quot;printmedia&quot;
3235
+ VALUE=&quot;1&quot;/&gt;&lt;/sear:FACET&gt;&lt;sear:FACET NAME=&quot;creationdate&quot;
3236
+ COUNT=&quot;1&quot;&gt;&lt;sear:FACET_VALUES KEY=&quot;2002&quot; VALUE=&quot;1&quot;/&gt;&lt;/sear:FACET&gt;&lt;sear:FACET
3237
+ NAME=&quot;fmt&quot; COUNT=&quot;1&quot;&gt;&lt;sear:FACET_VALUES KEY=&quot;767
3238
+ S. : Ill. ; 25 cm + 1 CD-ROM (12 cm)&quot; VALUE=&quot;1&quot;/&gt;&lt;/sear:FACET&gt;&lt;sear:FACET
3239
+ NAME=&quot;local15&quot; COUNT=&quot;1&quot;&gt;&lt;sear:FACET_VALUES KEY=&quot;TWR&quot;
3240
+ VALUE=&quot;1&quot;/&gt;&lt;/sear:FACET&gt;&lt;sear:FACET NAME=&quot;local31&quot;
3241
+ COUNT=&quot;1&quot;&gt;&lt;sear:FACET_VALUES KEY=&quot;monograph&quot; VALUE=&quot;1&quot;/&gt;&lt;/sear:FACET&gt;&lt;sear:FACET
3242
+ NAME=&quot;local32&quot; COUNT=&quot;1&quot;&gt;&lt;sear:FACET_VALUES KEY=&quot;other&quot;
3243
+ VALUE=&quot;1&quot;/&gt;&lt;/sear:FACET&gt;&lt;sear:FACET NAME=&quot;local33&quot;
3244
+ COUNT=&quot;1&quot;&gt;&lt;sear:FACET_VALUES KEY=&quot;print&quot; VALUE=&quot;1&quot;/&gt;&lt;/sear:FACET&gt;&lt;/sear:FACETLIST&gt;&lt;sear:DOCSET
3245
+ HIT_TIME=&quot;234&quot; TOTALHITS=&quot;1&quot; FIRSTHIT=&quot;1&quot; LASTHIT=&quot;1&quot;
3246
+ TOTAL_TIME=&quot;302&quot; IS_LOCAL=&quot;true&quot;&gt;&lt;sear:DOC ID=&quot;15234584&quot;
3247
+ RANK=&quot;0.43341723&quot; NO=&quot;1&quot; SEARCH_ENGINE=&quot;Local Search
3248
+ Engine&quot; SEARCH_ENGINE_TYPE=&quot;Local Search Engine&quot;&gt;&lt;PrimoNMBib
3249
+ xmlns=&quot;http://www.exlibrisgroup.com/xsd/primo/primo_nm_bib&quot;&gt;\n&lt;record&gt;\n&lt;control&gt;\n&lt;sourcerecordid&gt;000857752&lt;/sourcerecordid&gt;
3250
+ \n&lt;sourceid&gt;PAD_ALEPH&lt;/sourceid&gt; \n&lt;recordid&gt;PAD_ALEPH000857752&lt;/recordid&gt;
3251
+ \n&lt;originalsourceid&gt;PAD01&lt;/originalsourceid&gt; \n&lt;ilsapiid&gt;PAD01000857752&lt;/ilsapiid&gt;
3252
+ \n&lt;sourcesystem&gt;Aleph&lt;/sourcesystem&gt; \n&lt;/control&gt;\n&lt;display&gt;\n&lt;type&gt;print&lt;/type&gt;
3253
+ \n&lt;title&gt;Linux - das Buch : [SuSE Linux 8.x]&lt;/title&gt; \n&lt;creator&gt;Klappheck,
3254
+ G&#xFC;nter&lt;/creator&gt; \n&lt;creator&gt;Glinsky, Peter&lt;/creator&gt;
3255
+ \n&lt;creator&gt;Gehrke, Frank&lt;/creator&gt; \n&lt;edition&gt;1. Aufl.&lt;/edition&gt;
3256
+ \n&lt;publisher&gt;D&#xFC;sseldorf : Sybex&lt;/publisher&gt; \n&lt;creationdate&gt;2002&lt;/creationdate&gt;
3257
+ \n&lt;format&gt;767 S. : Ill. ; 25 cm + 1 CD-ROM (12 cm)&lt;/format&gt; \n&lt;subject&gt;SuSE
3258
+ LINUX 8.x&lt;/subject&gt; \n&lt;description&gt;CD-ROM u.d.T.: Linux&lt;/description&gt;
3259
+ \n&lt;language&gt;ger&lt;/language&gt; \n&lt;lds01&gt;{&quot;ht_number&quot;:null,&quot;label&quot;:&quot;Das
3260
+ Buch - viel Wissen&quot;,&quot;volume_count&quot;:null,&quot;label_additions&quot;:null}&lt;/lds01&gt;
3261
+ \n&lt;lds02&gt;Linux - das Buch : [SuSE Linux 8.x]&lt;/lds02&gt; \n&lt;lds10&gt;TWR11793&lt;/lds10&gt;
3262
+ \n&lt;/display&gt;\n&lt;search&gt;\n&lt;creatorcontrib&gt;Klappheck, G&#xFC;nter&lt;/creatorcontrib&gt;
3263
+ \n&lt;creatorcontrib&gt;Glinsky, Peter&lt;/creatorcontrib&gt; \n&lt;creatorcontrib&gt;Gehrke,
3264
+ Frank&lt;/creatorcontrib&gt; \n&lt;creatorcontrib&gt;Klappheck, G&#xFC;nther&lt;/creatorcontrib&gt;
3265
+ \n&lt;title&gt;Linux - das Buch : [SuSE Linux 8.x]&lt;/title&gt; \n&lt;title&gt;Linux&lt;/title&gt;
3266
+ \n&lt;title&gt;&amp;lt;&amp;lt;Das&gt;&gt; Buch - viel Wissen&lt;/title&gt;
3267
+ \n&lt;description&gt;CD-ROM u.d.T.: Linux&lt;/description&gt; \n&lt;subject&gt;SuSE
3268
+ LINUX 8.x&lt;/subject&gt; \n&lt;general&gt;TWR&lt;/general&gt; \n&lt;sourceid&gt;PAD_ALEPH&lt;/sourceid&gt;
3269
+ \n&lt;recordid&gt;PAD_ALEPH000857752&lt;/recordid&gt; \n&lt;isbn&gt;3-8155-0186-5&lt;/isbn&gt;
3270
+ \n&lt;isbn&gt;9783815501863&lt;/isbn&gt; \n&lt;isbn&gt;3815501865&lt;/isbn&gt;
3271
+ \n&lt;rsrctype&gt;print&lt;/rsrctype&gt; \n&lt;format&gt;767 S. : Ill. ; 25
3272
+ cm + 1 CD-ROM (12 cm)&lt;/format&gt; \n&lt;creationdate&gt;2002&lt;/creationdate&gt;
3273
+ \n&lt;searchscope&gt;PAD_ALEPH&lt;/searchscope&gt; \n&lt;scope&gt;PAD_ALEPH&lt;/scope&gt;
3274
+ \n&lt;lsr02&gt;false&lt;/lsr02&gt; \n&lt;lsr03&gt;false&lt;/lsr03&gt; \n&lt;lsr04&gt;true&lt;/lsr04&gt;
3275
+ \n&lt;lsr05&gt;HT013404430&lt;/lsr05&gt; \n&lt;lsr09&gt;20030107&lt;/lsr09&gt;
3276
+ \n&lt;lsr10&gt;TWR11793&lt;/lsr10&gt; \n&lt;lsr15&gt;TWR&lt;/lsr15&gt; \n&lt;lsr31&gt;monograph&lt;/lsr31&gt;
3277
+ \n&lt;lsr32&gt;other&lt;/lsr32&gt; \n&lt;lsr33&gt;print&lt;/lsr33&gt; \n&lt;lsr34&gt;D&#xFC;sseldorf
3278
+ : Sybex&lt;/lsr34&gt; \n&lt;/search&gt;\n&lt;sort&gt;\n&lt;title&gt;Linux
3279
+ - das Buch : [SuSE Linux 8.x]&lt;/title&gt; \n&lt;creationdate&gt;2002&lt;/creationdate&gt;
3280
+ \n&lt;author&gt;Klappheck, G&#xFC;nter&lt;/author&gt; \n&lt;lso01&gt;20030107&lt;/lso01&gt;
3281
+ \n&lt;lso03&gt;TWR&lt;/lso03&gt; \n&lt;lso48&gt;PAD01000857752&lt;/lso48&gt;
3282
+ \n&lt;/sort&gt;\n&lt;facets&gt;\n&lt;language&gt;ger&lt;/language&gt; \n&lt;creationdate&gt;2002&lt;/creationdate&gt;
3283
+ \n&lt;topic&gt;SuSE LINUX 8.x&lt;/topic&gt; \n&lt;toplevel&gt;printmedia&lt;/toplevel&gt;
3284
+ \n&lt;rsrctype&gt;other&lt;/rsrctype&gt; \n&lt;rsrctype&gt;books&lt;/rsrctype&gt;
3285
+ \n&lt;creatorcontrib&gt;Klappheck, G&#xFC;nter&lt;/creatorcontrib&gt; \n&lt;creatorcontrib&gt;Glinsky,
3286
+ Peter&lt;/creatorcontrib&gt; \n&lt;creatorcontrib&gt;Gehrke, Frank&lt;/creatorcontrib&gt;
3287
+ \n&lt;format&gt;767 S. : Ill. ; 25 cm + 1 CD-ROM (12 cm)&lt;/format&gt; \n&lt;lfc15&gt;TWR&lt;/lfc15&gt;
3288
+ \n&lt;lfc31&gt;monograph&lt;/lfc31&gt; \n&lt;lfc32&gt;other&lt;/lfc32&gt;
3289
+ \n&lt;lfc33&gt;print&lt;/lfc33&gt; \n&lt;frbrgroupid&gt;282155386&lt;/frbrgroupid&gt;&lt;frbrtype&gt;6&lt;/frbrtype&gt;&lt;/facets&gt;\n&lt;delivery&gt;\n&lt;delcategory&gt;physical_item&lt;/delcategory&gt;
3290
+ \n&lt;/delivery&gt;\n&lt;addata&gt;\n&lt;lad01&gt;{&quot;author_statement&quot;:[&quot;G&#xFC;nter
3291
+ Klappheck ; Peter Glinsky ; Frank Gehrke&quot;],&quot;person_creator_display&quot;:[&quot;Klappheck,
3292
+ G&#xFC;nter&quot;,&quot;Glinsky, Peter&quot;,&quot;Gehrke, Frank&quot;]}&lt;/lad01&gt;
3293
+ \n&lt;/addata&gt;\n&lt;/record&gt;&lt;/PrimoNMBib&gt;&lt;sear:LINKS&gt;&lt;sear:thumbnail/&gt;&lt;/sear:LINKS&gt;&lt;/sear:DOC&gt;&lt;/sear:DOCSET&gt;&lt;/sear:RESULT&gt;&lt;sear:searchToken&gt;0&lt;/sear:searchToken&gt;&lt;/sear:JAGROOT&gt;&lt;/sear:SEGMENTS&gt;</searchBriefReturn></ns1:searchBriefResponse></soapenv:Body></soapenv:Envelope>"
3294
+ http_version:
3295
+ recorded_at: Thu, 22 Jan 2015 15:37:08 GMT
3108
3296
  recorded_with: VCR 2.9.3
@@ -34,11 +34,49 @@ describe Celsius::Primo::Adapter do
34
34
  describe "#search" do
35
35
  asset_dir = "adapter/search"
36
36
 
37
+ context "if given search request is not a hash" do
38
+ it "raises an error" do
39
+ expect { adapter.search(:no_array) }.to raise_error(ArgumentError, /hash/)
40
+ end
41
+ end
42
+
43
+
44
+ context "if languages is neither set on the adapter nor given" do
45
+ let(:adapter) do
46
+ described_class.new(adapter_options.tap { |options| options.delete(:languages) })
47
+ end
48
+
49
+ it "raises an error" do
50
+ expect { adapter.search({}) }.to raise_error(ArgumentError, /languages/)
51
+ end
52
+ end
53
+
54
+ context "if locations is neither set on the adapter nor given" do
55
+ let(:adapter) do
56
+ described_class.new(adapter_options.tap { |options| options.delete(:locations) })
57
+ end
58
+
59
+ it "raises an error" do
60
+ expect { adapter.search({}) }.to raise_error(ArgumentError, /locations/)
61
+ end
62
+ end
63
+
64
+ context "if institution is neither set on the adapter nor given" do
65
+ let(:adapter) do
66
+ described_class.new(adapter_options.tap { |options| options.delete(:institution) })
67
+ end
68
+
69
+ it "raises an error" do
70
+ expect { adapter.search({}) }.to raise_error(ArgumentError, /institution/)
71
+ end
72
+ end
73
+
37
74
  it "returns a normalized search result", :vcr do
38
75
  [
39
76
  ["#{asset_dir}/search_request.yml", "#{asset_dir}/search_result.yml"],
40
77
  ["#{asset_dir}/search_request_with_empty_result.yml", "#{asset_dir}/empty_search_result.yml"],
41
- ["#{asset_dir}/search_request_for_multiple_publishers.yml", "#{asset_dir}/search_result_with_multiple_publishers.yml"]
78
+ ["#{asset_dir}/search_request_for_multiple_publishers.yml", "#{asset_dir}/search_result_with_multiple_publishers.yml"],
79
+ ["#{asset_dir}/complex_search_request.yml", "#{asset_dir}/search_result_for_complex_request.yml"],
42
80
  ]
43
81
  .each do |search_request_yaml_filename, search_response_yaml_filename|
44
82
  search_request = YAML.load(read_asset(search_request_yaml_filename))
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,4 @@
1
- if ENV["TRAVIS"]
1
+ if ENV["CODECLIMATE_REPO_TOKEN"]
2
2
  require "codeclimate-test-reporter"
3
3
  CodeClimate::TestReporter.start
4
4
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: celsius-primo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Sievers
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.4.0
19
+ version: 0.4.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.4.0
26
+ version: 0.4.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: httpi
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -212,11 +212,13 @@ files:
212
212
  - lib/celsius/primo/version.rb
213
213
  - spec/assets/adapter/mget/mget_request.yml
214
214
  - spec/assets/adapter/mget/mget_result.yml
215
+ - spec/assets/adapter/search/complex_search_request.yml
215
216
  - spec/assets/adapter/search/empty_search_result.yml
216
217
  - spec/assets/adapter/search/search_request.yml
217
218
  - spec/assets/adapter/search/search_request_for_multiple_publishers.yml
218
219
  - spec/assets/adapter/search/search_request_with_empty_result.yml
219
220
  - spec/assets/adapter/search/search_result.yml
221
+ - spec/assets/adapter/search/search_result_for_complex_request.yml
220
222
  - spec/assets/adapter/search/search_result_with_multiple_publishers.yml
221
223
  - spec/cassettes/Celsius_Primo_Adapter/_mget/returns_a_normalzed_mget_result.yml
222
224
  - spec/cassettes/Celsius_Primo_Adapter/_search/returns_a_normalized_search_result.yml
@@ -250,11 +252,13 @@ summary: Generic primo celsius adapter
250
252
  test_files:
251
253
  - spec/assets/adapter/mget/mget_request.yml
252
254
  - spec/assets/adapter/mget/mget_result.yml
255
+ - spec/assets/adapter/search/complex_search_request.yml
253
256
  - spec/assets/adapter/search/empty_search_result.yml
254
257
  - spec/assets/adapter/search/search_request.yml
255
258
  - spec/assets/adapter/search/search_request_for_multiple_publishers.yml
256
259
  - spec/assets/adapter/search/search_request_with_empty_result.yml
257
260
  - spec/assets/adapter/search/search_result.yml
261
+ - spec/assets/adapter/search/search_result_for_complex_request.yml
258
262
  - spec/assets/adapter/search/search_result_with_multiple_publishers.yml
259
263
  - spec/cassettes/Celsius_Primo_Adapter/_mget/returns_a_normalzed_mget_result.yml
260
264
  - spec/cassettes/Celsius_Primo_Adapter/_search/returns_a_normalized_search_result.yml