Sha256: 5215cf1316195ce0970a46ed6437b80212f9e9882f5bd8bb9d9ef8a8b9d77b99

Contents?: true

Size: 1.31 KB

Versions: 77

Compression:

Stored size: 1.31 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 'dashboard_item'

module GoodData
  class FilterItem < DashboardItem
    EMPTY_OBJECT = {
      'filterItem' => {
        'positionX' => 0,
        'sizeY' => 200,
        'sizeX' => 300,
        'positionY' => 0
      }
    }

    ASSIGNABLE_MEMBERS = DashboardItem::ASSIGNABLE_MEMBERS + [
      :id,
      :content_id,
      :parent_filters
    ]

    class << self
      def create(tab, item)
        res = GoodData::FilterItem.new(tab, GoodData::Helpers.deep_dup(GoodData::Helpers.stringify_keys(EMPTY_OBJECT)))
        item.each do |k, v|
          res.send("#{k}=", v) if ASSIGNABLE_MEMBERS.include? k
        end
        res
      end
    end

    def initialize(tab, json)
      super
    end

    def id
      data['id']
    end

    def id=(new_id)
      data['id'] = new_id
    end

    def content_id
      data['contentId']
    end

    def content_id=(new_content_id)
      data['contentId'] = new_content_id
    end

    def parent_filters
      data['parentFilters']
    end

    def parent_filters=(new_parent_filters)
      data['parentFilters'] = new_parent_filters
    end
  end
end

Version data entries

77 entries across 77 versions & 1 rubygems

Version Path
gooddata-2.1.0-java lib/gooddata/models/metadata/dashboard/filter_item.rb
gooddata-2.1.0 lib/gooddata/models/metadata/dashboard/filter_item.rb
gooddata-2.0.1-java lib/gooddata/models/metadata/dashboard/filter_item.rb
gooddata-2.0.1 lib/gooddata/models/metadata/dashboard/filter_item.rb
gooddata-2.0.0-java lib/gooddata/models/metadata/dashboard/filter_item.rb
gooddata-2.0.0 lib/gooddata/models/metadata/dashboard/filter_item.rb
gooddata-1.3.6-java lib/gooddata/models/metadata/dashboard/filter_item.rb
gooddata-1.3.6 lib/gooddata/models/metadata/dashboard/filter_item.rb
gooddata-1.3.5-java lib/gooddata/models/metadata/dashboard/filter_item.rb
gooddata-1.3.5 lib/gooddata/models/metadata/dashboard/filter_item.rb
gooddata-1.3.4-java lib/gooddata/models/metadata/dashboard/filter_item.rb
gooddata-1.3.4 lib/gooddata/models/metadata/dashboard/filter_item.rb
gooddata-1.3.3-java lib/gooddata/models/metadata/dashboard/filter_item.rb
gooddata-1.3.3 lib/gooddata/models/metadata/dashboard/filter_item.rb
gooddata-1.3.2-java lib/gooddata/models/metadata/dashboard/filter_item.rb
gooddata-1.3.2 lib/gooddata/models/metadata/dashboard/filter_item.rb
gooddata-1.3.1-java lib/gooddata/models/metadata/dashboard/filter_item.rb
gooddata-1.3.1 lib/gooddata/models/metadata/dashboard/filter_item.rb
gooddata-1.3.0-java lib/gooddata/models/metadata/dashboard/filter_item.rb
gooddata-1.3.0 lib/gooddata/models/metadata/dashboard/filter_item.rb