Class: Laximo::Respond::ListQuickDetail

Inherits:
Base
  • Object
show all
Defined in:
lib/laximo/respond/oem/list_quick_detail.rb

Constant Summary

Constants inherited from Base

Base::RESPONSE_LOGIN_RESULT, Base::RESPONSE_RESULT, Base::RESPONSE_SOAP_ERROR

Class Method Summary collapse

Methods inherited from Base

#error, #failure?, #initialize, #result, #result!, #success?

Constructor Details

This class inherits a constructor from Laximo::Respond::Base

Class Method Details

.parsing_result(str) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/laximo/respond/oem/list_quick_detail.rb', line 8

def self.parsing_result(str)

  str.xpath('//ListQuickDetail/Category').inject([]) { |arr, node|

    h = node_to_hash(node) { |h1, n1|

      h1[:unit] = n1.xpath('./Unit').inject([]) { |arr1, n2|

        arr1 << node_to_hash(n2) { |h2, n3|

          h2[:details] = n3.xpath('./Detail').inject([]) { |arr2, n4|

            arr2 << node_to_hash(n4) { |h3, n5|
              h3[:attributes] = nodes_to_hash(n5.xpath('./attribute'))
            }

          }

        }

      }

    }

    arr << h unless h.empty?
    arr

  }

end