Class: SourceMonitor::LogEntry

Inherits:
ApplicationRecord show all
Defined in:
app/models/source_monitor/log_entry.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.ransackable_associations(_auth_object = nil) ⇒ Object



30
31
32
# File 'app/models/source_monitor/log_entry.rb', line 30

def ransackable_associations(_auth_object = nil)
  %w[source item loggable]
end

.ransackable_attributes(_auth_object = nil) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'app/models/source_monitor/log_entry.rb', line 18

def ransackable_attributes(_auth_object = nil)
  %w[
    success
    started_at
    http_status
    scraper_adapter
    error_message
    error_class
    loggable_type
  ]
end

Instance Method Details

#fetch?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'app/models/source_monitor/log_entry.rb', line 35

def fetch?
  loggable_type == FetchLog.sti_name
end

#health_check?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'app/models/source_monitor/log_entry.rb', line 43

def health_check?
  loggable_type == HealthCheckLog.sti_name
end

#log_typeObject



47
48
49
50
51
52
# File 'app/models/source_monitor/log_entry.rb', line 47

def log_type
  return :fetch if fetch?
  return :scrape if scrape?

  :health_check
end

#scrape?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'app/models/source_monitor/log_entry.rb', line 39

def scrape?
  loggable_type == ScrapeLog.sti_name
end