Class: ActiveSP::Folder

Inherits:
Item show all
Defined in:
lib/activesp/folder.rb

Instance Attribute Summary

Attributes inherited from Item

#list

Instance Method Summary collapse

Methods inherited from Item

#==, #ID, #absolute_url, #add_attachment, #attachment_urls, #cancel_checkout, #check_in, #check_out, #content, #content=, #content_type, #content_urls, #destroy, #each_attachment, #folder, #id, #initialize, #parent, #save, #uid, #update_attributes, #url

Methods inherited from Base

#attribute, #attribute_type, #attribute_types, #attributes, #has_attribute?, #has_writable_attribute?, #method_missing, #reload, #save, #set_attribute

Constructor Details

This class inherits a constructor from ActiveSP::Item

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ActiveSP::Base

Instance Method Details

#create_document(parameters = {}) ⇒ Object



70
71
72
# File 'lib/activesp/folder.rb', line 70

def create_document(parameters = {})
  @list.create_document(parameters.merge(:folder => absolute_url))
end

#create_folder(parameters = {}) ⇒ Object



57
58
59
# File 'lib/activesp/folder.rb', line 57

def create_folder(parameters = {})
  @list.create_folder(parameters.merge(:folder => absolute_url))
end

#each_document(options = {}, &blk) ⇒ Object



61
62
63
# File 'lib/activesp/folder.rb', line 61

def each_document(options = {}, &blk)
  @list.each_document(options.merge(:folder => self), &blk)
end

#each_folder(options = {}, &blk) ⇒ Object



48
49
50
# File 'lib/activesp/folder.rb', line 48

def each_folder(options = {}, &blk)
  @list.each_folder(options.merge(:folder => self), &blk)
end

#each_item(options = {}, &blk) ⇒ Array<Item>

Returns the list of items in this folder

Parameters:

  • options (Hash) (defaults to: {})

    See List#each_item, :folder option has no effect

Returns:



43
44
45
# File 'lib/activesp/folder.rb', line 43

def each_item(options = {}, &blk)
  @list.each_item(options.merge(:folder => self), &blk)
end

#is_folder?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/activesp/folder.rb', line 36

def is_folder?
  false
end

#item(name) ⇒ Item Also known as: /

Returns the item with the given name

Parameters:

  • name (String)

Returns:



77
78
79
80
81
82
83
84
85
86
87
# File 'lib/activesp/folder.rb', line 77

def item(name)
  query = Builder::XmlMarkup.new.Query do |xml|
    xml.Where do |xml|
      xml.Eq do |xml|
        xml.FieldRef(:Name => "FileLeafRef")
        xml.Value(name, :Type => "Text")
      end
    end
  end
  items(:query => query).first
end

#keyString

See Base#key

Returns:

  • (String)


32
33
34
# File 'lib/activesp/folder.rb', line 32

def key
  encode_key("F", [@list.key, @id])
end

#to_sObject Also known as: inspect



94
95
96
# File 'lib/activesp/folder.rb', line 94

def to_s
  "#<ActiveSP::Folder url=#{url}>"
end