titlepage 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/examples/titlepage.rb +2 -2
- data/lib/titlepage/utils.rb +19 -0
- metadata +2 -2
data/Rakefile
CHANGED
data/examples/titlepage.rb
CHANGED
@@ -5,9 +5,9 @@
|
|
5
5
|
# require 'titlepage'
|
6
6
|
require File.dirname(__FILE__) + '/../lib/titlepage'
|
7
7
|
|
8
|
-
TitlePage::Client.open("
|
8
|
+
TitlePage::Client.open("rba303", "ra1nb0Wb") do |tp|
|
9
9
|
|
10
|
-
puts tp.first("0091835135").
|
10
|
+
puts tp.first("0091835135").to_yaml
|
11
11
|
sleep 3
|
12
12
|
puts tp.all("1741146712").inspect
|
13
13
|
|
data/lib/titlepage/utils.rb
CHANGED
@@ -269,5 +269,24 @@ module TitlePage
|
|
269
269
|
|
270
270
|
product
|
271
271
|
end
|
272
|
+
|
273
|
+
# return a simple hash representation of this product
|
274
|
+
#
|
275
|
+
def to_hash
|
276
|
+
{
|
277
|
+
:supplier => self.supply_detail.supplier_name,
|
278
|
+
:title => self.title.title_text,
|
279
|
+
:ean => self.product_identifiers.first.id_value,
|
280
|
+
:price => self.supply_detail.price.price_amount.to_s("F").to_f,
|
281
|
+
:availability => self.supply_detail.product_availability,
|
282
|
+
:contributors => self.contributors.collect { |c| c.person_name_inverted }
|
283
|
+
}
|
284
|
+
end
|
285
|
+
|
286
|
+
# return a simple YAML representation of this product
|
287
|
+
#
|
288
|
+
def to_yaml
|
289
|
+
YAML.dump(to_hash)
|
290
|
+
end
|
272
291
|
end
|
273
292
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: titlepage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Healy
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-07-28 00:00:00 +10:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|