Class: Vzaar::Uploader

Inherits:
Struct
  • Object
show all
Defined in:
lib/vzaar/uploader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#connObject

Returns the value of attribute conn

Returns:

  • (Object)

    the current value of conn



4
5
6
# File 'lib/vzaar/uploader.rb', line 4

def conn
  @conn
end

#optsObject

Returns the value of attribute opts

Returns:

  • (Object)

    the current value of opts



4
5
6
# File 'lib/vzaar/uploader.rb', line 4

def opts
  @opts
end

#signatureObject

Returns the value of attribute signature

Returns:

  • (Object)

    the current value of signature



4
5
6
# File 'lib/vzaar/uploader.rb', line 4

def signature
  @signature
end

Instance Method Details

#processing_paramsObject



21
22
23
# File 'lib/vzaar/uploader.rb', line 21

def processing_params
  opts.merge guid: guid
end

#uploadObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/vzaar/uploader.rb', line 7

def upload
  if link_upload?
    link
  else
    result = s3.upload
    if result[:success]
      opts[:chunks] = result[:total_chunks]
      yield(self) if block_given?
    end
  end
rescue Exception => e
  raise(Vzaar::Error, "Upload error: " + e.message)
end