Sha256: 3d4ced5f08554e5b3d9acee5c0ad9239b603963d8ddeb70bd19980b50ac6fa93

Contents?: true

Size: 1.96 KB

Versions: 26

Compression:

Stored size: 1.96 KB

Contents

# encoding: UTF-8
#
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

require_relative '../metadata'

module GoodData
  class Dataset < MdObject
    class << self
      # Method intended to get all objects of that type in a specified project
      #
      # @param options [Hash] the options hash
      # @option options [Boolean] :full if passed true the subclass can decide to pull in full objects. This is desirable from the usability POV but unfortunately has negative impact on performance so it is not the default
      # @return [Array<GoodData::MdObject> | Array<Hash>] Return the appropriate metadata objects or their representation
      def all(options = { :client => GoodData.connection, :project => GoodData.project })
        query('dataSet', Dataset, options)
      end
    end

    # Gives you list of attributes on a dataset
    #
    # @return [Array<GoodData::Attribute>]
    def attributes
      attribute_uris.pmap { |a_uri| project.attributes(a_uri) }
    end

    # Gives you list of attribute uris on a dataset
    #
    # @return [Array<String>]
    def attribute_uris
      content['attributes']
    end

    # Gives you list of facts on a dataset
    #
    # @return [Array<GoodData::Fact>]
    def facts
      fact_uris.pmap { |a_uri| project.facts(a_uri) }
    end

    # Gives you list of fact uris on a dataset
    #
    # @return [Array<String>]
    def fact_uris
      content['facts']
    end

    # Tells you if a dataset is a date dimension. This is done by looking at
    # the attributes and inspecting their identifiers.
    #
    # @return [Boolean]
    def date_dimension?
      attributes.all?(&:date_attribute?) && fact_uris.empty?
    end

    # Delete the data in a dataset
    def synchronize
      project.execute_maql("SYNCHRONIZE {#{identifier}}")
    end
    alias_method :delete_data, :synchronize
  end
end

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
gooddata-edge-0.6.27.edge lib/gooddata/models/metadata/dataset.rb
gooddata-0.6.49 lib/gooddata/models/metadata/dataset.rb
gooddata-0.6.48 lib/gooddata/models/metadata/dataset.rb
gooddata-0.6.47 lib/gooddata/models/metadata/dataset.rb
gooddata-0.6.46 lib/gooddata/models/metadata/dataset.rb
gooddata-0.6.45 lib/gooddata/models/metadata/dataset.rb
gooddata-0.6.44 lib/gooddata/models/metadata/dataset.rb
gooddata-0.6.43 lib/gooddata/models/metadata/dataset.rb
gooddata-0.6.42 lib/gooddata/models/metadata/dataset.rb
gooddata-0.6.41 lib/gooddata/models/metadata/dataset.rb
gooddata-0.6.40 lib/gooddata/models/metadata/dataset.rb
gooddata-0.6.39 lib/gooddata/models/metadata/dataset.rb
gooddata-0.6.38 lib/gooddata/models/metadata/dataset.rb
gooddata-0.6.37 lib/gooddata/models/metadata/dataset.rb
gooddata-0.6.36 lib/gooddata/models/metadata/dataset.rb
gooddata-0.6.35 lib/gooddata/models/metadata/dataset.rb
gooddata-0.6.34 lib/gooddata/models/metadata/dataset.rb
gooddata-0.6.33 lib/gooddata/models/metadata/dataset.rb
gooddata-0.6.32 lib/gooddata/models/metadata/dataset.rb
gooddata-0.6.31 lib/gooddata/models/metadata/dataset.rb