class DearS3::Authentication

Public Instance Methods

connect() click to toggle source

TODO: Give option to upload once without storing credentials.

# File lib/dears3/authentication.rb, line 10
def connect
  # TODO: Raise error if no credentials file available
  ::AWS::S3.new aws_credentials
end
create_credentials_file!(credentials) click to toggle source
# File lib/dears3/authentication.rb, line 15
def create_credentials_file! credentials
  File.open credentials_path, "w" do |f|
    f.write credentials.to_json
    f.write "\n"
  end
end

Private Instance Methods

aws_credentials() click to toggle source
# File lib/dears3/authentication.rb, line 24
def aws_credentials
  ::Oj.load File.read credentials_path
end
credentials_path() click to toggle source
# File lib/dears3/authentication.rb, line 28
def credentials_path
  File.expand_path '~/.aws.json'
end