Class: Honey::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/honey/builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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(, password)
  @account = 
  @password = password
end

Instance Attribute Details

#accountObject (readonly)

Returns the value of attribute account.



3
4
5
# File 'lib/honey/builder.rb', line 3

def 
  @account
end

#passwordObject (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.()
      xml.password(password)
      data.each_pair do |key, value|
        xml_pair(xml, key, value)
      end
    end
  end.to_xml.strip
end

#destruct(data) ⇒ Object



22
23
24
# File 'lib/honey/builder.rb', line 22

def destruct(data)
  Nokogiri::XML(data).to_hash
end