Class: Pansophy::Remote::CreateFile
- Inherits:
-
Object
- Object
- Pansophy::Remote::CreateFile
- Includes:
- Adamantium::Flat
- Defined in:
- lib/pansophy/remote/create_file.rb
Constant Summary collapse
- ALLOWED_ATTRS =
%i[ cache_control content_disposition content_encoding content_length content_md5 content_type etag expires last_modified metadata owner storage_class encryption encryption_key version ].freeze
Instance Method Summary collapse
- #call(options = {}) ⇒ Object
-
#initialize(bucket, path, body) ⇒ CreateFile
constructor
A new instance of CreateFile.
Constructor Details
#initialize(bucket, path, body) ⇒ CreateFile
Returns a new instance of CreateFile.
24 25 26 27 28 |
# File 'lib/pansophy/remote/create_file.rb', line 24 def initialize(bucket, path, body) @bucket = bucket @pathname = Pathname.new(path) @body = body end |
Instance Method Details
#call(options = {}) ⇒ Object
30 31 32 33 34 |
# File 'lib/pansophy/remote/create_file.rb', line 30 def call( = {}) prevent_overwrite! unless [:overwrite] file_attributes = .slice(*ALLOWED_ATTRS) directory.files.create(file_attributes.merge(key: @pathname.to_s, body: @body.dup)) end |