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 CHANGED
@@ -6,7 +6,7 @@ require 'rake/testtask'
6
6
  require "rake/gempackagetask"
7
7
  require 'spec/rake/spectask'
8
8
 
9
- PKG_VERSION = "1.1.1"
9
+ PKG_VERSION = "1.2.0"
10
10
  PKG_NAME = "titlepage"
11
11
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
12
12
  RUBYFORGE_PROJECT = 'rbook'
@@ -5,9 +5,9 @@
5
5
  # require 'titlepage'
6
6
  require File.dirname(__FILE__) + '/../lib/titlepage'
7
7
 
8
- TitlePage::Client.open("username", "password") do |tp|
8
+ TitlePage::Client.open("rba303", "ra1nb0Wb") do |tp|
9
9
 
10
- puts tp.first("0091835135").inspect
10
+ puts tp.first("0091835135").to_yaml
11
11
  sleep 3
12
12
  puts tp.all("1741146712").inspect
13
13
 
@@ -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.1.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-06-15 00:00:00 +10:00
12
+ date: 2009-07-28 00:00:00 +10:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency