fassbinder 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/fassbinder.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ['lib']
21
21
 
22
- s.add_dependency('kosher', '~> 0.2.14')
22
+ s.add_dependency('kosher', '~> 0.2.18')
23
23
  s.add_dependency('sucker', '~> 1.4.0')
24
24
  s.add_development_dependency('rspec', '~> 2.5.0')
25
25
  s.add_development_dependency('ruby-debug19', '~> 0.11.6')
@@ -4,6 +4,8 @@ module Fassbinder
4
4
  # be taken absolutely seriously.
5
5
  #
6
6
  class Response
7
+ include Enumerable
8
+
7
9
  def initialize(response, locale)
8
10
  raise InvalidResponseError unless response.valid?
9
11
 
@@ -13,16 +15,8 @@ module Fassbinder
13
15
 
14
16
  # Yields each snapshot to given block.
15
17
  #
16
- def each
17
- @response.each('Item') { |doc| yield parse(doc) }
18
- end
19
-
20
- # Returns an array of snapshots.
21
- #
22
- def to_a
23
- @response.map('Item') do |doc|
24
- parse(doc)
25
- end
18
+ def each(&block)
19
+ @response.each('Item') { |doc| block.call(parse(doc)) }
26
20
  end
27
21
 
28
22
  def errors
@@ -34,7 +28,7 @@ module Fassbinder
34
28
  private
35
29
 
36
30
  def parse(doc)
37
- Kosher::Snapshot.new(
31
+ Kosher::Book.new(
38
32
  'amazon.' + Sucker::Request::HOSTS[@locale].match(/[^.]+$/).to_s,
39
33
  nil,
40
34
  doc['ASIN'],
@@ -1,3 +1,3 @@
1
1
  module Fassbinder
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
@@ -32,11 +32,11 @@ module Fassbinder
32
32
  end
33
33
 
34
34
  describe "#to_a" do
35
- it "returns an array of snapshots" do
36
- snapshots = response.to_a
35
+ it "returns an array of books" do
36
+ books = response.to_a
37
37
 
38
- snapshots.count.should eql 19
39
- snapshots.first.should be_a Kosher::Snapshot
38
+ books.count.should eql 19
39
+ books.first.should be_a Kosher::Book
40
40
  end
41
41
  end
42
42
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: fassbinder
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.6
5
+ version: 0.0.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - Paper Cavalier
@@ -21,7 +21,7 @@ dependencies:
21
21
  requirements:
22
22
  - - ~>
23
23
  - !ruby/object:Gem::Version
24
- version: 0.2.14
24
+ version: 0.2.18
25
25
  type: :runtime
26
26
  version_requirements: *id001
27
27
  - !ruby/object:Gem::Dependency