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



12
13
14
15
16
17
18
# File 'app/models/aranha/address.rb', line 12

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

Instance Method Details

#processObject



37
38
39
40
41
42
43
# File 'app/models/aranha/address.rb', line 37

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

#processed?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'app/models/aranha/address.rb', line 45

def processed?
  processed_at.present?
end

#to_sObject



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

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