class GoodData::UserFilter

Public Class Methods

new(data) click to toggle source
# File lib/gooddata/models/user_filters/user_filter.rb, line 9
def initialize(data)
  @dirty = false
  @json = GoodData::Helpers.symbolize_keys(data)
end

Public Instance Methods

==(other) click to toggle source
# File lib/gooddata/models/user_filters/user_filter.rb, line 14
def ==(other)
  other.class == self.class && other.related_uri == related_uri && other.expression == expression
end
Also aliased as: eql?
delete() click to toggle source

Deletes the filter from the server

@return [String]

# File lib/gooddata/models/user_filters/user_filter.rb, line 96
def delete
  client.delete(uri)
end
eql?(other)
Alias for: ==
expression() click to toggle source

Returns the MAQL expression of the filter

@return [String] MAQL expression

# File lib/gooddata/models/user_filters/user_filter.rb, line 59
def expression
  @json[:expression]
end
expression=(expression) click to toggle source

Allows to set the MAQL expression of the filter

@param expression [String] MAQL expression @return [String] MAQL expression

# File lib/gooddata/models/user_filters/user_filter.rb, line 67
def expression=(expression)
  @dirty = true
  @json[:expression] = expression
end
hash() click to toggle source
# File lib/gooddata/models/user_filters/user_filter.rb, line 19
def hash
  [related_uri, expression].hash
end
level() click to toggle source

Returns the level this filter is applied on. Either project or user. This is useful for variables where you can have both types. Project level is the default that is applied when user does not have assigned a value. When both user and project value and user value is missing value, you will get ‘uncomputable report’ errors.

@return [Symbol] level on which this filter will be applied

# File lib/gooddata/models/user_filters/user_filter.rb, line 52
def level
  @json[:level].to_sym
end
pretty_expression() click to toggle source

Returns pretty version of the expression

@return [String]

# File lib/gooddata/models/user_filters/user_filter.rb, line 89
def pretty_expression
  SmallGoodZilla.pretty_print(expression, client: client, project: project)
end
uri() click to toggle source

Gives you URI of the filter

@return [String]

# File lib/gooddata/models/user_filters/user_filter.rb, line 75
def uri
  @json[:uri]
end
uri=(uri) click to toggle source

Allows to set URI of the filter

@return [String]

# File lib/gooddata/models/user_filters/user_filter.rb, line 82
def uri=(uri)
  @json[:uri] = uri
end
variable() click to toggle source

Returns the the object of this filter is related to. It can be either project or a user

@return [GoodData::Project | GoodData::Profile] Related object

# File lib/gooddata/models/user_filters/user_filter.rb, line 41
def variable
  uri = @json[:prompt]
  GoodData::Variable[uri, client: client, project: project]
end