Class: Honey::Builder
- Inherits:
-
Object
- Object
- Honey::Builder
- Defined in:
- lib/honey/builder.rb
Instance Attribute Summary collapse
-
#account ⇒ Object
readonly
Returns the value of attribute account.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
Instance Method Summary collapse
- #build(data) ⇒ Object
- #destruct(data) ⇒ Object
-
#initialize(account, password) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(account, password) ⇒ Builder
Returns a new instance of Builder.
5 6 7 8 |
# File 'lib/honey/builder.rb', line 5 def initialize(account, password) @account = account @password = password end |
Instance Attribute Details
#account ⇒ Object (readonly)
Returns the value of attribute account.
3 4 5 |
# File 'lib/honey/builder.rb', line 3 def account @account end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
3 4 5 |
# File 'lib/honey/builder.rb', line 3 def password @password 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.account(account) xml.password(password) data.each_pair do |key, value| xml_pair(xml, key, value) end end end.to_xml.strip end |