lib/gooddata/models/metadata/report.rb in gooddata-0.6.53 vs lib/gooddata/models/metadata/report.rb in gooddata-0.6.54
- old
+ new
@@ -70,11 +70,11 @@
else
raise e
end
end
- if result.empty?
+ if result.to_s.empty?
ReportDataResult.new(data: [], top: 0, left: 0)
else
ReportDataResult.from_xtab(result)
end
end
@@ -142,14 +142,20 @@
self
end
# Computes the report and returns the result. If it is not computable returns nil.
#
+ # @option options [Time] :time Force the platform to simutale the result at this time
# @return [GoodData::DataResult] Returns the result
def execute(options = {})
+ time = options[:time]
+
+ report_req = { 'report' => uri }
+ report_req['timestamp'] = time.to_i if time
+
fail 'You have to save the report before executing. If you do not want to do that please use GoodData::ReportDefinition' unless saved?
- result = client.post '/gdc/xtab2/executor3', 'report_req' => { 'report' => uri }
+ result = client.post "/gdc/projects/#{project.pid}/execute", 'report_req' => report_req
GoodData::Report.data_result(result, options.merge(client: client))
end
# Returns true if you can export and object
#
@@ -161,10 +167,10 @@
# Returns binary data of the exported report in a given format. The format can be
# either 'csv', 'xls', 'xlsx' or 'pdf'.
#
# @return [String] Returns data
def export(format, options = {})
- result = client.post('/gdc/xtab2/executor3', 'report_req' => { 'report' => uri })
+ result = client.post("/gdc/projects/#{project.pid}/execute", 'report_req' => { 'report' => uri })
result1 = client.post('/gdc/exporter/executor', :result_req => { :format => format, :result => result })
client.poll_on_code(result1['uri'], options.merge(process: false))
end
# Returns the newest (current version) report definition uri