vacuum 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/vacuum/em.rb +9 -11
  2. data/lib/vacuum/version.rb +1 -1
  3. metadata +4 -10
data/lib/vacuum/em.rb CHANGED
@@ -5,19 +5,17 @@ module Vacuum
5
5
  class Request
6
6
  # Performs an async request.
7
7
  #
8
+ # @param err [Proc] A callback to be executed if request fails
8
9
  # @yield Passes response to given block
9
- def aget(&blk)
10
+ def aget(err = nil, &blk)
10
11
  http = EM::HttpRequest.new(url).get
11
- http.callback { blk.call _response(http) }
12
- http.errback { blk.call _response(http) }
13
-
14
- nil
15
- end
16
-
17
- private
18
-
19
- def _response(http)
20
- Response.new(http.response, http.response_header.status)
12
+ # @todo Consider using a SAX parser that can work on the chunks as they
13
+ # come in?
14
+ # http.stream { |chunk| parse chunk }
15
+ http.callback do
16
+ yield Response.new http.response, http.response_header.status
17
+ end
18
+ http.errback &err if err
21
19
  end
22
20
  end
23
21
  end
@@ -1,3 +1,3 @@
1
1
  module Vacuum
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vacuum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-13 00:00:00.000000000 Z
12
+ date: 2012-03-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: knack
16
- requirement: &70293209254420 !ruby/object:Gem::Requirement
16
+ requirement: &70162196586060 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '1.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70293209254420
24
+ version_requirements: *70162196586060
25
25
  description: Vacuum is a Ruby wrapper to the Amazon Product Advertising API.
26
26
  email:
27
27
  - hakan.ensari@papercavalier.com
@@ -52,18 +52,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
52
52
  - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- segments:
56
- - 0
57
- hash: 1210260838133912310
58
55
  required_rubygems_version: !ruby/object:Gem::Requirement
59
56
  none: false
60
57
  requirements:
61
58
  - - ! '>='
62
59
  - !ruby/object:Gem::Version
63
60
  version: '0'
64
- segments:
65
- - 0
66
- hash: 1210260838133912310
67
61
  requirements: []
68
62
  rubyforge_project:
69
63
  rubygems_version: 1.8.11