class ACIrb::Query

Generic Query Interface

Attributes

class_filter[RW]
include_prop[RW]
page[RW]
page_size[RW]
prop_filter[RW]
query_target[RW]
sort_order[RW]
subscribe[RW]
subtree[RW]
subtree_class_filter[RW]
subtree_include[RW]
subtree_prop_filter[RW]

Public Instance Methods

make_options() click to toggle source
# File lib/acirb/query.rb, line 12
def make_options
  query_params = []

  query_params.push('rsp-subtree=%s' % @subtree) \
    if @subtree
  query_params.push('target-subtree-class=%s' % @class_filter) \
    if @class_filter
  query_params.push('query-target=%s' % @query_target) \
    if @query_target
  query_params.push('rsp-subtree-class=%s' % @subtree_class_filter) \
    if @subtree_class_filter
  query_params.push('query-target-filter=%s' % @prop_filter) \
    if @prop_filter
  query_params.push('rsp-subtree-filter=%s' % @subtree_prop_filter) \
    if @subtree_prop_filter
  query_params.push('rsp-subtree-include=%s' % @subtree_include) \
    if @subtree_include
  query_params.push('page-size=%s' % @page_size) \
    if @page_size
  query_params.push('page=%s' % @page) \
    if @page
  query_params.push('order-by=%s' % @sort_order) \
    if @sort_order
  query_params.push('rsp-prop-include=%s' % @include_prop) \
    if @include_prop
  query_params.push('subscription=yes') \
    if @subscribe

  if query_params.length > 0
    '?' + query_params.join('&')
  else
    ''
  end
end