Class: Seiun::XMLGenerators::JobXML

Inherits:
Base
  • Object
show all
Defined in:
lib/seiun/xml_generators/job_xml.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize, #to_s

Constructor Details

This class inherits a constructor from Seiun::XMLGenerators::Base

Class Method Details

.close_job(callback: nil) ⇒ Object



10
11
12
13
# File 'lib/seiun/xml_generators/job_xml.rb', line 10

def close_job(callback: nil)
  generator = new(callback: callback)
  generator.close_job
end

.create_job(operation, object, ext_field_name: nil, callback: nil) ⇒ Object



5
6
7
8
# File 'lib/seiun/xml_generators/job_xml.rb', line 5

def create_job(operation, object, ext_field_name: nil, callback: nil)
  generator = new(callback: callback)
  generator.create_job(operation, object, ext_field_name: ext_field_name)
end

Instance Method Details

#close_jobObject



26
27
28
29
30
31
# File 'lib/seiun/xml_generators/job_xml.rb', line 26

def close_job
  create_job_info do |jobinfo|
    jobinfo.add_element("state").add_text("Closed")
  end
  to_s
end

#create_job(operation, object, ext_field_name: nil) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/seiun/xml_generators/job_xml.rb', line 16

def create_job(operation, object, ext_field_name: nil)
  create_job_info do |jobinfo|
    jobinfo.add_element("operation").add_text(operation.to_s)
    jobinfo.add_element("object").add_text(object.to_s)
    jobinfo.add_element("externalIdFieldName").add_text(ext_field_name.to_s) if ext_field_name
    jobinfo.add_element("contentType").add_text("XML")
  end
  to_s
end