Class: XmlConv::Util::Destination

Inherits:
Object
  • Object
show all
Includes:
ODBA::Persistable
Defined in:
lib/xmlconv/util/destination.rb

Constant Summary collapse

STATUS_COMPARABLE =
{
	:pending_pickup	=>	10,
	:picked_up			=>	20,
     :bbmb_ok        =>  20,
	:http_ok				=>	20,
     :ftp_ok         =>  20,
     :sftp_ok        =>  20,
     :mail_ok        =>  20,
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDestination

Returns a new instance of Destination.



43
44
45
# File 'lib/xmlconv/util/destination.rb', line 43

def initialize
	@status = :open
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



16
17
18
# File 'lib/xmlconv/util/destination.rb', line 16

def path
  @path
end

#statusObject

Returns the value of attribute status.



16
17
18
# File 'lib/xmlconv/util/destination.rb', line 16

def status
  @status
end

#uriObject (readonly)

Returns the value of attribute uri.



17
18
19
# File 'lib/xmlconv/util/destination.rb', line 17

def uri
  @uri
end

Class Method Details

.book(str, tmp = nil) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/xmlconv/util/destination.rb', line 27

def Destination.book(str, tmp=nil)
				uri = URI.parse(str)
  tmp = URI.parse(tmp) if tmp
				case uri.scheme.to_s.downcase
				when 'http'
					DestinationHttp.new(uri)
  when 'ftp'
    DestinationFtp.new(uri, tmp)
  when 'sftp'
    DestinationSftp.new(uri)
  when 'mailto'
    DestinationMail.new(uri)
				else
					DestinationDir.new(uri)
				end
end

Instance Method Details

#deliver(delivery) ⇒ Object



46
47
48
# File 'lib/xmlconv/util/destination.rb', line 46

def deliver(delivery)
	raise 'Abstract Method deliver called in Destination'
end

#forget_credentials!Object



57
58
# File 'lib/xmlconv/util/destination.rb', line 57

def forget_credentials!
end

#sanitize(str) ⇒ Object



54
55
56
# File 'lib/xmlconv/util/destination.rb', line 54

def sanitize(str)
  str.to_s.gsub(/[^a-zA-Z0-9 _.]/, '').gsub(' ', '+')
end

#status_comparableObject



51
52
53
# File 'lib/xmlconv/util/destination.rb', line 51

def status_comparable
	self::class::STATUS_COMPARABLE[@status].to_i
end

#update_statusObject



49
50
# File 'lib/xmlconv/util/destination.rb', line 49

def update_status
end