Module: RAWS::S3::Model::InstanceMethods
- Defined in:
- lib/raws/s3/model.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
- #acl ⇒ Object
- #after_delete(response) ⇒ Object
- #after_initialize ⇒ Object
- #after_receive(response) ⇒ Object
- #after_send(response) ⇒ Object
- #before_delete ⇒ Object
- #before_receive ⇒ Object
- #before_send ⇒ Object
- #delete ⇒ Object
- #header ⇒ Object
- #initialize(key, header = nil) ⇒ Object
- #metadata ⇒ Object
- #receive(header = {}, &block) ⇒ Object
- #send(header = {}, &block) ⇒ Object
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
55 56 57 |
# File 'lib/raws/s3/model.rb', line 55 def key @key end |
Instance Method Details
#acl ⇒ Object
70 71 72 |
# File 'lib/raws/s3/model.rb', line 70 def acl self.class.acl @key end |
#after_delete(response) ⇒ Object
111 |
# File 'lib/raws/s3/model.rb', line 111 def after_delete(response); end |
#after_initialize ⇒ Object
109 |
# File 'lib/raws/s3/model.rb', line 109 def after_initialize; end |
#after_receive(response) ⇒ Object
113 |
# File 'lib/raws/s3/model.rb', line 113 def after_receive(response); end |
#after_send(response) ⇒ Object
115 |
# File 'lib/raws/s3/model.rb', line 115 def after_send(response); end |
#before_delete ⇒ Object
110 |
# File 'lib/raws/s3/model.rb', line 110 def before_delete; end |
#before_receive ⇒ Object
112 |
# File 'lib/raws/s3/model.rb', line 112 def before_receive; end |
#before_send ⇒ Object
114 |
# File 'lib/raws/s3/model.rb', line 114 def before_send; end |
#delete ⇒ Object
74 75 76 77 78 |
# File 'lib/raws/s3/model.rb', line 74 def delete before_delete response = self.class.delete_object @key after_delete response end |
#header ⇒ Object
62 63 64 |
# File 'lib/raws/s3/model.rb', line 62 def header @header ||= self.class.head(@key) end |
#initialize(key, header = nil) ⇒ Object
57 58 59 60 |
# File 'lib/raws/s3/model.rb', line 57 def initialize(key, header=nil) @key, @header, @metadata = key, header, nil after_initialize end |
#metadata ⇒ Object
66 67 68 |
# File 'lib/raws/s3/model.rb', line 66 def @metadata ||= RAWS::S3::Metadata.new header end |
#receive(header = {}, &block) ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/raws/s3/model.rb', line 96 def receive(header={}, &block) before_receive ret = self.class.get_object(@key, header) do |request| response = request.send @header = response.header .decode @header response.receive &block response end after_send ret ret end |
#send(header = {}, &block) ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/raws/s3/model.rb', line 80 def send(header={}, &block) before_send if @header @header.merge! header else @header = header end response = self.class.put_object( @key, @header.merge(.encode) ) do |request| request.send &block end after_send response end |