get_them_all 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,28 +4,23 @@ require 'girl_friday'
4
4
 
5
5
  module GetThemAll
6
6
  class DropboxStorage < Storage
7
-
8
-
9
- # def self.deserialize(data)
10
- # consumer_key, consumer_secret, authorized, token, token_secret, ssl, mode = YAML.load(StringIO.new(data))
11
- # raise ArgumentError, "Must provide a properly serialized #{self.to_s} instance" unless [ consumer_key, consumer_secret, token, token_secret ].all? and authorized == true or authorized == false
7
+
8
+ ##
9
+ # Constructor
12
10
  #
13
- # session = self.new(consumer_key, consumer_secret, :ssl => ssl, :already_authorized => authorized)
14
- # if authorized then
15
- # session.set_access_token token, token_secret
16
- # else
17
- # session.set_request_token token, token_secret
18
- # end
19
- # session.mode = mode if mode
11
+ # @param [Hash] options options
12
+ # @option options [Array] :session The session array
13
+ # @option options [Integer] :timeout The timeout for
14
+ # dropbox requests.
20
15
  #
21
- # return session
22
- # end
23
-
24
16
  def initialize(options = {})
25
17
  super
26
18
 
27
19
  session_data = options.delete(:session)
28
20
  raise "session missing" unless session_data
21
+
22
+ # default to 30s timeout
23
+ @timeout = options.delete(:timeout) || 30
29
24
 
30
25
  consumer_key, consumer_secret, authorized, token, token_secret, ssl, mode = session_data
31
26
 
@@ -80,12 +75,14 @@ module GetThemAll
80
75
  if delay
81
76
  @queue.push(:path => path, :data => data, :deferrable => deferrable)
82
77
  else
78
+ deferrable.timeout(@timeout)
79
+
83
80
  destpath = build_destpath(path)
84
81
  filename, dirname = File.basename(destpath), File.dirname(destpath)
85
82
  @session.upload(StringIO.new(data), dirname, :as => filename)
86
83
  EM::next_tick{ deferrable.succeed }
87
84
  end
88
-
85
+
89
86
  deferrable
90
87
  rescue => err
91
88
  if retries < 4
@@ -1,3 +1,3 @@
1
1
  module GetThemAll
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: get_them_all
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-10-16 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &70096048287860 !ruby/object:Gem::Requirement
16
+ requirement: &70134316437900 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70096048287860
24
+ version_requirements: *70134316437900
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: em-http-request
27
- requirement: &70096048287240 !ruby/object:Gem::Requirement
27
+ requirement: &70134316437280 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.0.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70096048287240
35
+ version_requirements: *70134316437280
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: em-priority-queue
38
- requirement: &70096048286640 !ruby/object:Gem::Requirement
38
+ requirement: &70134316436580 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.0.2
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70096048286640
46
+ version_requirements: *70134316436580
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: hpricot
49
- requirement: &70096048286060 !ruby/object:Gem::Requirement
49
+ requirement: &70134316435960 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.8.1
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70096048286060
57
+ version_requirements: *70134316435960
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: i18n
60
- requirement: &70096048285560 !ruby/object:Gem::Requirement
60
+ requirement: &70134316435400 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70096048285560
68
+ version_requirements: *70134316435400
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: activesupport
71
- requirement: &70096048284900 !ruby/object:Gem::Requirement
71
+ requirement: &70134316434680 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 3.1.0
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70096048284900
79
+ version_requirements: *70134316434680
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: therubyracer
82
- requirement: &70096048284280 !ruby/object:Gem::Requirement
82
+ requirement: &70134316434040 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 0.9.8
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *70096048284280
90
+ version_requirements: *70134316434040
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: dropbox
93
- requirement: &70096048283860 !ruby/object:Gem::Requirement
93
+ requirement: &70134316433500 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *70096048283860
101
+ version_requirements: *70134316433500
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: girl_friday
104
- requirement: &70096048283380 !ruby/object:Gem::Requirement
104
+ requirement: &70134316432900 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,7 +109,7 @@ dependencies:
109
109
  version: '0'
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *70096048283380
112
+ version_requirements: *70134316432900
113
113
  description: Mass downloader useable as standalone or as a library
114
114
  email: []
115
115
  executables:
@@ -153,7 +153,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
153
153
  version: '0'
154
154
  segments:
155
155
  - 0
156
- hash: 2337480508786894492
156
+ hash: 3235419344401135154
157
157
  required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  none: false
159
159
  requirements:
@@ -162,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
162
  version: '0'
163
163
  segments:
164
164
  - 0
165
- hash: 2337480508786894492
165
+ hash: 3235419344401135154
166
166
  requirements: []
167
167
  rubyforge_project: get_them_all
168
168
  rubygems_version: 1.8.11