Sha256: d6c2242073dd18de0b340c95539d226a2f050510c954a949b6e718ea0beb5f42

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 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 2.2.0
    #
    # 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],
        :total_documents     => json[:total_documents],
        :available_documents => json[:avail_documents],
        :used_documents      => json[:used_documents]
      }
    end

  end # Storage
end # GroupDocs

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
groupdocs-2.2.0 lib/groupdocs/storage.rb