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'
ResultType =
DropboxApi::Results::GetThumbnailBatchResult
ErrorType =
DropboxApi::Errors::ThumbnailBatchError

Instance Method Summary collapse

Methods included from OptionsValidator

#validate_options

Methods inherited from RpcContent

#build_connection

Methods inherited from Rpc

#build_connection, #build_request, #request_body

Methods inherited from Base

add_endpoint, #initialize

Constructor Details

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

Instance Method Details

#build_entries_params(paths, options) ⇒ Object



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

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.



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

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