Class: Plesk::PleskPacket
- Inherits:
-
Object
- Object
- Plesk::PleskPacket
- Defined in:
- lib/plesk.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
Instance Method Summary collapse
- #domain_info ⇒ Object
- #domain_info_for_domain(domain) ⇒ Object
-
#initialize(version = "1.4.1.2") ⇒ PleskPacket
constructor
A new instance of PleskPacket.
- #mailgroup_info(name, id) ⇒ Object
- #mailgroup_set(name, id, mails) ⇒ Object
- #to_xml ⇒ Object
Constructor Details
#initialize(version = "1.4.1.2") ⇒ PleskPacket
Returns a new instance of PleskPacket.
56 57 58 59 60 |
# File 'lib/plesk.rb', line 56 def initialize version="1.4.1.2" @content = Nokogiri::XML::Builder.new do |xml| xml.packet(version: version) end.doc end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
55 56 57 |
# File 'lib/plesk.rb', line 55 def content @content end |
Instance Method Details
#domain_info ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/plesk.rb', line 61 def domain_info doc = @content Nokogiri::XML::Builder.with(doc.at('packet')) do |xml| xml.domain { xml.get { xml.filter xml.dataset { xml.limits xml.prefs } } } end end |
#domain_info_for_domain(domain) ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/plesk.rb', line 75 def domain_info_for_domain domain doc = @content @content=Nokogiri::XML::Builder.with(doc.at('packet')) do |xml| xml.domain { xml.get { xml.filter { xml.domain_name domain } xml.dataset { xml.limits xml.prefs } } } end end |
#mailgroup_info(name, id) ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/plesk.rb', line 91 def mailgroup_info name,id doc = @content @content =Nokogiri::XML::Builder.with(doc.at('packet')) do |xml| xml.mail { xml.get_info { xml.filter { xml.name name xml.domain_id id } xml.group } } end end |
#mailgroup_set(name, id, mails) ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/plesk.rb', line 105 def mailgroup_set name,id,mails doc = @content @content =Nokogiri::XML::Builder.with(doc.at('packet')) do |xml| xml.mail { xml.update { xml.set { xml.filter { xml.domain_id id xml.mailname { xml.name name xml.mailgroup { xml.enabled :true mails.each do |mail| xml.address mail end } } } } } } end end |
#to_xml ⇒ Object
128 129 130 |
# File 'lib/plesk.rb', line 128 def to_xml @content.to_xml end |