opds 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/opds/entry.rb +9 -3
- data/opds.gemspec +1 -1
- data/spec/opdsparser_opds_1_1_spec.rb +4 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/lib/opds/entry.rb
CHANGED
@@ -85,6 +85,8 @@ module OPDS
|
|
85
85
|
price=nil
|
86
86
|
currency=nil
|
87
87
|
@namespaces['opds']||='http://opds-spec.org/2010/catalog'
|
88
|
+
types=n.search('.//opds:indirectAcquisition',@namespaces).map{|b| b['type']}
|
89
|
+
type=[type,types].flatten.compact unless types.nil? || types.empty?
|
88
90
|
oprice=n.at('./opds:price',@namespaces)
|
89
91
|
if oprice
|
90
92
|
price=text(oprice)
|
@@ -151,10 +153,14 @@ module OPDS
|
|
151
153
|
|
152
154
|
# @return [Array] acquisition link subset
|
153
155
|
def acquisition_links
|
156
|
+
acq=[]
|
154
157
|
rel_start='http://opds-spec.org/acquisition'
|
155
|
-
|
156
|
-
k[0,rel_start.size]
|
157
|
-
|
158
|
+
links.by(:rel).each do |k,lnk|
|
159
|
+
if !k.nil? && k[0,rel_start.size]==rel_start
|
160
|
+
lnk.each {|l| acq.push l}
|
161
|
+
end
|
162
|
+
end
|
163
|
+
acq
|
158
164
|
end
|
159
165
|
|
160
166
|
def inspect
|
data/opds.gemspec
CHANGED
@@ -70,6 +70,10 @@ describe OPDS::OPDSParser do
|
|
70
70
|
it do
|
71
71
|
subject.parse(sample(feed_type)).should have_at_least(1).active_facets
|
72
72
|
end
|
73
|
+
|
74
|
+
it "should have indirect acquisition types" do
|
75
|
+
subject.parse(sample(feed_type)).entries.last.acquisition_links.last.type.size.should == 3
|
76
|
+
end
|
73
77
|
|
74
78
|
|
75
79
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 4
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Benoit Larroque
|