Sha256: f35f20b0860a10ed3efd7063290df91955baa38d5a83345aae0f2348a0610365

Contents?: true

Size: 1.48 KB

Versions: 8

Compression:

Stored size: 1.48 KB

Contents

module DropboxApi::Endpoints::Files
  class GetThumbnailBatch < DropboxApi::Endpoints::RpcContent
    Method      = :post
    Path        = "/2/files/get_thumbnail_batch".freeze
    ResultType  = DropboxApi::Results::GetThumbnailBatchResult
    ErrorType   = DropboxApi::Errors::ThumbnailBatchError

    include DropboxApi::OptionsValidator

    # Get a thumbnails for a batch of images.
    #
    # @param paths [Array<String>] The paths to the image files you want thumbnails for.
    # @option options format [:jpeg, :png] The format for the thumbnail image,
    #   `:jpeg` (default) or `:png`. For images that are photos, `:jpeg` should be
    #   preferred, while png is better for screenshots and digital arts. The
    #   default is `:jpeg`.
    # @option options size [:w32h32, :w64h64, :w128h128, :w640h480, :w1024h768]
    #   The size for the thumbnail image. The default is `:w64h64`.
    # @option options mode [:strict, :bestfit, :fitone_bestfit]
    #   How to resize and crop the image to achieve the desired size. The default
    #   for this union is strict.
    add_endpoint :get_thumbnail_batch do |paths, options = {}|
      validate_options([:format, :size, :mode], options)
      options[:format] ||= :jpeg
      options[:size] ||= :w64h64
      options[:mode] ||= :strict

      perform_request :entries => build_entries_params(paths, options)
    end

    def build_entries_params(paths, options)
      paths.map do |path|
        options.merge({ :path => path })
      end
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dropbox_api-0.1.18 lib/dropbox_api/endpoints/files/get_thumbnail_batch.rb
dropbox_api-0.1.17 lib/dropbox_api/endpoints/files/get_thumbnail_batch.rb
dropbox_api-0.1.16 lib/dropbox_api/endpoints/files/get_thumbnail_batch.rb
dropbox_api-0.1.15 lib/dropbox_api/endpoints/files/get_thumbnail_batch.rb
dropbox_api-0.1.14 lib/dropbox_api/endpoints/files/get_thumbnail_batch.rb
dropbox_api-0.1.13 lib/dropbox_api/endpoints/files/get_thumbnail_batch.rb
dropbox_api-0.1.12 lib/dropbox_api/endpoints/files/get_thumbnail_batch.rb
dropbox_api-0.1.11 lib/dropbox_api/endpoints/files/get_thumbnail_batch.rb