Class: API::Node

Inherits:
ActiveResource::Base
  • Object
show all
Defined in:
lib/create_activeresources.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.top_directory_nodesObject



3
4
5
# File 'lib/create_activeresources.rb', line 3

def self.top_directory_nodes
  self.find(:all, :from => :to_directory_nodes)
end

Instance Method Details

#childrenObject



21
22
23
24
# File 'lib/create_activeresources.rb', line 21

def children
  @@children ||= Hash.new
  @@children[path] ||= self.class.find(:all, :from => "/nodes/#{self.id}/children.xml")
end

#entityObject



60
61
62
# File 'lib/create_activeresources.rb', line 60

def entity
  self
end

#full_pathObject



64
65
66
# File 'lib/create_activeresources.rb', line 64

def full_path
  self.class.site.to_s + "@" + path
end

#has_directory_nodes?(user = nil) ⇒ Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/create_activeresources.rb', line 56

def has_directory_nodes?(user=nil)
  self.num_dirs.length > 0
end

#keyword_attributesObject



26
27
28
29
# File 'lib/create_activeresources.rb', line 26

def keyword_attributes
  @@keyword_attributes ||= Hash.new
  @@keyword_attributes[path] ||= self.class.find(:all, :from => "/nodes/#{self.id}/keyword_attributes.xml")
end

#knowledges(*arg) ⇒ Object



83
84
85
# File 'lib/create_activeresources.rb', line 83

def knowledges(*arg)
  []
end

#parentObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/create_activeresources.rb', line 7

def parent
  @@parent ||= Hash.new
  if @@parent.has_key?(path)
    @@parent[path]
  else
    begin
      parent = self.class.find(:one, :from => "/nodes/#{self.id}/parent.xml")
    rescue ActiveResource::ResourceNotFound
      parent = nil
    end
    @@parent[path] = parent
  end
end

#plain_fileObject



86
87
88
# File 'lib/create_activeresources.rb', line 86

def plain_file
  false
end

#referenced_by(*arg) ⇒ Object



80
81
82
# File 'lib/create_activeresources.rb', line 80

def referenced_by(*arg)
  []
end

#references(*arg) ⇒ Object



77
78
79
# File 'lib/create_activeresources.rb', line 77

def references(*arg)
  []
end

#stdname(name) ⇒ Object



68
69
70
71
72
73
74
75
# File 'lib/create_activeresources.rb', line 68

def stdname(name)
  self.keyword_attributes.each{|ka|
    if KeywordAttribute::StdName[name].include?(ka.name)
      return ka
    end
  }
  return nil
end