class MovieMasher::Destination

A Transfer object used as MovieMasher::Job#destination or Output#destinationrepresenting a remote host ready to accept rendered file(s).

Destination.create {
  type: Type::HTTP,
  host: 'example.com', # http://example.com/cgi-bin/error.cgi?i=123
  path: 'cgi-bin/upload.cgi',
  parameters: {i: '{job.id}'}  # Scalar - Job#id
}

Public Class Methods

create(hash = nil) click to toggle source

Returns a new instance.

# File lib/destination.rb, line 15
def self.create(hash = nil)
  (hash.is_a?(Destination) ? hash : new(hash))
end
create_if(hash) click to toggle source
# File lib/destination.rb, line 18
def self.create_if(hash)
  (hash ? create(hash) : nil)
end
init_hash(hash) click to toggle source
# File lib/destination.rb, line 21
def self.init_hash(hash)
  Transfer.init_hash(hash)
end

Public Instance Methods

directory_files(file) click to toggle source
# File lib/destination.rb, line 37
def directory_files(file)
  transfer_service = Service.uploader(type)
  unless transfer_service
    raise(Error::Configuration, "no upload service #{type}")
  end
  transfer_service.directory_files(file)
end
error?() click to toggle source
# File lib/destination.rb, line 24
def error?
  if name.to_s.include?('/')
    "destination name contains slash - use path instead #{name}"
  end
end
upload(options) click to toggle source
# File lib/destination.rb, line 29
def upload(options)
  transfer_service = Service.uploader(type)
  unless transfer_service
    raise(Error::Configuration, "no upload service #{type}")
  end
  options[:destination] = self
  transfer_service.upload(options)
end