Sha256: df289ae83e31b433f7269d00482427ea9347b3f56dbe1a82ce046fb80ddd589b

Contents?: true

Size: 928 Bytes

Versions: 1

Compression:

Stored size: 928 Bytes

Contents

module S3
  class Concerns
    class ObjectsResult < Driver::Model
      def initialize(xml_doc)
        @xml_doc = xml_doc
      end

      def objects
        REXML::XPath.match(@xml_doc, "/ListBucketResult/Contents/Key").map { |b| b.text }
      end

      def full_objects
        REXML::XPath.match(@xml_doc, "/ListBucketResult/Contents").map{|m|
          XmlSimple.xml_in(m.to_s)
        }
      end

      def truncated?
        REXML::XPath.match(@xml_doc, "/ListBucketResult/IsTruncated").map { |b| b.text }.first == 'true'
      end

      def marker
        REXML::XPath.match(@xml_doc, "/ListBucketResult/Marker").map { |b| b.text }.first
      end

      def next_marker
        REXML::XPath.match(@xml_doc, "/ListBucketResult/NextMarker").map { |b| b.text }.first
      end

      def max
        REXML::XPath.match(@xml_doc, "/ListBucketResult/MaxKeys").map { |b| b.text }.first.to_i
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
s3-client-0.0.1 lib/s3/client/model/concerns/objects_result.rb