Class: Inforouter::PropertySet
- Defined in:
- lib/inforouter/property_set.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Property set name.
-
#rows ⇒ Object
Array of
Inforouter::PropertyRows.
Class Method Summary collapse
-
.to_xml(property_sets) ⇒ String
<Propertysets> <propertyset Name=“LETTER”> <propertyrow RowNbr=“1” LetterType=“Business” Subject=“Subject 1 - updated subject Lorem dolor sit amet..”/> <propertyrow RowNbr=“2” LetterType=“Business” Subject=“Subject 2 - updated subject ..Lorem Dolor Sit amet..”/> </propertyset> </Propertysets>.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ PropertySet
constructor
A new instance of PropertySet.
Constructor Details
#initialize(params = {}) ⇒ PropertySet
Returns a new instance of PropertySet.
8 9 10 11 |
# File 'lib/inforouter/property_set.rb', line 8 def initialize(params = {}) params = { rows: [] }.merge(params) super params end |
Instance Attribute Details
#name ⇒ Object
Property set name.
4 5 6 |
# File 'lib/inforouter/property_set.rb', line 4 def name @name end |
#rows ⇒ Object
Array of Inforouter::PropertyRows.
6 7 8 |
# File 'lib/inforouter/property_set.rb', line 6 def rows @rows end |
Class Method Details
.to_xml(property_sets) ⇒ String
<Propertysets>
<propertyset Name="LETTER">
<propertyrow RowNbr="1" LetterType="Business" Subject="Subject 1 - updated subject Lorem dolor sit amet.."/>
<propertyrow RowNbr="2" LetterType="Business" Subject="Subject 2 - updated subject ..Lorem Dolor Sit amet.."/>
</propertyset>
</Propertysets>
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/inforouter/property_set.rb', line 21 def self.to_xml(property_sets) builder = Nokogiri::XML::Builder.new do |xml| xml.Propertysets do property_sets.each do |property_set| xml.propertyset(Name: property_set.name) do property_set.rows.each { |row| row.to_xml(xml) } end end end end builder.doc.root.to_xml end |