Sha256: 6d5ede881aea46bc569bd5506547c02854c506581d3b10a54bba55a2fe1bdc8e

Contents?: true

Size: 783 Bytes

Versions: 8

Compression:

Stored size: 783 Bytes

Contents

module DropboxApi::Metadata
  # This class is used as an adapter so we can create an object of the pertinent
  # class when we need to infer the type from the data.
  #
  # This same pattern is used in `DropboxApi::Metadata::Resource`
  #
  # So this could initalize an object of either `ThumbnailBatchResultData`
  # or `ThumbnailError`.
  class ThumbnailBatchResultEntry
    class << self
      def new(data)
        case data[".tag"].to_sym
        when :success
          DropboxApi::Metadata::ThumbnailBatchResultData.new(data)
        when :failure
          DropboxApi::Errors::ThumbnailError.build("Thumbnail generation failed", data["failure"])
        else
          raise NotImplementedError, "Unknown result type: #{data[".tag"]}"
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dropbox_api-0.1.18 lib/dropbox_api/metadata/thumbnail_batch_result_entry.rb
dropbox_api-0.1.17 lib/dropbox_api/metadata/thumbnail_batch_result_entry.rb
dropbox_api-0.1.16 lib/dropbox_api/metadata/thumbnail_batch_result_entry.rb
dropbox_api-0.1.15 lib/dropbox_api/metadata/thumbnail_batch_result_entry.rb
dropbox_api-0.1.14 lib/dropbox_api/metadata/thumbnail_batch_result_entry.rb
dropbox_api-0.1.13 lib/dropbox_api/metadata/thumbnail_batch_result_entry.rb
dropbox_api-0.1.12 lib/dropbox_api/metadata/thumbnail_batch_result_entry.rb
dropbox_api-0.1.11 lib/dropbox_api/metadata/thumbnail_batch_result_entry.rb