Method: GoodData::ReportDefinition.create_filters_part

Defined in:
lib/gooddata/models/metadata/report_definition.rb

.create_filters_part(filters, options = {}) ⇒ Array<Hash>

Method creates the list of filter representaion suitable for posting on the api. It can currently recognize 2 types of filters. Variable filters and attribute filters. Method for internal usage.

Parameters:

  • (defaults to: {})

    the options hash

Returns:

  • Returns the structure that is stored internally in the report definition and later psted on the API



63
64
65
66
67
68
# File 'lib/gooddata/models/metadata/report_definition.rb', line 63

def create_filters_part(filters, options = {})
  project = options[:project]
  vars = filters.select { |f| f.is_a?(GoodData::Variable) }.map { |v| { expression: "[#{v.uri}]" } }
  category = filters.select { |f| f.is_a?(Array) }.map { |v| GoodData::SmallGoodZilla.create_category_filter(v, project) }
  vars + category
end