Class: Aranha::Address

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Processor, Scheduling, EacRailsUtils::Models::InequalityQueries
Defined in:
app/models/aranha/address.rb,
app/models/aranha/address/processor.rb,
app/models/aranha/address/scheduling.rb,
app/models/aranha/address/delayed_job.rb

Defined Under Namespace

Modules: Processor, Scheduling Classes: DelayedJob

Constant Summary

Constants included from Scheduling

Scheduling::DEFAULT_PRIORITY

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Scheduling

#allow_retry?, #check_scheduling, #expired?, #init_scheduling, #priority, #schedule?

Methods included from Processor

#processor_configuration

Class Method Details

.sanitize_url(url) ⇒ Object



15
16
17
18
19
20
21
# File 'app/models/aranha/address.rb', line 15

def sanitize_url(url)
  if url.is_a?(Hash)
    ::EacRubyUtils::Yaml.dump(url)
  else
    url.to_s
  end
end

Instance Method Details

#processObject



40
41
42
43
44
45
46
# File 'app/models/aranha/address.rb', line 40

def process
  ActiveRecord::Base.transaction do
    instanciate_processor.process
    self.processed_at = Time.zone.now
    save!
  end
end

#processed?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'app/models/aranha/address.rb', line 48

def processed?
  processed_at.present?
end

#to_sObject



36
37
38
# File 'app/models/aranha/address.rb', line 36

def to_s
  "#{processor}|#{url}"
end