Class: GenericSite

Inherits:
Object
  • Object
show all
Defined in:
lib/multistockphoto/generic_site.rb

Direct Known Subclasses

Dreamstime, Fotolia, Photocase, Zoonar

Constant Summary collapse

MAX_ERRORS =
3
SENDLIST =
'sendeliste.dat'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ GenericSite

Returns a new instance of GenericSite.



8
9
10
11
# File 'lib/multistockphoto/generic_site.rb', line 8

def initialize(name)
  @name = name
  @max_errors = MAX_ERRORS
end

Instance Attribute Details

#max_errorsObject

Returns the value of attribute max_errors.



3
4
5
# File 'lib/multistockphoto/generic_site.rb', line 3

def max_errors
  @max_errors
end

#nameObject (readonly)

Returns the value of attribute name.



2
3
4
# File 'lib/multistockphoto/generic_site.rb', line 2

def name
  @name
end

#passwordObject

Returns the value of attribute password.



3
4
5
# File 'lib/multistockphoto/generic_site.rb', line 3

def password
  @password
end

#userObject

Returns the value of attribute user.



3
4
5
# File 'lib/multistockphoto/generic_site.rb', line 3

def user
  @user
end

Instance Method Details

#already_sent_site?(photo, site) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
25
26
27
28
29
30
31
# File 'lib/multistockphoto/generic_site.rb', line 22

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



18
19
20
# File 'lib/multistockphoto/generic_site.rb', line 18

def heute_schon_gesendet(site)
  sent_today_site(site)
end

#photos_fuer_heute_uebrig?Boolean

Returns:

  • (Boolean)


13
14
15
16
# File 'lib/multistockphoto/generic_site.rb', line 13

def photos_fuer_heute_uebrig?
  # puts "noch #{total_per_day - sent_today} zu senden"
  return total_per_day - sent_today > 0
end