Sha256: de8a5a0229a2d6420ca5e41a2299b81c1430b06b73e3e712144f24b040be0d57

Contents?: true

Size: 772 Bytes

Versions: 2

Compression:

Stored size: 772 Bytes

Contents

module DropboxApi::Results
  class CreateFolderBatchResultEntry < DropboxApi::Results::Base
    def self.new(result_data)
      case result_data['.tag']
      when 'success'
        DropboxApi::Metadata::Folder.new result_data['metadata']
      when 'failure'
        # At the moment, this is a `CreateFolderEntryError` which is an open
        # union that can only be a `WriteError`. In the future, more errors
        # could be added to the API which means we'd have to implement the
        # actual `CreateFolderEntryError` class.
        DropboxApi::Errors::WriteError
          .build('Folder operation failed', result_data['failure']['path'])
      else
        raise NotImplementedError, "Unknown result type: #{result_data['.tag']}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dropbox_api-0.1.18 lib/dropbox_api/results/create_folder_batch_result_entry.rb
dropbox_api-0.1.17 lib/dropbox_api/results/create_folder_batch_result_entry.rb