solo-rails 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +49 -0
- data/lib/solo-rails/version.rb +2 -2
- data/lib/solo-rails.rb +204 -217
- metadata +9 -10
- data/README +0 -20
- data/lib/solo-rails/helpers.rb +0 -5
data/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
solo-rails
|
2
|
+
==========
|
3
|
+
|
4
|
+
*solo-rails provides a wrapper around the API for [Soutron Solo](http://www.soutron.com/soutronsolo.html)*
|
5
|
+
|
6
|
+
Methods
|
7
|
+
-------
|
8
|
+
|
9
|
+
The gem provides two methods `show` and `search`.
|
10
|
+
|
11
|
+
### show method
|
12
|
+
|
13
|
+
This takes a Solo CID parameter and returns the corresponding complete record e.g.
|
14
|
+
|
15
|
+
````{:id=>"491542", :request_url=>"http://library.iser.essex.ac.uk/Library/WebServices/SoutronApi.svc/getcatalogue?id=491542", :content_type=>"Monograph", :record_type=>"Report", :cid=>491542, :created_by=>"Soutron Administrator", :created_by_office=>"Colchester", :created_date=>Thu, 15 Jan 1998, :last_edited_by=>"Soutron Administrator", :last_edited_date=>Wed, 06 Oct 2010, :locations=>"Hilary Doughty Research Library", :offices=>"Colchester", :title=>"Absolute and overall poverty in Britain in 1997: what the population themselves say: Bristol Poverty Line Survey: report of the second MORI Survey", :authors=>["Townsend, Peter", "Gordon, David", "Bradshaw, Jonathan", "Gosschalk, Brian"], :isbn=>"086292457X", :publication_date=>"01-11-1997 ", :publisher=>"Bristol Statistical Monitoring Unit", :shelf_reference=>"316.344.233", :keywords=>["Social policy", "Poverty"], :subjects=>["HOUSEHOLDS", "INCOME DYNAMICS", "SOCIAL STRATIFICATION", "SOCIAL STRUCTURE", "WELFARE BENEFITS"], :record_type_detail=>"report", :id_textworks=>"155805", :place=>"Bristol"}````
|
16
|
+
|
17
|
+
### search method
|
18
|
+
|
19
|
+
This accepts parameters from the Solo API and returns the corresponding record set e.g.
|
20
|
+
|
21
|
+
````ruby
|
22
|
+
@records = Libary.search :q => 'Series:"ISER Working Paper Series"',
|
23
|
+
:select => 'Title;Authors;Series Number;Series;Publication Date',
|
24
|
+
:sort => 'Publication Date:d',
|
25
|
+
:per_page => 30,
|
26
|
+
:search_id => params[:search_id],
|
27
|
+
:page => params[:page]
|
28
|
+
````
|
29
|
+
|
30
|
+
This method accepts the same arguments as the API provides, see the Soutron documentation for further detail.
|
31
|
+
|
32
|
+
Use in a Rails app
|
33
|
+
------------------
|
34
|
+
|
35
|
+
The simplest way to use the methods in a Rails app is to add the gem requirement to your Gemfile then create a class which extends from it e.g.
|
36
|
+
|
37
|
+
````ruby
|
38
|
+
# app/models/library.rb
|
39
|
+
|
40
|
+
class Library
|
41
|
+
extend solo-rails
|
42
|
+
end
|
43
|
+
````
|
44
|
+
|
45
|
+
This will allow you to call the methods from controllers with
|
46
|
+
|
47
|
+
Library.show("123456")
|
48
|
+
|
49
|
+
and the search method as above.
|
data/lib/solo-rails/version.rb
CHANGED
data/lib/solo-rails.rb
CHANGED
@@ -4,267 +4,254 @@ require 'open-uri'
|
|
4
4
|
require 'chronic'
|
5
5
|
require 'nokogiri'
|
6
6
|
|
7
|
-
|
7
|
+
class SoloRails
|
8
8
|
|
9
|
-
|
10
|
-
Catalogue.new.show(id)
|
11
|
-
end
|
12
|
-
|
13
|
-
def search(*args)
|
14
|
-
Catalogue.new.search(*args)
|
15
|
-
end
|
9
|
+
class << self
|
16
10
|
|
17
|
-
|
18
|
-
|
19
|
-
def initialize
|
20
|
-
# @site = "http://iser-training.soutron.net/Library/WebServices/SoutronApi.svc/"
|
21
|
-
@site = "http://library.iser.essex.ac.uk/Library/WebServices/SoutronApi.svc/"
|
11
|
+
def site=(site)
|
12
|
+
@site = site
|
22
13
|
end
|
23
14
|
|
24
|
-
|
25
|
-
def show(id)
|
26
|
-
response = SoloHash.new
|
27
|
-
url = "#{@site}getcatalogue?id=#{CGI.escape(id)}"
|
28
|
-
begin
|
29
|
-
soutron_data = Nokogiri::XML(open(url))
|
30
|
-
response[:id] = soutron_data.xpath("/soutron/catalogs_view/ct/cat").attribute("id").text
|
31
|
-
# response[:request_url] = url - removed for security/speed purposes - PG 2011-02-17
|
32
|
-
response[:content_type] = soutron_data.xpath("/soutron/catalogs_view/ct").attribute("name").text
|
33
|
-
response[:record_type] = soutron_data.xpath("/soutron/catalogs_view/ct/cat/rt").attribute("name").text
|
34
|
-
soutron_data.xpath("/soutron/catalogs_view/ct/cat/fs/f").each do |f|
|
35
|
-
if f.xpath("count(./vs/v)") > 0
|
36
|
-
response[uscore(f.attribute("name").text).to_sym] = parse_values(f.attribute("ft").text, f.xpath("./vs/v"))
|
37
|
-
end
|
38
|
-
end
|
15
|
+
end
|
39
16
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
17
|
+
# returns SoloHash of values for individual catalogue record
|
18
|
+
def self.show(id)
|
19
|
+
response = SoloHash.new
|
20
|
+
url = "#{@site}getcatalogue?id=#{CGI.escape(id)}"
|
21
|
+
begin
|
22
|
+
soutron_data = Nokogiri::XML(open(url, :read_timeout => 180))
|
23
|
+
response[:id] = soutron_data.xpath("/soutron/catalogs_view/ct/cat").attribute("id").text
|
24
|
+
# response[:request_url] = url - removed for security/speed purposes - PG 2011-02-17
|
25
|
+
response[:content_type] = soutron_data.xpath("/soutron/catalogs_view/ct").attribute("name").text
|
26
|
+
response[:record_type] = soutron_data.xpath("/soutron/catalogs_view/ct/cat/rt").attribute("name").text
|
27
|
+
soutron_data.xpath("/soutron/catalogs_view/ct/cat/fs/f").each do |f|
|
28
|
+
if f.xpath("count(./vs/v)") > 0
|
29
|
+
response[uscore(f.attribute("name").text).to_sym] = parse_values(f.attribute("ft").text, f.xpath("./vs/v"))
|
52
30
|
end
|
31
|
+
end
|
53
32
|
|
54
|
-
|
55
|
-
|
33
|
+
# find related records - PG 2011-03-01
|
34
|
+
if soutron_data.xpath("count(/soutron/catalogs_view/ct/cat/related_catalogs)") > 0
|
35
|
+
@related_records = []
|
36
|
+
soutron_data.xpath("/soutron/catalogs_view/ct/cat/related_catalogs/ct").each do |related_ct|
|
37
|
+
related_record = SoloHash.new
|
38
|
+
related_record.merge!( { "content_type".to_sym => related_ct.attribute("name").text } )
|
39
|
+
related_ct.xpath('ctlgs/cat').each do |r|
|
40
|
+
related_record.merge!( {"cid".to_sym => r.attribute("id").text } )
|
41
|
+
end
|
42
|
+
@related_records << related_record
|
43
|
+
end
|
44
|
+
response[:related_records] = @related_records
|
56
45
|
end
|
57
|
-
|
46
|
+
|
47
|
+
rescue
|
48
|
+
response = "Record #{id} not found"
|
58
49
|
end
|
50
|
+
return response
|
51
|
+
end
|
59
52
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
53
|
+
# returns nested hash record for given search - PG 2011-01-21
|
54
|
+
def self.search(*args)
|
55
|
+
options = args.pop
|
56
|
+
q, ctrt, select, sort, page, material, search_id, per_page, ignore_is_website_feature = iser_solo_parse_options(options)
|
64
57
|
|
65
|
-
|
66
|
-
|
67
|
-
|
58
|
+
# If we have a value of search_id, then should only also pass: search_id, select, sort, page, per_page & material
|
59
|
+
url = "#{@site}searchcatalogues?"
|
60
|
+
query_string = []
|
68
61
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
62
|
+
if search_id.present?
|
63
|
+
query_string << "searchid=#{search_id}"
|
64
|
+
else
|
65
|
+
query_string << "q=#{q}"
|
66
|
+
query_string << "ctrt=#{ctrt}" if ctrt.present?
|
67
|
+
end
|
75
68
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
69
|
+
query_string << "page=#{page}" if page.present?
|
70
|
+
query_string << "pageSize=#{per_page}" if per_page.present?
|
71
|
+
query_string << "sort=#{sort}" if sort.present?
|
72
|
+
query_string << "fields=#{select}" if select.present?
|
73
|
+
query_string << "material=#{material}" if material.present?
|
81
74
|
|
82
|
-
|
75
|
+
url += query_string.join("&")
|
83
76
|
|
84
|
-
|
77
|
+
p "Fetching SOLO data from: #{url}"
|
85
78
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
79
|
+
begin
|
80
|
+
soutron_data = Nokogiri::XML(open(url, :read_timeout => 180))
|
81
|
+
rescue Exception => e
|
82
|
+
# Rails.logger.info("SOLO Error in URL: " + url)
|
83
|
+
end
|
91
84
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
end
|
85
|
+
response = SoloHash.new
|
86
|
+
Rails.logger.info("#{soutron_data.xpath("/soutron/search_info").attribute("id").text}")
|
87
|
+
meta = {:id => soutron_data.xpath("/soutron/search_info").attribute("id").text}
|
88
|
+
meta["total_items".to_sym] = soutron_data.xpath("/soutron/search_info").attribute("totalItems").text
|
89
|
+
meta["page".to_sym] = page
|
90
|
+
meta["per_page".to_sym] = per_page
|
91
|
+
meta["select".to_sym] = select
|
92
|
+
|
93
|
+
if soutron_data.xpath("count(//ct)") > 0
|
94
|
+
unless soutron_data.xpath("/soutron/search_info/catalogs_view/ct[*]").first.nil?
|
95
|
+
meta["active_content_type".to_sym] = soutron_data.xpath("/soutron/search_info/catalogs_view/ct[*]").first.attribute("name").text
|
96
|
+
meta["active_content_type_count".to_sym] = soutron_data.xpath("/soutron/search_info/catalogs_view/ct[*]").first.attribute("count").text
|
105
97
|
end
|
98
|
+
end
|
106
99
|
|
107
|
-
|
108
|
-
response.merge!("search_info".to_sym => meta)
|
100
|
+
response.merge!("search_info".to_sym => meta)
|
109
101
|
|
110
|
-
|
111
|
-
|
102
|
+
@content_types = []
|
103
|
+
soutron_data.xpath("/soutron/search_info/catalogs_view/ct").each do |ct|
|
112
104
|
|
113
|
-
|
114
|
-
|
115
|
-
|
105
|
+
content_type = SoloHash.new
|
106
|
+
content_type.merge!( { "content_type".to_sym => ct.attribute("name").text } )
|
107
|
+
content_type.merge!( { "size".to_sym => ct.attribute("count").text } )
|
116
108
|
|
117
|
-
|
118
|
-
|
109
|
+
@records = []
|
110
|
+
ct.xpath("./ctlgs/cat").each do |cat|
|
119
111
|
|
120
|
-
|
121
|
-
|
112
|
+
record = SoloHash.new
|
113
|
+
record.merge!( {:id => cat.attribute("id").text, :record_type => cat.xpath("./rt").attribute("name").text} )
|
122
114
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
115
|
+
cat.xpath("./fs/f").each do |f|
|
116
|
+
if f.xpath("count(./vs/v)") > 0 # only include field if it has a value
|
117
|
+
record[uscore(f.attribute("name").text).to_sym] = parse_values(f.attribute("ft").text, f.xpath("./vs/v"))
|
118
|
+
end # / if has value
|
119
|
+
end # /f
|
128
120
|
|
129
|
-
|
121
|
+
@records << record
|
130
122
|
|
131
|
-
|
123
|
+
end # /cat
|
132
124
|
|
133
|
-
|
134
|
-
|
125
|
+
content_type.merge!({"records".to_sym => @records })
|
126
|
+
@content_types << content_type
|
135
127
|
|
136
|
-
|
128
|
+
end # /ct
|
137
129
|
|
138
|
-
|
130
|
+
response.merge!(:content_types => @content_types)
|
139
131
|
|
140
|
-
|
141
|
-
|
132
|
+
return response
|
133
|
+
end
|
142
134
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
135
|
+
def self.published_years(record_type, limit=nil, q=nil)
|
136
|
+
q.nil? ? q = "Is Website Feature:Y" : q << ";Is Website Feature:Y"
|
137
|
+
newest_record = IserSolo.new.search :q => q,
|
138
|
+
:per_page => 1,
|
139
|
+
:sort => "Publication Date:d",
|
140
|
+
:select => "Publication Date",
|
141
|
+
:ctrt => ":#{record_type}"
|
142
|
+
d = newest_record.content_types.first.records.first.publication_date
|
143
|
+
if (d.to_s =~ /(20|19)\d{2}/) != 0
|
144
|
+
newest_year = Chronic.parse("#{d}").year
|
145
|
+
else
|
146
|
+
newest_year = Chronic.parse("01 Jan #{d}").year
|
147
|
+
end
|
156
148
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
end
|
149
|
+
oldest_record = IserSolo.new.search :q => q,
|
150
|
+
:per_page => 1,
|
151
|
+
:sort => "Publication Date:a",
|
152
|
+
:select => "Publication Date",
|
153
|
+
:ctrt => ":#{record_type}"
|
154
|
+
d = oldest_record.content_types.first.records.first.publication_date
|
155
|
+
if (d.to_s =~ /(20|19)\d{2}/) != 0
|
156
|
+
oldest_year = Chronic.parse("#{d}").year
|
157
|
+
else
|
158
|
+
oldest_year = Chronic.parse("01 Jan #{d}").year
|
159
|
+
end
|
160
|
+
if limit.nil?
|
161
|
+
newest_year.downto(oldest_year)
|
162
|
+
else
|
163
|
+
Range.new(oldest_year, newest_year).to_a.reverse[0..limit]
|
173
164
|
end
|
165
|
+
end
|
174
166
|
|
175
|
-
|
167
|
+
private
|
176
168
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
end
|
183
|
-
# unless options[:ignore_is_website_feature] == true
|
184
|
-
# q.nil? ? nil : q << ";Is Website Feature:Y"
|
185
|
-
# end
|
186
|
-
ctrt = options[:ctrt]
|
187
|
-
select = options[:select]
|
188
|
-
sort = options[:sort]
|
189
|
-
page = options[:page]
|
190
|
-
material = options[:material]
|
191
|
-
search_id = options[:search_id]
|
192
|
-
per_page = options[:per_page].blank? ? 20 : options[:per_page]
|
193
|
-
url_safe([q, ctrt, select, sort, page, material, search_id, per_page])
|
169
|
+
# returns array of URL safe variables from options
|
170
|
+
def self.iser_solo_parse_options(options)
|
171
|
+
q = options[:q]
|
172
|
+
unless options[:ignore_is_website_feature] == true
|
173
|
+
q.nil? ? nil : q << ";Is ISER Staff Publication:Y"
|
194
174
|
end
|
175
|
+
ctrt = options[:ctrt]
|
176
|
+
select = options[:select]
|
177
|
+
sort = options[:sort]
|
178
|
+
page = options[:page]
|
179
|
+
material = options[:material]
|
180
|
+
search_id = options[:search_id]
|
181
|
+
per_page = options[:per_page].blank? ? 20 : options[:per_page]
|
182
|
+
url_safe([q, ctrt, select, sort, page, material, search_id, per_page])
|
183
|
+
end
|
195
184
|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
185
|
+
# CGI escapes 'options' array to make safe URLs
|
186
|
+
def self.url_safe(options)
|
187
|
+
options.collect! { |option| CGI.escape(option.to_s) }
|
188
|
+
end
|
200
189
|
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
end
|
190
|
+
# Returns values for a field based on field type, either individual value or array
|
191
|
+
def self.parse_values(field_type, elements)
|
192
|
+
if elements.size > 1
|
193
|
+
value = elements.collect{|v| parse_value(field_type, v)}
|
194
|
+
else
|
195
|
+
value = parse_value(field_type, elements.first)
|
208
196
|
end
|
197
|
+
end
|
209
198
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
end
|
199
|
+
# returns value based on field type
|
200
|
+
# @field_types = {
|
201
|
+
# 1 => "Text",
|
202
|
+
# 2 => "Integer",
|
203
|
+
# 3 => "Date",
|
204
|
+
# 4 => "File",
|
205
|
+
# 5 => "Thesaurus",
|
206
|
+
# 6 => "Validation List",
|
207
|
+
# 7 => "URL",
|
208
|
+
# 8 => "Complex Date",
|
209
|
+
# 9 => "Decimal",
|
210
|
+
# 10 => "Image",
|
211
|
+
# 11 => "Rich Text",
|
212
|
+
# 12 => "User"
|
213
|
+
# }
|
214
|
+
def self.parse_value(field_type, element)
|
215
|
+
field_type = field_type.to_i
|
216
|
+
case field_type
|
217
|
+
when 1, 4, 5, 6, 11, 12 then element.text.to_s
|
218
|
+
when 2 then element.text.to_i
|
219
|
+
when 3 then Date.parse(element.text.to_s)
|
220
|
+
# when 3 then element.text.to_s
|
221
|
+
when 7 then element.text.to_s
|
222
|
+
# if element.attribute("desc").value.size > 0 && !element.attribute("desc").value.eql?(element.text.to_s)
|
223
|
+
# "#{element.attribute("desc")} - #{ActionController::Base.helpers.auto_link(element.text.to_s)}"
|
224
|
+
# else
|
225
|
+
# ActionController::Base.helpers.auto_link(element.text.to_s)
|
226
|
+
# end
|
227
|
+
when 8 then parse_complex_date(element)
|
228
|
+
else field_type
|
241
229
|
end
|
230
|
+
end
|
242
231
|
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
end
|
258
|
-
ret
|
232
|
+
# attempts to make ruby Date or failsover to string from SOLO complex date field - PG 2011-04-08
|
233
|
+
def self.parse_complex_date(element)
|
234
|
+
d = element.text.split("-")
|
235
|
+
date = []
|
236
|
+
date << "%02d" % d[2] unless d[2].nil?
|
237
|
+
date << "%02d" % d[1] unless d[1].nil?
|
238
|
+
date << d[0] unless d[0].nil?
|
239
|
+
circa = "circa " if element.attribute("circa").to_s == "1"
|
240
|
+
nodate = "forthcoming " if element.attribute("nodate").to_s == "1"
|
241
|
+
ongoing = "ongoing" if element.attribute("ongoing").to_s == "1"
|
242
|
+
begin
|
243
|
+
ret = Date.parse("#{date[0]}-#{date[1]}-#{date[2]}")
|
244
|
+
rescue
|
245
|
+
ret = "#{circa}#{nodate}#{date.join("-")} #{ongoing}".capitalize
|
259
246
|
end
|
247
|
+
ret
|
248
|
+
end
|
260
249
|
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
end
|
250
|
+
# removes spaces from 'str' and then applies rails underscore method
|
251
|
+
# converts strings like "Publication Date" into "publication_date"
|
252
|
+
def self.uscore(str)
|
253
|
+
str.gsub(/\s*/,"").underscore
|
254
|
+
end
|
268
255
|
|
269
256
|
end
|
270
257
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solo-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70311651644080 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70311651644080
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: nokogiri
|
27
|
-
requirement: &
|
27
|
+
requirement: &70311651643420 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70311651643420
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: chronic
|
38
|
-
requirement: &
|
38
|
+
requirement: &70311651642360 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70311651642360
|
47
47
|
description: Provides methods to query Soutron Solo catalog from Ruby
|
48
48
|
email:
|
49
49
|
- github@modagoo.co.uk
|
@@ -53,10 +53,9 @@ extra_rdoc_files: []
|
|
53
53
|
files:
|
54
54
|
- .gitignore
|
55
55
|
- Gemfile
|
56
|
-
- README
|
56
|
+
- README.md
|
57
57
|
- Rakefile
|
58
58
|
- lib/solo-rails.rb
|
59
|
-
- lib/solo-rails/helpers.rb
|
60
59
|
- lib/solo-rails/version.rb
|
61
60
|
- solo-rails.gemspec
|
62
61
|
homepage: ''
|
data/README
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
SoloRails
|
2
|
-
|
3
|
-
This gem provides a Ruby wrapper for the Soutron Solo API.
|
4
|
-
|
5
|
-
It provides two methods, one to search the catalogue and one to fetch a specific record.
|
6
|
-
|
7
|
-
Search method
|
8
|
-
|
9
|
-
@records = Library.search :q => '',
|
10
|
-
:select => 'Title;Authors;Created Date',
|
11
|
-
:search_id => @records[:search_info].fetch(:id),
|
12
|
-
:ctrt => ct,
|
13
|
-
:sort => 'Created Date:d',
|
14
|
-
:material => ct[:content_type],
|
15
|
-
:per_page => 30,
|
16
|
-
:page => 0
|
17
|
-
|
18
|
-
Show
|
19
|
-
|
20
|
-
@record = Librar.search("1234556")
|