class Opener::Webservice::Uploader

Class for uploading KAF documents to Amazon S3.

Public Instance Methods

bucket() click to toggle source

@return [AWS::S3::Bucket]

# File lib/opener/webservice/uploader.rb, line 45
def bucket
  return @bucket ||= s3.buckets[Configuration.output_bucket]
end
create(*args) click to toggle source

@param [Array] args @return [AWS::S3::S3Object]

# File lib/opener/webservice/uploader.rb, line 31
def create(*args)
  return bucket.objects.create(*args)
end
s3() click to toggle source

@return [AWS::S3.new]

# File lib/opener/webservice/uploader.rb, line 38
def s3
  return @s3 ||= AWS::S3.new
end
upload(identifier, document, metadata = {}) click to toggle source

Uploads the given KAF document.

@param [String] identifier @param [String] document @param [Hash] metadata description

@return [AWS::S3::S3Object]

# File lib/opener/webservice/uploader.rb, line 16
def upload(identifier, document, metadata = {})
  object = create(
    "#{identifier}.xml",
    document,
    :metadata     => metadata,
    :content_type => 'application/xml'
  )

  return object
end