Sha256: 5d82a877a6992d7ec3334c14f9506cc662ac70e5ee3a23d62d0e2bfc346ffbcb

Contents?: true

Size: 984 Bytes

Versions: 15

Compression:

Stored size: 984 Bytes

Contents

module Fog
  module Parsers
    module AWS
      module EC2

        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

15 entries across 15 versions & 2 rubygems

Version Path
fog-0.2.30 lib/fog/aws/parsers/ec2/start_stop_instances.rb
fog-0.2.28 lib/fog/aws/parsers/ec2/start_stop_instances.rb
fog-0.2.27 lib/fog/aws/parsers/ec2/start_stop_instances.rb
fog-0.2.26 lib/fog/aws/parsers/ec2/start_stop_instances.rb
fog-0.2.25 lib/fog/aws/parsers/ec2/start_stop_instances.rb
fog-0.2.24 lib/fog/aws/parsers/ec2/start_stop_instances.rb
tecnh-fog-0.2.23.vpc lib/fog/aws/parsers/ec2/start_stop_instances.rb
fog-0.2.23 lib/fog/aws/parsers/ec2/start_stop_instances.rb
fog-0.2.22 lib/fog/aws/parsers/ec2/start_stop_instances.rb
fog-0.2.21 lib/fog/aws/parsers/ec2/start_stop_instances.rb
fog-0.2.20 lib/fog/aws/parsers/ec2/start_stop_instances.rb
fog-0.2.19 lib/fog/aws/parsers/ec2/start_stop_instances.rb
fog-0.2.18 lib/fog/aws/parsers/ec2/start_stop_instances.rb
fog-0.2.17 lib/fog/aws/parsers/ec2/start_stop_instances.rb
fog-0.2.16 lib/fog/aws/parsers/ec2/start_stop_instances.rb