Class: Sender
- Inherits:
-
Object
- Object
- Sender
- Defined in:
- lib/multistockphoto/sender.rb
Overview
Die Klasse Sender dient als Ausgangspunkt fuer die Applikation. Hier sind zentrale Festlegungen gespeichert bzw. werden Methoden zur Verfuegung gestellt, die nicht einzelne Sites sondern das Senden als ganzes betreffen.
Instance Method Summary collapse
-
#active_sites ⇒ Object
gibt ein Array in Form [:fotolia,:zoonar,:photocase] zurueck.
- #done_dir ⇒ Object
-
#initialize(name) ⇒ Sender
constructor
A new instance of Sender.
-
#sent_to?(p_filename, p_site) ⇒ Boolean
wurde dieses File schon an diese Site gesendet?.
- #upload_dir ⇒ Object
Constructor Details
#initialize(name) ⇒ Sender
Returns a new instance of Sender.
8 9 10 |
# File 'lib/multistockphoto/sender.rb', line 8 def initialize(name) @name = name end |
Instance Method Details
#active_sites ⇒ Object
gibt ein Array in Form [:fotolia,:zoonar,:photocase] zurueck
13 14 15 16 17 18 19 20 |
# File 'lib/multistockphoto/sender.rb', line 13 def active_sites if ENV['MSP_CONFIG'] @config = YAML.load_file(ENV['MSP_CONFIG']) else @config = YAML.load_file("config.yaml") end @config[:active_sites] end |
#done_dir ⇒ Object
26 27 28 |
# File 'lib/multistockphoto/sender.rb', line 26 def done_dir 'done' end |
#sent_to?(p_filename, p_site) ⇒ Boolean
wurde dieses File schon an diese Site gesendet?
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/multistockphoto/sender.rb', line 31 def sent_to?(p_filename,p_site) #TODO: sendeliste = 'sendeliste.dat' #TODO: result = false File.open(sendeliste) {|f| f.each_line {|line| site,photo_file,time = line.chomp.split("\t") if site == p_site.to_s and photo_file == p_filename result = true break end } } result end |
#upload_dir ⇒ Object
22 23 24 |
# File 'lib/multistockphoto/sender.rb', line 22 def upload_dir 'upload' end |