Sha256: 61a7ffdc4d37694c1caddb57e5e68d53e8cd9dd241f021b3e1ec27972e200449

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

module Fog
  module Parsers
    module Google
      module Storage

        class AccessControlList < Fog::Parsers::Base

          def reset
            @in_entries = false
            @entry = { 'Scope' => {} }
            @response = { 'Owner' => {}, 'AccessControlList' => [] }
          end

          def start_element(name, attrs = [])
            super
            case name
            when 'Entries'
              @in_entries = true
            when 'Scope'
              key, value = attrs.first
              @entry['Scope'][key] = value
            end
          end

          def end_element(name)
            case name
            when 'Entries'
              @in_entries = false
            when 'Entry'
              @response['AccessControlList'] << @entry
              @entry = { 'Scope' => {} }
            when 'DisplayName', 'ID'
              if @in_entries
                @entry['Scope'][name] = value
              else
                @response['Owner'][name] = value
              end
            when 'Permission'
              @entry[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/storage/parsers/google/access_control_list.rb
fog-0.8.1 lib/fog/storage/parsers/google/access_control_list.rb
fog-0.8.0 lib/fog/storage/parsers/google/access_control_list.rb