Sha256: 578f1fcebf3f94951fac357ae6f99c2e02aea79d1ffc17047072fef5686d9a2d

Contents?: true

Size: 793 Bytes

Versions: 5

Compression:

Stored size: 793 Bytes

Contents

module ReportsKit
  class ModelConfiguration
    attr_accessor :aggregations, :contextual_filters, :dimensions, :filters

    def initialize
      self.aggregations = []
      self.contextual_filters = []
      self.dimensions = []
      self.filters = []
    end

    def aggregation(key, expression, properties = {})
      aggregations << { key: key.to_s, expression: expression }.merge(properties).symbolize_keys
    end

    def contextual_filter(key, method)
      contextual_filters << { key: key, method: method }
    end

    def dimension(key, properties)
      dimensions << { key: key.to_s }.merge(properties).symbolize_keys
    end

    def filter(key, type_key, properties)
      filters << { key: key.to_s, type_key: type_key }.merge(properties).symbolize_keys
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
reports_kit-0.7.1 lib/reports_kit/model_configuration.rb
reports_kit-0.7.0 lib/reports_kit/model_configuration.rb
reports_kit-0.5.0 lib/reports_kit/model_configuration.rb
reports_kit-0.4.1 lib/reports_kit/model_configuration.rb
reports_kit-0.4.0 lib/reports_kit/model_configuration.rb