Class: SearchEngine

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/search_engine.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.last_submitObject



12
13
14
# File 'app/models/search_engine.rb', line 12

def last_submit
  minimum(:submitted_at)
end

.signatory_folderObject



22
23
24
# File 'app/models/search_engine.rb', line 22

def signatory_folder
  File.join(Rails.root, 'public')
end

.verify_signatories!Object



16
17
18
19
20
# File 'app/models/search_engine.rb', line 16

def verify_signatories!
  all.each do |search_engine|
    search_engine.send(:create_signatory_file) unless search_engine.has_signatory_file?
  end
end

Instance Method Details

#has_signatory_file?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'app/models/search_engine.rb', line 41

def has_signatory_file?
  signatory_file_name && File.exists?(signatory_file_name)
end

#signatory_file_nameObject



37
38
39
# File 'app/models/search_engine.rb', line 37

def signatory_file_name
  verification_file && !verification_file.blank? && File.join(signatory_folder, verification_file )
end

#signatory_folderObject



33
34
35
# File 'app/models/search_engine.rb', line 33

def signatory_folder
  self.class.signatory_folder
end

#submitObject



27
28
29
30
31
# File 'app/models/search_engine.rb', line 27

def submit
  if status = Cms::SitemapSubmitter.submit(self)
    self.update_attributes(:submitted_at => Time.now, :last_status => status)
  end
end