Class: Viewpoint::SPWS::Types::DocumentLibrary

Inherits:
List
  • Object
show all
Includes:
Viewpoint::SPWS::Types
Defined in:
lib/viewpoint/spws/types/document_library.rb

Overview

This class represents a Sharepoint List returned from the Lists Web Service with a ServerTemplate id of 101 (DocumentLibrary).

Constant Summary

Constants included from Viewpoint::SPWS::Types

PRIORITY, STATUS

Instance Attribute Summary

Attributes inherited from List

#created, #description, #feature_id, #guid, #modified, #root_folder, #server_template, #title

Instance Method Summary collapse

Methods inherited from List

#add_item!, #delete!, #get_item, #hidden?, #items, #path

Constructor Details

#initialize(ws, xml) ⇒ DocumentLibrary

Returns a new instance of DocumentLibrary.

Parameters:

  • ws (Viewpoint::SPWS::Websvc::List)

    The webservice instance this List spawned from

  • xml (Nokogiri::XML::Element)

    the List element we are building from



27
28
29
30
# File 'lib/viewpoint/spws/types/document_library.rb', line 27

def initialize(ws, xml)
  @copy_ws = Viewpoint::SPWS::Websvc::Copy.new(ws.spcon)
  super
end

Instance Method Details

#add_file!(opts) ⇒ Viewpoint::SPWS::Types::ListItem

Add a Document to this List

Parameters:

  • opts (Hash)

    parameters for this Document

Options Hash (opts):

  • :file (String)

    Path to the file to upload

Returns:



36
37
38
39
40
# File 'lib/viewpoint/spws/types/document_library.rb', line 36

def add_file!(opts)
  raise "Valid file argument required" unless(opts[:file] && File.exists?(opts[:file]))
  fqpath = "#{self.path}/#{File.basename(opts[:file])}"
  @copy_ws.copy_into_items(opts[:file], [fqpath])
end