Class: DropboxApi::Endpoints::Files::GetThumbnailBatch

Inherits:
RpcContent show all
Includes:
OptionsValidator
Defined in:
lib/dropbox_api/endpoints/files/get_thumbnail_batch.rb

Constant Summary collapse

Method =
:post
Path =
"/2/files/get_thumbnail_batch".freeze
ResultType =
DropboxApi::Results::GetThumbnailBatchResult
ErrorType =
DropboxApi::Errors::ThumbnailBatchError

Instance Method Summary collapse

Methods included from OptionsValidator

#validate_options

Methods inherited from RpcContent

#initialize

Methods inherited from Rpc

#build_request, #initialize, #request_body

Methods inherited from Base

add_endpoint

Constructor Details

This class inherits a constructor from DropboxApi::Endpoints::RpcContent

Instance Method Details

#build_entries_params(paths, options) ⇒ Object


31
32
33
34
35
# File 'lib/dropbox_api/endpoints/files/get_thumbnail_batch.rb', line 31

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

#get_thumbnail_batch(paths, options = {}) ⇒ Object

Get a thumbnails for a batch of images.

Parameters:

  • paths (Array<String>)

    The paths to the image files you want thumbnails for.

Options Hash (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.

  • size (:w32h32, :w64h64, :w128h128, :w640h480, :w1024h768)

    The size for the thumbnail image. The default is :w64h64.

  • mode (:strict, :bestfit, :fitone_bestfit)

    How to resize and crop the image to achieve the desired size. The default for this union is strict.


22
23
24
25
26
27
28
29
# File 'lib/dropbox_api/endpoints/files/get_thumbnail_batch.rb', line 22

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