Class: DynamicsCRM::XML::ColumnSet
- Inherits:
-
Array
- Object
- Array
- DynamicsCRM::XML::ColumnSet
- Defined in:
- lib/dynamics_crm/xml/column_set.rb
Instance Method Summary collapse
-
#initialize(column_names = []) ⇒ ColumnSet
constructor
A new instance of ColumnSet.
- #to_xml(options = {}) ⇒ Object
Constructor Details
#initialize(column_names = []) ⇒ ColumnSet
Returns a new instance of ColumnSet.
6 7 8 |
# File 'lib/dynamics_crm/xml/column_set.rb', line 6 def initialize(column_names=[]) super(column_names || []) end |
Instance Method Details
#to_xml(options = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/dynamics_crm/xml/column_set.rb', line 10 def to_xml(={}) namespace = [:namespace] ? [:namespace] + ":" : "" column_set = '' if self.any? column_set = "<b:Columns xmlns:d=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">" self.each do |name| column_set << "\n<d:string>#{name}</d:string>" end column_set << "\n</b:Columns>" end # Really annoying that Retrieve uses columnSet # while QueryExpression uses ColumnSet. tag_name = [:camel_case] ? "ColumnSet" : "columnSet" %Q{<#{namespace}#{tag_name} xmlns:b="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <b:AllColumns>#{self.empty?}</b:AllColumns> #{column_set} </#{namespace}#{tag_name}>} end |