Class: Reactor::ResponseHandler::XmlAttribute

Inherits:
Object
  • Object
show all
Defined in:
lib/reactor/tools/response_handler/xml_attribute.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contextObject

Returns the value of attribute context.



9
10
11
# File 'lib/reactor/tools/response_handler/xml_attribute.rb', line 9

def context
  @context
end

#responseObject

Returns the value of attribute response.



8
9
10
# File 'lib/reactor/tools/response_handler/xml_attribute.rb', line 8

def response
  @response
end

Instance Method Details

#get(response, attribute) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/reactor/tools/response_handler/xml_attribute.rb', line 11

def get(response, attribute)
  @response = response
  @context = context

  name = attribute.name
  type = attribute.type

  method_name = "extract_#{type}"

  self.send(method_name, name)
end

#multiple(elem, attributes) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/reactor/tools/response_handler/xml_attribute.rb', line 23

def multiple(elem, attributes)
  values = {}
  attributes.each do |attribute|
    values[attribute.name] = self.get(elem, attribute)
  end
  values
end