Class: DynamicsCRM::XML::EntityCollection
- Inherits:
-
Object
- Object
- DynamicsCRM::XML::EntityCollection
- Defined in:
- lib/dynamics_crm/xml/entity_collection.rb
Instance Attribute Summary collapse
-
#entities ⇒ Object
Returns the value of attribute entities.
-
#entity_name ⇒ Object
Returns the value of attribute entity_name.
-
#min_active_row_version ⇒ Object
Returns the value of attribute min_active_row_version.
-
#more_records ⇒ Object
Returns the value of attribute more_records.
-
#paging_cookie ⇒ Object
Returns the value of attribute paging_cookie.
-
#total_record_count ⇒ Object
Returns the value of attribute total_record_count.
-
#total_record_count_limit_exceeded ⇒ Object
Returns the value of attribute total_record_count_limit_exceeded.
Instance Method Summary collapse
-
#initialize(xml_document) ⇒ EntityCollection
constructor
A new instance of EntityCollection.
- #to_hash ⇒ Object
- #to_xml(options = {}) ⇒ Object
Constructor Details
#initialize(xml_document) ⇒ EntityCollection
Returns a new instance of EntityCollection.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/dynamics_crm/xml/entity_collection.rb', line 9 def initialize(xml_document) @entities = [] if xml_document xml_document.each_element do |node| attr_name = ::DynamicsCRM::StringUtil.underscore(node.name).to_sym if node.name == "Entities" node.elements.each do |entity_xml| @entities << XML::Entity.from_xml(entity_xml) end elsif self.respond_to?(attr_name) value = node.text ? ::DynamicsCRM::StringUtil.valueOf(node.text.strip) : nil self.send("#{attr_name}=", value) end end end end |
Instance Attribute Details
#entities ⇒ Object
Returns the value of attribute entities.
6 7 8 |
# File 'lib/dynamics_crm/xml/entity_collection.rb', line 6 def entities @entities end |
#entity_name ⇒ Object
Returns the value of attribute entity_name.
6 7 8 |
# File 'lib/dynamics_crm/xml/entity_collection.rb', line 6 def entity_name @entity_name end |
#min_active_row_version ⇒ Object
Returns the value of attribute min_active_row_version.
6 7 8 |
# File 'lib/dynamics_crm/xml/entity_collection.rb', line 6 def min_active_row_version @min_active_row_version end |
#more_records ⇒ Object
Returns the value of attribute more_records.
6 7 8 |
# File 'lib/dynamics_crm/xml/entity_collection.rb', line 6 def more_records @more_records end |
#paging_cookie ⇒ Object
Returns the value of attribute paging_cookie.
6 7 8 |
# File 'lib/dynamics_crm/xml/entity_collection.rb', line 6 def @paging_cookie end |
#total_record_count ⇒ Object
Returns the value of attribute total_record_count.
6 7 8 |
# File 'lib/dynamics_crm/xml/entity_collection.rb', line 6 def total_record_count @total_record_count end |
#total_record_count_limit_exceeded ⇒ Object
Returns the value of attribute total_record_count_limit_exceeded.
6 7 8 |
# File 'lib/dynamics_crm/xml/entity_collection.rb', line 6 def total_record_count_limit_exceeded @total_record_count_limit_exceeded end |
Instance Method Details
#to_hash ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/dynamics_crm/xml/entity_collection.rb', line 28 def to_hash { :entity_name => entity_name, :min_active_row_version => min_active_row_version, :more_records => more_records, :paging_cookie => , :total_record_count => total_record_count, :total_record_count_limit_exceeded => total_record_count_limit_exceeded, :entities => entities } end |
#to_xml(options = {}) ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/dynamics_crm/xml/entity_collection.rb', line 40 def to_xml(={}) [:exclude_root] = true namespace = [:namespace] ? "#{[:namespace]}:" : '' entities_xml = entities.inject("") { |result,entity| result << %Q{<#{namespace}Entity>#{entity.to_xml()}</#{namespace}Entity>} } %Q{<#{namespace}Entities>#{entities_xml}</#{namespace}Entities>} end |