Class: RForce::SoapResponseExpat

Inherits:
Object
  • Object
show all
Includes:
MethodKeys, SoapPullable
Defined in:
lib/rforce/soap_response_expat.rb

Constant Summary

Constants included from SoapPullable

RForce::SoapPullable::SOAP_ENVELOPE

Instance Method Summary collapse

Methods included from MethodKeys

#method_missing, #respond_to_missing?

Methods included from SoapPullable

#convert, #local, #tag_end, #tag_start, #text

Constructor Details

#initialize(content) ⇒ SoapResponseExpat

Returns a new instance of SoapResponseExpat


9
10
11
# File 'lib/rforce/soap_response_expat.rb', line 9

def initialize(content)
  @content = content
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RForce::MethodKeys

Instance Method Details

#parseObject


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/rforce/soap_response_expat.rb', line 13

def parse
  @current_value = nil
  @stack = []
  @parsed = MethodHash.new
  @done = false
  @namespaces = []

  XML::Parser.new.parse(@content) do |type, name, data|
    case type
    when XML::Parser::START_ELEM then
      tag_start name, data
    when XML::Parser::CDATA then
      text data
    when XML::Parser::END_ELEM then
      tag_end name
    end

    break if @done
  end

  @parsed
end