lib/gooddata/models/metadata/report_definition.rb in gooddata-0.6.23 vs lib/gooddata/models/metadata/report_definition.rb in gooddata-0.6.24
- old
+ new
@@ -240,11 +240,11 @@
}
}
uri = "/gdc/app/projects/#{project.pid}/execute"
client.post(uri, data)
end
- data_result(result, opts)
+ GoodData::Report.data_result(result, opts.merge(client: client))
end
def filters
content['filters'].map { |f| f['expression'] }
end
@@ -349,32 +349,8 @@
# Return true if the report definition is a table
#
# @return [Boolean] Return true if report definition is a table
def table?
content['format'] == 'grid'
- end
-
- private
-
- def data_result(result, options = {})
- data_result_uri = result['execResult']['dataResult']
- begin
- result = client.poll_on_response(data_result_uri, options) do |body|
- body && body['taskState'] && body['taskState']['status'] == 'WAIT'
- end
- rescue RestClient::BadRequest => e
- resp = JSON.parse(e.response)
- if GoodData::Helpers.get_path(resp, %w(error component)) == 'MD::DataResult'
- raise GoodData::UncomputableReport
- else
- raise e
- end
- end
-
- if result.empty?
- client.create(ReportDataResult, data: [], top: 0, left: 0, project: project)
- else
- ReportDataResult.from_xtab(result, client: client, project: project)
- end
end
end
end