lib/gooddata/models/dashboard.rb in gooddata-0.6.0.pre10 vs lib/gooddata/models/dashboard.rb in gooddata-0.6.0.pre11

- old
+ new

@@ -1,14 +1,16 @@ +require File.join(File.dirname(__FILE__), "metadata") + module GoodData class Dashboard < GoodData::MdObject root_key :projectDashboard class << self def [](id) if id == :all - GoodData.get(GoodData.project.md['query'] + '/projectDashboard/')['query']['entries'] + GoodData.get(GoodData.project.md['query'] + '/projectdashboards/')['query']['entries'] else super end end @@ -68,14 +70,19 @@ Dashboard.new(stuff) end end + def exportable? + true + end + def export(format, options={}) supported_formats = [:pdf] fail "Wrong format provied \"#{format}\". Only supports formats #{supported_formats.join(', ')}" unless supported_formats.include?(format) tab = options[:tab] || "" - x = GoodData.post("/gdc/projects/#{GoodData.project.uri}/clientexport", {"clientExport" => {"url" => "https://secure.gooddata.com/dashboard.html#project=#{GoodData.project.uri}&dashboard=#{uri}&tab=#{tab}&export=1", "name" => title}}, :process => false) + + x = GoodData.post("#{GoodData.project.uri}/clientexport", {"clientExport" => {"url" => "https://secure.gooddata.com/dashboard.html#project=#{GoodData.project.uri}&dashboard=#{uri}&tab=#{tab}&export=1", "name" => title}}, :process => false) while (x.code == 202) do sleep(1) uri = JSON.parse(x.body)["asyncTask"]["link"]["poll"] x = GoodData.get(uri, :process => false) end