remote_files 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
data/lib/remote_files/file.rb
CHANGED
@@ -3,11 +3,16 @@ module RemoteFiles
|
|
3
3
|
attr_reader :content, :content_type, :identifier, :stored_in, :configuration
|
4
4
|
|
5
5
|
def initialize(identifier, options = {})
|
6
|
+
known_keys = [:identifier, :stored_in, :content_type, :configuration, :content]
|
7
|
+
known_keys.each do |key|
|
8
|
+
options[key] ||= options.delete(key.to_s)
|
9
|
+
end
|
10
|
+
|
6
11
|
@identifier = identifier
|
7
|
-
@stored_in = options[:stored_in] || []
|
12
|
+
@stored_in = (options[:stored_in] || []).map(&:to_sym)
|
8
13
|
@content = options.delete(:content)
|
9
14
|
@content_type = options[:content_type]
|
10
|
-
@configuration = RemoteFiles::CONFIGURATIONS[options[:configuration] || :default]
|
15
|
+
@configuration = RemoteFiles::CONFIGURATIONS[(options[:configuration] || :default).to_sym]
|
11
16
|
@options = options
|
12
17
|
end
|
13
18
|
|
@@ -4,15 +4,16 @@ require 'resque'
|
|
4
4
|
module RemoteFiles
|
5
5
|
class ResqueJob
|
6
6
|
def self.perform(options)
|
7
|
-
|
7
|
+
identifier = options.delete(:identifier) || options.delete("identifier")
|
8
|
+
action = options.delete(:_action) || options.delete("_action")
|
8
9
|
|
9
|
-
file = RemoteFiles::File.new(
|
10
|
+
file = RemoteFiles::File.new(identifier, options)
|
10
11
|
|
11
|
-
case action
|
12
|
+
case action.to_sym
|
12
13
|
when :synchronize
|
13
14
|
file.synchronize!
|
14
15
|
when :delete
|
15
|
-
file.delete_now!
|
16
|
+
file.delete_now!
|
16
17
|
else
|
17
18
|
raise "unknown action #{action.inspect}"
|
18
19
|
end
|
data/lib/remote_files/version.rb
CHANGED
data/lib/remote_files.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remote_files
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -148,7 +148,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
148
148
|
version: '0'
|
149
149
|
segments:
|
150
150
|
- 0
|
151
|
-
hash: -
|
151
|
+
hash: -2157945958237137625
|
152
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
153
|
none: false
|
154
154
|
requirements:
|
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
157
|
version: '0'
|
158
158
|
segments:
|
159
159
|
- 0
|
160
|
-
hash: -
|
160
|
+
hash: -2157945958237137625
|
161
161
|
requirements: []
|
162
162
|
rubyforge_project:
|
163
163
|
rubygems_version: 1.8.24
|