Sha256: 68a28ff34cdefa1acf03162c2d05842de12cae436f634f8d5fb9533f419c08bf

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 KB

Contents

module LayerVault
  class Folder < LayerVault::Model
    class << self
      def for(organization, project, folder_path)
        resp = MultiJson.decode(LayerVault.client.folder(organization, project, folder_path))
        instance = build_associations(resp, :folders, :files)
        instance.set_context(organization: organization, project: project, folder_path: folder_path)
      end
    end

    def delete_file(file_name, md5)
      LayerVault.client.delete_file( context.organization, context.project_name, context.folder_path, file_name, md5: md5 )
    end

    def create_file(file_name, options={})
      LayerVault.client.create_file( context.organization, context.project_name, context.folder_path, file_name, options[:md5], options[:local_file_path], options[:content_type] )
    end

    def move_file(file_name, new_folder, new_filename)
      LayerVault.client.move_file( context.organization, context.project_name, context.folder_path, file_name, new_folder: new_folder, new_filename: new_filename)
    end

    def sync_check(file_name, options={})
      LayerVault.client.sync_check( context.organization, context.project_name, context.folder_path, file_name, md5: options[:md5] )
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
layervault-0.1.2 lib/layervault/folder.rb
layervault-0.1.1 lib/layervault/folder.rb
layervault-0.1.0 lib/layervault/folder.rb