Class: Honey::Builder
- Inherits:
-
Object
- Object
- Honey::Builder
- Defined in:
- lib/honey/builder.rb
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #build(data) ⇒ Object
- #destruct(data) ⇒ Object
-
#initialize(username, password) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(username, password) ⇒ Builder
Returns a new instance of Builder.
5 6 7 8 |
# File 'lib/honey/builder.rb', line 5 def initialize(username, password) @username = username @password = password end |
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
3 4 5 |
# File 'lib/honey/builder.rb', line 3 def password @password end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
3 4 5 |
# File 'lib/honey/builder.rb', line 3 def username @username end |
Instance Method Details
#build(data) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/honey/builder.rb', line 10 def build(data) @data = Nokogiri::XML::Builder.new do |xml| xml.HPEnvelope do xml.username(username) xml.password(password) data.each_pair do |key, value| xml_pair(xml, key, value) end end end.to_xml.strip end |