Sha256: 8b14f34e5703ff0add639084534d9e298f9323d1b7448bece0c4c7776c90d8c2

Contents?: true

Size: 868 Bytes

Versions: 4

Compression:

Stored size: 868 Bytes

Contents

module Fog
  module Parsers
    module Voxel
      module Compute

        class VoxcloudCreate < Fog::Parsers::Base

          def reset
            @response = { 'device' => {} }
          end

          def start_element(name, attrs = [])
            super

            case name
            when 'err'
              @response['err'] = {
                'code'  => attr_value('code', attrs),
                'msg'   => attr_value('msg', attrs)
              }
            when 'rsp'
              @response['stat'] = attr_value('stat', attrs)
            end
          end

          def end_element(name)
            case name
            when 'id'
              @response['device'][name] = @value
            when 'last_update'
              @response['device'][name] = Time.at(@value.to_i)
            end
          end

        end

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-0.7.2 lib/fog/compute/parsers/voxel/voxcloud_create.rb
fog-0.7.1 lib/fog/compute/parsers/voxel/voxcloud_create.rb
fog-0.7.0 lib/fog/compute/parsers/voxel/voxcloud_create.rb
fog-0.6.0 lib/fog/compute/parsers/voxel/voxcloud_create.rb