Sha256: 1fb85f122026b8ff0fee17bddc1d0a102d96411587560376fce308881d3d586e

Contents?: true

Size: 579 Bytes

Versions: 1

Compression:

Stored size: 579 Bytes

Contents

# frozen_string_literal: true

require "stashify/file"

module Stashify
  class File
    module AWS
      class S3 < Stashify::File
        def initialize(bucket:, path:)
          @bucket = bucket
          super(path: path)
        end

        def contents
          @bucket.object(path).get.body.read
        end

        def write(contents)
          @bucket.object(path).put(body: contents)
        end

        def delete
          @bucket.object(path).delete
        end

        def exists?
          @bucket.object(path).exists?
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stashify-aws-s3-1.1.0 lib/stashify/file/aws/s3.rb