module Atlantis

Constants

VERSION

Public Class Methods

app_client() click to toggle source
# File lib/atlantis.rb, line 8
def app_client
  @app_client ||= Atlantis::AppClient.new
end
s3_client() click to toggle source
# File lib/atlantis.rb, line 12
def s3_client
  @s3_client ||= Atlantis::S3Client.new
end
upload(file, attributes={}) click to toggle source
# File lib/atlantis.rb, line 16
def upload file, attributes={}
  attributes[:content_type] ||= MIME::Types.type_for(file).try(:first).try(:content_type) || 'application/octet-stream'
  params = app_client.prepare file, attributes
  attributes = params.delete(:attributes)
  params['Content-Type'] = attributes[:content_type]
  params[:file] = Faraday::UploadIO.new(file, params['Content-Type']) 
  response = s3_client.post params
  app_client.create attributes
end