Class: GyomuRuby::AmazonWebService::FileBucket::RichMan

Inherits:
Object
  • Object
show all
Defined in:
lib/gyomu_ruby/amazon_web_service/file_bucket.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bucket) ⇒ RichMan

Returns a new instance of RichMan.



51
52
53
54
55
56
# File 'lib/gyomu_ruby/amazon_web_service/file_bucket.rb', line 51

def initialize(bucket)
  @bucket = bucket
  ::AWS::S3::Bucket.find(@bucket)
rescue ::AWS::S3::NoSuchBucket
  ::AWS::S3::Bucket.create(@bucket)
end

Instance Attribute Details

#bucketObject (readonly)

Returns the value of attribute bucket.



49
50
51
# File 'lib/gyomu_ruby/amazon_web_service/file_bucket.rb', line 49

def bucket
  @bucket
end

Instance Method Details

#delete(key) ⇒ Object



66
67
68
# File 'lib/gyomu_ruby/amazon_web_service/file_bucket.rb', line 66

def delete(key)
  ::AWS::S3::S3Object.delete(key, @bucket) rescue false
end

#get(key) ⇒ Object



62
63
64
# File 'lib/gyomu_ruby/amazon_web_service/file_bucket.rb', line 62

def get(key)
  ::AWS::S3::S3Object.value(key, @bucket) rescue nil
end

#put(key, io) ⇒ Object



58
59
60
# File 'lib/gyomu_ruby/amazon_web_service/file_bucket.rb', line 58

def put(key, io)
  ::AWS::S3::S3Object.store(key, io, @bucket)
end