Class: GoodData::UserFilter
- Inherits:
-
MdObject
- Object
- Rest::Object
- Rest::Resource
- MdObject
- GoodData::UserFilter
- Defined in:
- lib/gooddata/models/user_filters/user_filter.rb
Direct Known Subclasses
Constant Summary
Constants inherited from MdObject
MdObject::IDENTIFIERS_CFG, MdObject::MD_OBJ_CTG
Constants included from Mixin::MdIdToUri
Mixin::MdIdToUri::IDENTIFIERS_CFG
Constants included from Mixin::MdObjectIndexer
Mixin::MdObjectIndexer::MD_OBJ_CTG
Constants included from Mixin::MdObjectQuery
Mixin::MdObjectQuery::ERROR_MESSAGE_NO_PROJECT
Instance Attribute Summary
Attributes inherited from Rest::Object
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
-
#delete ⇒ String
Deletes the filter from the server.
-
#expression ⇒ String
Returns the MAQL expression of the filter.
-
#expression=(expression) ⇒ String
Allows to set the MAQL expression of the filter.
- #hash ⇒ Object
-
#initialize(data) ⇒ UserFilter
constructor
A new instance of UserFilter.
-
#level ⇒ Symbol
Returns the level this filter is applied on.
-
#pretty_expression ⇒ String
Returns pretty version of the expression.
-
#related(uri = related_uri) ⇒ GoodData::Project | GoodData::Profile
Returns the the object of this filter is related to.
-
#related_uri ⇒ String
Returns the uri of the object this filter is related to.
-
#uri ⇒ String
Gives you URI of the filter.
-
#uri=(uri) ⇒ String
Allows to set URI of the filter.
-
#variable ⇒ GoodData::Project | GoodData::Profile
Returns the the object of this filter is related to.
Methods inherited from MdObject
#add_tag, #browser_uri, #deprecated, #deprecated=, find_replaceable_values, #get_flag?, #listed?, #production, #production=, #project, #reload!, #remove_tag, replace, #replace, #replace!, replace_bracketed, replace_quoted, #restricted, #restricted=, #save, #save_as, #set_flag, #tag_set, #unlisted, #unlisted=, #validate
Methods included from Mixin::MdIdToUri
Methods included from Mixin::MdObjectIndexer
Methods included from Mixin::MdObjectQuery
#all, #dependency, #dependency?, #query, #usedby, #usedby?, #using, #using?
Methods included from Mixin::MdFinders
#find_by_identifier, #find_by_tag, #find_by_title, #find_first_by_identifier, #find_first_by_title
Methods included from Mixin::MdObjId
Methods included from Mixin::MdGrantees
#change_permission, #grant, #grantees, #revoke
Methods included from Mixin::MdRelations
#dependency, #dependency?, #usedby, #usedby?, #using, #using?
Methods included from Mixin::ObjId
Methods included from Mixin::Links
Methods inherited from Rest::Object
client, default_client, #saved?
Methods included from Mixin::DataPropertyReader
Methods included from Mixin::DataPropertyWriter
Methods included from Mixin::MetaPropertyReader
Methods included from Mixin::MetaPropertyWriter
Methods included from Mixin::MetaGetter
Methods included from Mixin::DataGetter
Methods included from Mixin::RootKeyGetter
Methods included from Mixin::ContentGetter
Constructor Details
#initialize(data) ⇒ UserFilter
Returns a new instance of UserFilter.
9 10 11 12 |
# File 'lib/gooddata/models/user_filters/user_filter.rb', line 9 def initialize(data) @dirty = false @json = GoodData::Helpers.symbolize_keys(data) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
14 15 16 |
# File 'lib/gooddata/models/user_filters/user_filter.rb', line 14 def ==(other) other.class == self.class && other. == && other.expression == expression end |
#delete ⇒ String
Deletes the filter from the server
96 97 98 |
# File 'lib/gooddata/models/user_filters/user_filter.rb', line 96 def delete client.delete(uri) end |
#expression ⇒ String
Returns the MAQL expression of the filter
59 60 61 |
# File 'lib/gooddata/models/user_filters/user_filter.rb', line 59 def expression @json[:expression] end |
#expression=(expression) ⇒ String
Allows to set the MAQL expression of the filter
67 68 69 70 |
# File 'lib/gooddata/models/user_filters/user_filter.rb', line 67 def expression=(expression) @dirty = true @json[:expression] = expression end |
#hash ⇒ Object
19 20 21 |
# File 'lib/gooddata/models/user_filters/user_filter.rb', line 19 def hash [, expression].hash end |
#level ⇒ Symbol
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.
52 53 54 |
# File 'lib/gooddata/models/user_filters/user_filter.rb', line 52 def level @json[:level].to_sym end |
#pretty_expression ⇒ String
Returns pretty version of the expression
89 90 91 |
# File 'lib/gooddata/models/user_filters/user_filter.rb', line 89 def pretty_expression SmallGoodZilla.pretty_print(expression, client: client, project: project) end |
#related(uri = related_uri) ⇒ GoodData::Project | GoodData::Profile
Returns the the object of this filter is related to. It can be either project or a user
33 34 35 36 |
# File 'lib/gooddata/models/user_filters/user_filter.rb', line 33 def (uri = ) return unless uri level == :project ? client.projects(uri) : client.create(GoodData::Profile, client.get(uri)) end |
#related_uri ⇒ String
Returns the uri of the object this filter is related to. It can be either project or a user
26 27 28 |
# File 'lib/gooddata/models/user_filters/user_filter.rb', line 26 def @json[:related] end |
#uri ⇒ String
Gives you URI of the filter
75 76 77 |
# File 'lib/gooddata/models/user_filters/user_filter.rb', line 75 def uri @json[:uri] end |
#uri=(uri) ⇒ String
Allows to set URI of the filter
82 83 84 |
# File 'lib/gooddata/models/user_filters/user_filter.rb', line 82 def uri=(uri) @json[:uri] = uri end |
#variable ⇒ GoodData::Project | GoodData::Profile
Returns the the object of this filter is related to. It can be either project or a user
41 42 43 44 |
# File 'lib/gooddata/models/user_filters/user_filter.rb', line 41 def variable uri = @json[:prompt] GoodData::Variable[uri, client: client, project: project] end |