Class: Sem4r::ReportJob
Instance Attribute Summary
Attributes inherited from Base
#adwords, #credentials, #service
Instance Method Summary collapse
-
#initialize(report, job_id) ⇒ ReportJob
constructor
A new instance of ReportJob.
- #status ⇒ Object
- #wait(sleep_interval = 10, &block) ⇒ Object
Methods inherited from Base
Methods included from Sem4rSoap::SoapAttributes
#_from_element, #_to_s, #_to_xml, included
Constructor Details
#initialize(report, job_id) ⇒ ReportJob
Returns a new instance of ReportJob.
27 28 29 30 |
# File 'lib/sem4r/v13_report/report_job.rb', line 27 def initialize(report, job_id) super( report.adwords, report.credentials ) @job_id = job_id end |
Instance Method Details
#status ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/sem4r/v13_report/report_job.rb', line 42 def status = service.report.status(credentials, @job_id) add_counters( .counters ) el = .response.xpath("//getReportJobStatusResponse/getReportJobStatusReturn").first status = el.text status end |
#wait(sleep_interval = 10, &block) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/sem4r/v13_report/report_job.rb', line 32 def wait(sleep_interval = 10, &block) status = nil while status != "Completed" && status != 'Failed' sleep(sleep_interval) status = self.status block.call(self, status) if block end raise Sem4Error, "Report failed" if status == 'Failed' end |