Class: DynamicsCRM::XML::FilterExpression
- Inherits:
-
Object
- Object
- DynamicsCRM::XML::FilterExpression
- Defined in:
- lib/dynamics_crm/xml/filter_expression.rb
Overview
Represents FilterExpression XML fragment.
Instance Attribute Summary collapse
-
#conditions ⇒ Object
Returns the value of attribute conditions.
-
#filter_operator ⇒ Object
Returns the value of attribute filter_operator.
-
#filters ⇒ Object
Returns the value of attribute filters.
Instance Method Summary collapse
- #add_condition(field, operator, value = nil) ⇒ Object
- #add_filter(filter) ⇒ Object
-
#initialize(operator = 'And') ⇒ FilterExpression
constructor
A new instance of FilterExpression.
- #to_xml(options = {}) ⇒ Object
Constructor Details
#initialize(operator = 'And') ⇒ FilterExpression
Returns a new instance of FilterExpression.
7 8 9 10 11 |
# File 'lib/dynamics_crm/xml/filter_expression.rb', line 7 def initialize(operator = 'And') @filter_operator = operator @conditions = [] @filters = [] end |
Instance Attribute Details
#conditions ⇒ Object
Returns the value of attribute conditions.
5 6 7 |
# File 'lib/dynamics_crm/xml/filter_expression.rb', line 5 def conditions @conditions end |
#filter_operator ⇒ Object
Returns the value of attribute filter_operator.
5 6 7 |
# File 'lib/dynamics_crm/xml/filter_expression.rb', line 5 def filter_operator @filter_operator end |
#filters ⇒ Object
Returns the value of attribute filters.
5 6 7 |
# File 'lib/dynamics_crm/xml/filter_expression.rb', line 5 def filters @filters end |
Instance Method Details
#add_condition(field, operator, value = nil) ⇒ Object
13 14 15 |
# File 'lib/dynamics_crm/xml/filter_expression.rb', line 13 def add_condition(field, operator, value=nil) conditions << ConditionExpression.new(field, operator, value) end |
#add_filter(filter) ⇒ Object
17 18 19 |
# File 'lib/dynamics_crm/xml/filter_expression.rb', line 17 def add_filter(filter) filters << filter end |
#to_xml(options = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/dynamics_crm/xml/filter_expression.rb', line 21 def to_xml( = {}) ns = [:namespace] ? [:namespace] : 'b' query_xml = %( <#{ns}:FilterExpression> #{conditions_xml()} <#{ns}:FilterOperator>#{@filter_operator}</#{ns}:FilterOperator> #{filters_xml()} </#{ns}:FilterExpression> ) query_xml end |