Class: GenericSite
- Inherits:
-
Object
- Object
- GenericSite
- Defined in:
- lib/multistockphoto/generic_site.rb
Overview
++
Direct Known Subclasses
Aldi, Bigstockphoto, Dreamstime, Fotolia, Istockphoto, Panthermedia, Photocase, Zoonar
Constant Summary collapse
- MAX_ERRORS =
3
- SENDLIST =
'sendeliste.dat'
Instance Attribute Summary collapse
-
#max_errors ⇒ Object
Returns the value of attribute max_errors.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#password ⇒ Object
Returns the value of attribute password.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #already_sent_site?(photo, site) ⇒ Boolean
- #heute_schon_gesendet(site) ⇒ Object
-
#initialize(name) ⇒ GenericSite
constructor
A new instance of GenericSite.
- #photos_fuer_heute_uebrig? ⇒ Boolean
-
#photosize_valid?(photo) ⇒ Boolean
Groesse der Datei gueltig fuer die Site, auch in Verbindung mit File-Typ.
Constructor Details
#initialize(name) ⇒ GenericSite
Returns a new instance of GenericSite.
33 34 35 36 37 38 39 40 |
# File 'lib/multistockphoto/generic_site.rb', line 33 def initialize(name) @name = name @max_errors = MAX_ERRORS unless File.exist?(SENDLIST) warn "File #{SENDLIST} does not exist - creating empty file" File.open(SENDLIST,"w"){|file|} end end |
Instance Attribute Details
#max_errors ⇒ Object
Returns the value of attribute max_errors.
28 29 30 |
# File 'lib/multistockphoto/generic_site.rb', line 28 def max_errors @max_errors end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
27 28 29 |
# File 'lib/multistockphoto/generic_site.rb', line 27 def name @name end |
#password ⇒ Object
Returns the value of attribute password.
28 29 30 |
# File 'lib/multistockphoto/generic_site.rb', line 28 def password @password end |
#user ⇒ Object
Returns the value of attribute user.
28 29 30 |
# File 'lib/multistockphoto/generic_site.rb', line 28 def user @user end |
Instance Method Details
#already_sent_site?(photo, site) ⇒ Boolean
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/multistockphoto/generic_site.rb', line 51 def already_sent_site?(photo,site) unless photo.class == Photo raise 'not a Photo object' end unless File.exist?(photo.filename) raise "file #{photo.filename} does not exist" end g = grep(SENDLIST, /#{site}\t#{photo.filename}/) return g.size > 0 end |
#heute_schon_gesendet(site) ⇒ Object
47 48 49 |
# File 'lib/multistockphoto/generic_site.rb', line 47 def heute_schon_gesendet(site) sent_today_site(site) end |
#photos_fuer_heute_uebrig? ⇒ Boolean
42 43 44 45 |
# File 'lib/multistockphoto/generic_site.rb', line 42 def photos_fuer_heute_uebrig? # puts "noch #{total_per_day - sent_today} zu senden" return total_per_day - sent_today > 0 end |
#photosize_valid?(photo) ⇒ Boolean
Groesse der Datei gueltig fuer die Site, auch in Verbindung mit File-Typ
63 64 65 |
# File 'lib/multistockphoto/generic_site.rb', line 63 def photosize_valid?(photo) true end |