Class: Dynamicloud::API::Criteria::OrderByClause
- Defined in:
- lib/dynamic_criteria.rb
Overview
This class represents an OrderBy clause
Constant Summary
Constants inherited from Condition
Condition::ROOT, Condition::WITHOUT
Instance Attribute Summary collapse
Class Method Summary collapse
-
.asc(attribute) ⇒ Object
Build an orderBy clause using asc flag.
-
.desc(attribute) ⇒ Object
Build an orderBy clause using desc flag.
Instance Method Summary collapse
-
#to_record_string(parent) ⇒ Object
This method will return a String of this condition.
Instance Attribute Details
#asc ⇒ Object
413 414 415 |
# File 'lib/dynamic_criteria.rb', line 413 def asc @asc end |
#attribute ⇒ Object
413 414 415 |
# File 'lib/dynamic_criteria.rb', line 413 def attribute @attribute end |
Class Method Details
.asc(attribute) ⇒ Object
Build an orderBy clause using asc flag
418 419 420 421 422 423 424 |
# File 'lib/dynamic_criteria.rb', line 418 def self.asc(attribute) order = OrderByClause.new order.asc = true order.attribute = attribute order end |
.desc(attribute) ⇒ Object
Build an orderBy clause using desc flag
429 430 431 432 433 434 435 |
# File 'lib/dynamic_criteria.rb', line 429 def self.desc(attribute) order = OrderByClause.new order.asc = false order.attribute = attribute order end |
Instance Method Details
#to_record_string(parent) ⇒ Object
This method will return a String of this condition
440 441 442 |
# File 'lib/dynamic_criteria.rb', line 440 def to_record_string(parent) '"order": "' + attribute + (asc ? ' ASC' : ' DESC') + '"' end |