Sha256: 347ab95af944c787012ca1bca08f21dd0c2ed343fde7b47b743ff4d9ac7b9a3e

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

module GoodData
  class Dashboard < GoodData::MdObject 

    class << self
      def [](id)
        if id == :all
          GoodData.get(GoodData.project.md['query'] + '/projectDashboard/')['query']['entries']
        else 
          super
        end
      end
    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)
      while (x.code == 202) do
        sleep(1)
        uri = JSON.parse(x.body)["asyncTask"]["link"]["poll"]
        x = GoodData.get(uri, :process => false)
      end
      x
    end

    def tabs
       content["tabs"]
    end

    def tabs_ids
      tabs.map {|t| t["identifier"]}
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gooddata-0.5.16 lib/gooddata/models/dashboard.rb
gooddata-0.5.15 lib/gooddata/models/dashboard.rb
gooddata-0.5.14 lib/gooddata/models/dashboard.rb