Sha256: cf37cf19d8a93f7ed48dad714ece8d04b8dc5a57d54284f4a336119a9d7dbf90

Contents?: true

Size: 1.67 KB

Versions: 9

Compression:

Stored size: 1.67 KB

Contents

# encoding: UTF-8
#
# Copyright (c) 2010-2017 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
      (json['folder']['content']['entries'] || []).pmap do |entry|
        res = case json['folder']['content']['type'].first
              when 'fact'
                GoodData::Fact[entry['link'], :client => client, :project => project]
              when 'metric'
                GoodData::Metric[entry['link'], :client => client, :project => project]
              else
                GoodData::MdObject[entry['link'], :client => client, :project => project]
              end
        res
      end
    end

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gooddata-1.0.2-java lib/gooddata/models/metadata/folder.rb
gooddata-1.0.2 lib/gooddata/models/metadata/folder.rb
gooddata-1.0.1 lib/gooddata/models/metadata/folder.rb
gooddata-1.0.1-java lib/gooddata/models/metadata/folder.rb
gooddata-1.0.0-java lib/gooddata/models/metadata/folder.rb
gooddata-1.0.0 lib/gooddata/models/metadata/folder.rb
gooddata-0.6.54 lib/gooddata/models/metadata/folder.rb
gooddata-0.6.53 lib/gooddata/models/metadata/folder.rb
gooddata-0.6.52 lib/gooddata/models/metadata/folder.rb