Sha256: ca8cf22cf9beaf468abe2adce671146683304e2c132966f80bc636b7ea0333bf

Contents?: true

Size: 1.16 KB

Versions: 5

Compression:

Stored size: 1.16 KB

Contents

module GoodData
  class Report < GoodData::MdObject 

    class << self
      def [](id)
        if id == :all
          GoodData.get(GoodData.project.md['query'] + '/reports/')['query']['entries']
        else 
          super
        end
      end
    end

    def results
      content["results"]
    end

    def get_latest_report_definition_uri
      report_result = get_latest_report_result
      report_result.content["reportDefinition"]
    end

    def get_latest_report_definition
      GoodData::MdObject[get_latest_report_definition_uri]
    end

    def get_latest_report_result_uri
      results.last
    end

    def get_latest_report_result
      GoodData::MdObject[get_latest_report_result_uri]
    end

    def execute
      # puts "Executing report #{uri}"
      result = GoodData.post '/gdc/xtab2/executor3', {"report_req" => {"report" => uri}}
      dataResultUri = result["execResult"]["dataResult"]
      result = GoodData.get dataResultUri
      while result["taskState"] && result["taskState"]["status"] == "WAIT" do
         sleep 10
         result = GoodData.get dataResultUri
       end
       ReportDataResult.new(GoodData.get dataResultUri)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gooddata-0.5.11 lib/gooddata/models/report.rb
gooddata-0.5.10 lib/gooddata/models/report.rb
gooddata-0.5.9 lib/gooddata/models/report.rb
gooddata-0.5.8 lib/gooddata/models/report.rb
gooddata-0.5.7 lib/gooddata/models/report.rb