Sha256: f902e51cd4710694ceada3ae02a5b5c773fbcf1f49480fe109713024b88aedde

Contents?: true

Size: 1 KB

Versions: 31

Compression:

Stored size: 1 KB

Contents

require 'groupdocs/storage/folder'
require 'groupdocs/storage/file'
require 'groupdocs/storage/package'


module GroupDocs
  module Storage

    #
    # Returns hash of information about user's storage.
    #
    # @example
    #   GroupDocs::Storage.info!
    #   #=> { total_space: "1024 MB", available_space: "1020 MB", document_credits: 5000, available_credits: 4964 }
    #
    # @param [Hash] access Access credentials
    # @option access [String] :client_id
    # @option access [String] :private_key
    # @return [Hash]
    #
    def self.info!(access = {})
      json = Api::Request.new do |request|
        request[:access] = access
        request[:method] = :GET
        request[:path] = '/storage/{{client_id}}'
      end.execute!

      {
        total_space:       "#{json[:total_space] / 1048576} MB",
        available_space:   "#{json[:avail_space] / 1048576} MB",
        document_credits:  json[:doc_credits],
        available_credits: json[:avail_credits]
      }
    end

  end # Storage
end # GroupDocs

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
groupdocs-1.2.11 lib/groupdocs/storage.rb
groupdocs-1.2.10 lib/groupdocs/storage.rb
groupdocs-1.2.9 lib/groupdocs/storage.rb
groupdocs-1.2.8 lib/groupdocs/storage.rb
groupdocs-1.2.7 lib/groupdocs/storage.rb
groupdocs-1.2.6 lib/groupdocs/storage.rb
groupdocs-1.2.3 lib/groupdocs/storage.rb
groupdocs-1.2.2 lib/groupdocs/storage.rb
groupdocs-1.2.1 lib/groupdocs/storage.rb
groupdocs-1.2.0 lib/groupdocs/storage.rb
groupdocs-1.1.0 lib/groupdocs/storage.rb
groupdocs-1.0.0 lib/groupdocs/storage.rb
groupdocs-0.3.11 lib/groupdocs/storage.rb
groupdocs-0.3.10 lib/groupdocs/storage.rb
groupdocs-0.3.9 lib/groupdocs/storage.rb
groupdocs-0.3.8 lib/groupdocs/storage.rb
groupdocs-0.3.7 lib/groupdocs/storage.rb
groupdocs-0.3.6 lib/groupdocs/storage.rb
groupdocs-0.3.5 lib/groupdocs/storage.rb
groupdocs-0.3.0 lib/groupdocs/storage.rb