Module: Scales::Worker::Cache::Push

Includes:
Helper::ContentTypes
Defined in:
lib/scales-worker/cache/push.rb

Class Method Summary collapse

Class Method Details

.push(params = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/scales-worker/cache/push.rb', line 9

def push(params = {})
  path = params.delete(:to)
  format, content = params.to_a.first
  raise "Don't know where to push, missing :to => '/a/path' parameter"  if path.nil?
  raise "Unknown format :#{format}"                                     if format.to_content_type.nil?
  
  publish_push(path, format)                                    
  Storage::Sync.set_content(path, content)
  content
end