Class RestQuery
In: lib/rally_rest_api/query.rb
Parent: Object

Generate a query string for Rally‘s webservice query interface.

Arguments are:

 type - the type to query for
 args - arguments to the query. Supported values are
 :pagesize => <number> - The number of results per page. Max of 100
 :start => <number> - The record number to start with. Assuming more then page size records.
 :fetch => <boolean> - If this is set to true then entire objects will be returned inside the query result. If set to false (the default) then only object references will be returned.
 :workspace - If not present, then the query will run in the user's default workspace. If present, this should be the RestObject containing the workspace the user wants to search in.
 :project - If not set, or specified as "null" then the "parent project" in the given workspace is used. If set, this should be the RestObject containing the project. Furthermore, if set you may omit the workspace parameter because the workspace will be inherited from the project.
 :project_scope_up - Default is true. In addition to the specified project, include projects above the specified one.
 :project_scope_down - Default is true. In addition to the specified project, include child projects below the current one.
 &block - the query parameters

The query parameters block

The query parameters block is a DSL the specifying the query parameters. Single attribute specifiers are written in prefix notation in the form:

 <operator> <attribute symbol>, <value>

for example

 equal :name, "My Name"

Allowed operators and their corresponding generated query strings are:

   equal              => "="
   not_equal          => "!="
   contains           => "contains"
   greater_than       => ">"
   gt                 => ">"
   less_than          => "<"
   lt                 => "<"
   greater_than_equal => ">="
   gte                => ">="
   less_then_equal    => "<="
   lte                => "<="

Boolean logic.

By default, if more then one query parameter is specified in the block, then those parameters will be ANDed together. For example, if the query parameter block contains the follow expression:

 equal :name, "My Name"
 greater_than :priority, "Fix Immediately"

these expressions will be ANDed together. You may specify explicit AND and OR operators using the and and or operators, which also accept parameter blocks. For example the above expression could also have been written:

 _and_ {
   equal :name, "My Name"
   greater_than :priority, "Fix Immediately"
 }

_or_ works in the same fashion. _and_s and _or_s may be nested as needed. See the test cases for RestQuery for more complex examples

If you have ruport installed, you may also call to_table on a QueryResult to convert the result to a Ruport::Data:Table

Methods

new   next_page   query   to_q  

Attributes

type  [R] 

Public Class methods

Public Instance methods

[Validate]