Sha256: af76fe35a67a6c92f9a033c024d22dd4667e4cf34a0c0128763c6f736f2b1358

Contents?: true

Size: 1.15 KB

Versions: 9

Compression:

Stored size: 1.15 KB

Contents

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


module GroupDocs
  module Storage

    #
    # Changed in release 1.5.8
    #
    # 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],
        :maxViewingFileSize => json[:maxViewingFileSize]
      }
    end

  end # Storage
end # GroupDocs

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
groupdocs-2.1.0 lib/groupdocs/storage.rb
groupdocs-2.0.0 lib/groupdocs/storage.rb
groupdocs-1.9.0 lib/groupdocs/storage.rb
groupdocs-1.8.1 lib/groupdocs/storage.rb
groupdocs-1.8.0 lib/groupdocs/storage.rb
groupdocs-1.7.0 lib/groupdocs/storage.rb
groupdocs-1.6.0 lib/groupdocs/storage.rb
groupdocs-1.5.9 lib/groupdocs/storage.rb
groupdocs-1.5.8 lib/groupdocs/storage.rb