Class: DropboxApi::Results::CreateFolderBatchResultEntry

Inherits:
Base
  • Object
show all
Defined in:
lib/dropbox_api/results/create_folder_batch_result_entry.rb

Class Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

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

Class Method Details

.new(result_data) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/dropbox_api/results/create_folder_batch_result_entry.rb', line 4

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