Class: DropboxApi::Metadata::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/dropbox_api/metadata/resource.rb

Overview

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.

For example, calling Resource.new({".tag" => "file", :name => ...}) will instantiate a File object.

So this could initalize an object of either File, Folder or Deleted.

Class Method Summary collapse

Class Method Details

.new(data) ⇒ Object



12
13
14
# File 'lib/dropbox_api/metadata/resource.rb', line 12

def new(data)
  class_for(data['.tag'].to_sym).new(data)
end