Sha256: ef5a3580b6d83602cf617f6bd6399c3b8c3385814e7c854ce4de7a7235b9768a

Contents?: true

Size: 976 Bytes

Versions: 1

Compression:

Stored size: 976 Bytes

Contents

module Fog
  module Parsers
    module Compute
      module AWS
        require 'rackspace-fog/aws/parsers/compute/network_interface_parser'

        class DescribeNetworkInterfaces < NetworkInterfaceParser
          def reset
            super
            @response = { 'networkInterfaceSet' => [] }
            @item_level = 0
          end

          def start_element(name, attrs = [])
            super
            case name
            when 'item'
              @item_level += 1
            end
          end

          def end_element(name)
            case name
            when 'requestId'
              @response[name] = value
            when 'item'
              @item_level -= 1
              if @item_level == 0
                @response['networkInterfaceSet'] << @nic
                reset_nic
              else
                super
              end
            else
              super
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rackspace-fog-1.4.2 lib/rackspace-fog/aws/parsers/compute/describe_network_interfaces.rb