Sha256: 440586f9e867e37f3f03d49caaa66e0abc384a30110bc0d7f9b71d552a7a1525

Contents?: true

Size: 1.7 KB

Versions: 15

Compression:

Stored size: 1.7 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'
require_relative '../../core/rest'
require_relative '../../mixins/is_folder'

require_relative 'metadata'

module GoodData
  class Folder < GoodData::MdObject
    include Mixin::IsFolder

    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('folder', Folder, options)
      end
    end

    def entries
      (self.json['folder']['content']['entries'] || []).pmap do |entry|
        res = case self.json['folder']['content']['type'].first
                when 'fact'
                  GoodData::Fact[entry['link'], :client => self.client, :project => self.project]
                when 'metric'
                  GoodData::Metric[entry['link'], :client => self.client, :project => self.project]
                else
                  GoodData::MdObject[entry['link'], :client => self.client, :project => self.project]
              end
        res
      end
    end

    def type
      self.json['folder']['content']['type'][0]
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
gooddata-0.6.43 lib/gooddata/models/metadata/folder.rb
gooddata-0.6.42 lib/gooddata/models/metadata/folder.rb
gooddata-0.6.41 lib/gooddata/models/metadata/folder.rb
gooddata-0.6.40 lib/gooddata/models/metadata/folder.rb
gooddata-0.6.39 lib/gooddata/models/metadata/folder.rb
gooddata-0.6.38 lib/gooddata/models/metadata/folder.rb
gooddata-0.6.37 lib/gooddata/models/metadata/folder.rb
gooddata-0.6.36 lib/gooddata/models/metadata/folder.rb
gooddata-0.6.35 lib/gooddata/models/metadata/folder.rb
gooddata-0.6.34 lib/gooddata/models/metadata/folder.rb
gooddata-0.6.33 lib/gooddata/models/metadata/folder.rb
gooddata-0.6.32 lib/gooddata/models/metadata/folder.rb
gooddata-0.6.31 lib/gooddata/models/metadata/folder.rb
gooddata-0.6.30 lib/gooddata/models/metadata/folder.rb
gooddata-0.6.29 lib/gooddata/models/metadata/folder.rb