Class: DynamicsCRM::FetchXml::Entity
- Inherits:
-
Object
- Object
- DynamicsCRM::FetchXml::Entity
- Defined in:
- lib/dynamics_crm/fetch_xml/entity.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#conditions ⇒ Object
readonly
Returns the value of attribute conditions.
-
#link_entities ⇒ Object
readonly
Returns the value of attribute link_entities.
-
#logical_name ⇒ Object
readonly
Returns the value of attribute logical_name.
-
#order_desc ⇒ Object
readonly
Returns the value of attribute order_desc.
-
#order_field ⇒ Object
readonly
Returns the value of attribute order_field.
Instance Method Summary collapse
- #add_attributes(field_names = nil) ⇒ Object
- #add_condition(attribute, operator, value) ⇒ Object
- #has_conditions? ⇒ Boolean
-
#initialize(logical_name, options = {}) ⇒ Entity
constructor
A new instance of Entity.
- #link_entity(logical_name, attributes = {}) ⇒ Object
-
#order(field_name, descending = false) ⇒ Object
<order attribute=“productid” descending=“false” />.
Constructor Details
#initialize(logical_name, options = {}) ⇒ Entity
Returns a new instance of Entity.
8 9 10 11 12 13 14 |
# File 'lib/dynamics_crm/fetch_xml/entity.rb', line 8 def initialize(logical_name, ={}) # options used by LinkEntity subclass @logical_name = logical_name @attributes = [] @link_entities = [] @conditions = [] end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
4 5 6 |
# File 'lib/dynamics_crm/fetch_xml/entity.rb', line 4 def attributes @attributes end |
#conditions ⇒ Object (readonly)
Returns the value of attribute conditions.
6 7 8 |
# File 'lib/dynamics_crm/fetch_xml/entity.rb', line 6 def conditions @conditions end |
#link_entities ⇒ Object (readonly)
Returns the value of attribute link_entities.
6 7 8 |
# File 'lib/dynamics_crm/fetch_xml/entity.rb', line 6 def link_entities @link_entities end |
#logical_name ⇒ Object (readonly)
Returns the value of attribute logical_name.
4 5 6 |
# File 'lib/dynamics_crm/fetch_xml/entity.rb', line 4 def logical_name @logical_name end |
#order_desc ⇒ Object (readonly)
Returns the value of attribute order_desc.
5 6 7 |
# File 'lib/dynamics_crm/fetch_xml/entity.rb', line 5 def order_desc @order_desc end |
#order_field ⇒ Object (readonly)
Returns the value of attribute order_field.
5 6 7 |
# File 'lib/dynamics_crm/fetch_xml/entity.rb', line 5 def order_field @order_field end |
Instance Method Details
#add_attributes(field_names = nil) ⇒ Object
16 17 18 19 |
# File 'lib/dynamics_crm/fetch_xml/entity.rb', line 16 def add_attributes(field_names=nil) @attributes = field_names self end |
#add_condition(attribute, operator, value) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/dynamics_crm/fetch_xml/entity.rb', line 33 def add_condition(attribute, operator, value) @conditions << { attribute: attribute, operator: operator, value: value } self end |
#has_conditions? ⇒ Boolean
42 43 44 |
# File 'lib/dynamics_crm/fetch_xml/entity.rb', line 42 def has_conditions? @conditions.any? end |
#link_entity(logical_name, attributes = {}) ⇒ Object
28 29 30 31 |
# File 'lib/dynamics_crm/fetch_xml/entity.rb', line 28 def link_entity(logical_name, attributes={}) @link_entities << LinkEntity.new(logical_name, attributes) @link_entities.last end |
#order(field_name, descending = false) ⇒ Object
<order attribute=“productid” descending=“false” />
22 23 24 25 26 |
# File 'lib/dynamics_crm/fetch_xml/entity.rb', line 22 def order(field_name, descending=false) @order_field = field_name @order_desc = descending self end |