Class: Pageflow::Chart::ScrapedSite

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
ReusableFile
Defined in:
app/models/pageflow/chart/scraped_site.rb

Instance Method Summary collapse

Instance Method Details

#attachments_for_exportObject



89
90
91
# File 'app/models/pageflow/chart/scraped_site.rb', line 89

def attachments_for_export
  [javascript_file, javascript_body_file, stylesheet_file, html_file, csv_file]
end

#csv_urlObject



51
52
53
# File 'app/models/pageflow/chart/scraped_site.rb', line 51

def csv_url
  URI.join(url, 'data.csv').to_s
end

#html_file_urlObject



55
56
57
58
59
60
61
62
# File 'app/models/pageflow/chart/scraped_site.rb', line 55

def html_file_url
  return unless html_file.try(:path)
  if Chart.config.scraped_sites_root_url.present?
    File.join(Chart.config.scraped_sites_root_url, html_file.path)
  else
    html_file.url
  end
end

#publish!Object



77
78
79
80
81
82
83
# File 'app/models/pageflow/chart/scraped_site.rb', line 77

def publish!
  if html_file.present?
    skip_reprocessing_imported_site!
  else
    process!
  end
end

#ready?Boolean

Returns:

  • (Boolean)


73
74
75
# File 'app/models/pageflow/chart/scraped_site.rb', line 73

def ready?
  processed?
end

#retry!Object



85
86
87
# File 'app/models/pageflow/chart/scraped_site.rb', line 85

def retry!
  reprocess!
end

#retryable?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'app/models/pageflow/chart/scraped_site.rb', line 69

def retryable?
  processing_failed?
end

#urlObject

ReusableFile-overrides:



65
66
67
# File 'app/models/pageflow/chart/scraped_site.rb', line 65

def url
  read_attribute(:url)
end