Class: DynamicsCRM::XML::QueryExpression
- Inherits:
-
Object
- Object
- DynamicsCRM::XML::QueryExpression
- Defined in:
- lib/dynamics_crm/xml/query_expression.rb
Overview
Represents QueryExpression XML fragment.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#columns ⇒ Object
Returns the value of attribute columns.
-
#criteria ⇒ Object
Returns the value of attribute criteria.
-
#entity_name ⇒ Object
Returns the value of attribute entity_name.
-
#page_info ⇒ Object
Returns the value of attribute page_info.
Instance Method Summary collapse
-
#initialize(entity_name) ⇒ QueryExpression
constructor
A new instance of QueryExpression.
- #to_xml(options = {}) ⇒ Object
Constructor Details
#initialize(entity_name) ⇒ QueryExpression
Returns a new instance of QueryExpression.
7 8 9 10 |
# File 'lib/dynamics_crm/xml/query_expression.rb', line 7 def initialize(entity_name) @entity_name = entity_name @criteria = Criteria.new end |
Instance Attribute Details
#columns ⇒ Object
Returns the value of attribute columns.
5 6 7 |
# File 'lib/dynamics_crm/xml/query_expression.rb', line 5 def columns @columns end |
#criteria ⇒ Object
Returns the value of attribute criteria.
5 6 7 |
# File 'lib/dynamics_crm/xml/query_expression.rb', line 5 def criteria @criteria end |
#entity_name ⇒ Object
Returns the value of attribute entity_name.
5 6 7 |
# File 'lib/dynamics_crm/xml/query_expression.rb', line 5 def entity_name @entity_name end |
#page_info ⇒ Object
Returns the value of attribute page_info.
5 6 7 |
# File 'lib/dynamics_crm/xml/query_expression.rb', line 5 def page_info @page_info end |
Instance Method Details
#to_xml(options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/dynamics_crm/xml/query_expression.rb', line 12 def to_xml( = {}) namespace = [:namespace] ? [:namespace] : 'b' column_set = columns.is_a?(ColumnSet) ? columns : ColumnSet.new(columns) xml = %( #{column_set.to_xml(namespace: namespace, camel_case: true)} #{criteria.to_xml(namespace: namespace)} <#{namespace}:Distinct>false</#{namespace}:Distinct> <#{namespace}:EntityName>#{entity_name}</#{namespace}:EntityName> <#{namespace}:LinkEntities /> <#{namespace}:Orders /> ) xml << page_info.to_xml if page_info if [:exclude_root].nil? xml = %(<query i:type="b:QueryExpression" xmlns:b="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> #{xml} </query>) end xml end |