Class: Pansophy::Remote::CreateFile

Inherits:
Object
  • Object
show all
Includes:
Adamantium::Flat
Defined in:
lib/pansophy/remote/create_file.rb

Instance Method Summary collapse

Constructor Details

#initialize(bucket, path, body) ⇒ CreateFile

Returns a new instance of CreateFile.



6
7
8
9
10
# File 'lib/pansophy/remote/create_file.rb', line 6

def initialize(bucket, path, body)
  @bucket   = bucket
  @pathname = Pathname.new(path)
  @body     = body
end

Instance Method Details

#call(options = {}) ⇒ Object



12
13
14
15
# File 'lib/pansophy/remote/create_file.rb', line 12

def call(options = {})
  prevent_overwrite! unless options[:overwrite]
  directory.files.create(key: @pathname.to_s, body: @body.dup)
end