Module: Picturelife::Ruler

Defined in:
lib/picturelife/ruler.rb

Instance Method Summary collapse

Instance Method Details

#head(file_path) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/picturelife/ruler.rb', line 25

def head(file_path)
  @file_path = file_path
  @signature = get_signature(file_path)
  @filename  = get_filename(file_path)

  ruler('HEAD')
end

#upload(file_path, options = {}, processing_needs = []) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/picturelife/ruler.rb', line 7

def upload(file_path, options = {}, processing_needs = [])
  needs_token!

  @file_path        = file_path
  @signature        = get_signature(file_path)
  @filename         = get_filename(file_path)
  @force            = !! options[:force]
  @options          = options
  @processing_needs = processing_needs

  media_exists || perform_upload

rescue RulerError => e
  (e.code == 519256) ? retry : raise(e)
rescue Timeout::Error, Errno::ECONNRESET
  retry
end