Class: Dynamicloud::API::Criteria::GroupByClause

Inherits:
Condition
  • Object
show all
Defined in:
lib/dynamic_criteria.rb

Overview

This class represents a GroupBy clause.

Author:

  • Eleazar Gomez

Since:

  • 8/23/15

Version:

  • 1.0.0

Constant Summary

Constants inherited from Condition

Condition::ROOT, Condition::WITHOUT

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ GroupByClause

Constructor tha builds this condition

Parameters:

  • attributes

    attributes in group by clause

Since:

  • 8/23/15



388
389
390
# File 'lib/dynamic_criteria.rb', line 388

def initialize(attributes)
  @attributes = attributes
end

Instance Method Details

#to_record_string(parent) ⇒ Object

This method will return a String of this condition

Parameters:

  • parent

    this is the parent of this condition

Returns:

  • a json

Since:

  • 8/23/15



395
396
397
398
399
400
401
402
403
404
# File 'lib/dynamic_criteria.rb', line 395

def to_record_string(parent)
  group_by = '"groupBy": ['

  attrs = ''
  @attributes.each do |attr|
    attrs = attrs + (attrs.length == 0 ? '' : ',') + '"' + attr + '"';
  end

  group_by + attrs + ']'
end