Module: Atlantis
- Defined in:
- lib/atlantis.rb,
lib/atlantis/version.rb,
lib/atlantis/s3_client.rb,
lib/atlantis/app_client.rb,
lib/atlantis/request_error.rb
Defined Under Namespace
Classes: AppClient, RequestError, S3Client
Constant Summary
collapse
- VERSION =
"0.0.1"
Class Method Summary
collapse
Class Method Details
.s3_client ⇒ Object
12
13
14
|
# File 'lib/atlantis.rb', line 12
def s3_client
@s3_client ||= Atlantis::S3Client.new
end
|
.upload(file, attributes = {}) ⇒ Object
16
17
18
19
20
21
22
23
24
|
# 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
|