Sha256: 49b454893d578b3df6cf8129123843b4f7670f5dc9bc23062f295427b0d832b8
Contents?: true
Size: 686 Bytes
Versions: 8
Compression:
Stored size: 686 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` class SharedLinkMetadata class << self def new(data) class_for(data[".tag"].to_sym).new(data) end private def class_for(tag) case tag when :file DropboxApi::Metadata::FileLinkMetadata when :folder DropboxApi::Metadata::FolderLinkMetadata else raise ArgumentError, "Unable to infer resource type for `#{tag}`" end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems