Class: Services::ReverseMatchService
- Inherits:
-
Object
- Object
- Services::ReverseMatchService
- Defined in:
- app/models/services/reverse_match_service.rb
Instance Method Summary collapse
- #add(job) ⇒ Object
- #build_job(type, concept, subject, match_class) ⇒ Object
-
#initialize(host, protocol) ⇒ ReverseMatchService
constructor
A new instance of ReverseMatchService.
Constructor Details
#initialize(host, protocol) ⇒ ReverseMatchService
Returns a new instance of ReverseMatchService.
5 6 7 8 9 10 |
# File 'app/models/services/reverse_match_service.rb', line 5 def initialize(host, protocol) raise ArgumentError if host.blank? raise ArgumentError if protocol.blank? @host = host @protocol = protocol end |
Instance Method Details
#add(job) ⇒ Object
21 22 23 |
# File 'app/models/services/reverse_match_service.rb', line 21 def add(job) Delayed::Job.enqueue(job, queue: 'reverse_matches') end |
#build_job(type, concept, subject, match_class) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'app/models/services/reverse_match_service.rb', line 12 def build_job(type, concept, subject, match_class) raise ArgumentError if type.empty? || concept.nil? || subject.blank? || match_class.blank? referer = root_url(host: @host, protocol: @protocol) object = rdf_url(concept.origin, host: @host, protocol: @protocol) match_classes = Iqvoc::Concept.reverse_match_class_names match_class = match_classes[match_class] ReverseMatchJob.new(type, concept, match_class, subject, object, referer) end |