Sha256: bad8aa27a74c53efe0e92e6197241191c0465b07ef3d843680c48f5d9d2ba4b2

Contents?: true

Size: 985 Bytes

Versions: 3

Compression:

Stored size: 985 Bytes

Contents

module Fog
  module Parsers
    module AWS
      module Compute

        class StartStopInstances < Fog::Parsers::Base

          def reset
            @instance = { 'currentState' => {}, 'previousState' => {} }
            @response = { 'instancesSet' => [] }
            @state = nil
          end

          def start_element(name, attrs = [])
            super
            case name
            when 'currentState', 'previousState'
              @state = name
            end
          end

          def end_element(name)
            case name
            when 'code'
              @instance[@state][name] = value.to_s
            when 'instanceId'
              @instance[name] = value
            when 'item'
              @response['instancesSet'] << @instance
              @instance = { 'currentState' => {}, 'previousState' => {} }
            when 'name'
              @instance[@state][name] = value
            end
          end

        end

      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fog-0.8.2 lib/fog/compute/parsers/aws/start_stop_instances.rb
fog-0.8.1 lib/fog/compute/parsers/aws/start_stop_instances.rb
fog-0.8.0 lib/fog/compute/parsers/aws/start_stop_instances.rb