kosher 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/kosher.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
 
24
24
  {
25
25
  'money' => '~> 3.6.1',
26
- 'structure' => '~> 0.5.0'
26
+ 'structure' => '~> 0.7.0'
27
27
  }.each do |lib, version|
28
28
  s.add_runtime_dependency lib, version
29
29
  end
@@ -0,0 +1,8 @@
1
+ module Kosher
2
+
3
+ # A book author.
4
+ class Author < Structure
5
+ key :name
6
+ key :role
7
+ end
8
+ end
data/lib/kosher/book.rb CHANGED
@@ -2,16 +2,38 @@ module Kosher
2
2
 
3
3
  # A book.
4
4
  #
5
- # A book is offered on many venues and has many offers through those venues.
5
+ # A book is sold on many venues and has many offers through those venues.
6
6
  class Book < Structure
7
- key :isbn
8
- key :asin
9
- key :offers, :type => Array, :default => []
7
+ key :asin
8
+ key :edition
9
+ key :format
10
+ key :images, :type => Hash
11
+ key :isbn
12
+ key :pages, :type => Integer
13
+ key :published_in, :type => Integer
14
+ key :publisher
15
+ key :title
16
+ key :volumes, :type => Integer
17
+ has_many :alternate_versions
18
+ has_many :authors
19
+ has_many :offers
20
+ has_many :related_items
10
21
 
11
- # Returns the best kosher offer or nil if there are none.
22
+ # The best kosher offer.
23
+ #
24
+ # Returns nil if there are no (kosher) offers.
12
25
  def best_kosher_offer
13
26
  offer = offers.sort.first
14
27
  offer && offer.kosher? ? offer : nil
15
28
  end
29
+
30
+ # A full bibliographic description of the book, as in:
31
+ #
32
+ # Chronicle Books, 1991. Hardcover. 1st edition. 2 volumes. 1200 pages.
33
+ #
34
+ # Missing attributes are omitted.
35
+ def description
36
+ # TODO
37
+ end
16
38
  end
17
39
  end
@@ -0,0 +1,9 @@
1
+ module Kosher
2
+
3
+ # An image of a book cover.
4
+ class Image < Structure
5
+ key :height, :type => Integer
6
+ key :url, :type => URI
7
+ key :width, :type => Integer
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module Kosher
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  end
data/lib/kosher.rb CHANGED
@@ -9,10 +9,12 @@ require 'structure/json'
9
9
  require 'kosher/threshold'
10
10
 
11
11
  # Require the models.
12
+ require 'kosher/author'
12
13
  require 'kosher/availability'
13
14
  require 'kosher/book'
14
15
  require 'kosher/condition'
15
16
  require 'kosher/description'
17
+ require 'kosher/image'
16
18
  require 'kosher/item'
17
19
  require 'kosher/location'
18
20
  require 'kosher/offer'
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 3
7
+ - 4
8
8
  - 0
9
- version: 0.3.0
9
+ version: 0.4.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Paper Cavalier
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-05-27 00:00:00 +01:00
17
+ date: 2011-06-01 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -72,9 +72,9 @@ dependencies:
72
72
  - !ruby/object:Gem::Version
73
73
  segments:
74
74
  - 0
75
- - 5
75
+ - 7
76
76
  - 0
77
- version: 0.5.0
77
+ version: 0.7.0
78
78
  type: :runtime
79
79
  version_requirements: *id004
80
80
  description: Kosher is a somewhat overengineered attempt to abstract bookselling into a set of models.
@@ -93,10 +93,12 @@ files:
93
93
  - Rakefile
94
94
  - kosher.gemspec
95
95
  - lib/kosher.rb
96
+ - lib/kosher/author.rb
96
97
  - lib/kosher/availability.rb
97
98
  - lib/kosher/book.rb
98
99
  - lib/kosher/condition.rb
99
100
  - lib/kosher/description.rb
101
+ - lib/kosher/image.rb
100
102
  - lib/kosher/item.rb
101
103
  - lib/kosher/location.rb
102
104
  - lib/kosher/offer.rb