Class: Confluence::Space

Inherits:
Record
  • Object
show all
Extended by:
Findable
Defined in:
lib/confluence/space.rb

Overview

A Confluence space.

Constant Summary

BOOKMARKS_PAGE_TITLE =
".bookmarks"

Instance Method Summary (collapse)

Instance Method Details

- (Object) blog_entries



19
20
21
# File 'lib/confluence/space.rb', line 19

def blog_entries
  client.getBlogEntries(self.key).collect {|summary| BlogEntry.new(client.getBlogEntry(summary["id"]))}
end

- (Object) bookmark_page



11
12
13
# File 'lib/confluence/space.rb', line 11

def bookmark_page
  @bookmark_page ||= Page.find :space => self.key, :title => BOOKMARKS_PAGE_TITLE
end

- (Object) bookmarks



15
16
17
# File 'lib/confluence/space.rb', line 15

def bookmarks
  @bookmarks ||= bookmark_page ? bookmark_page.children(Bookmark) : []
end

- (Object) find_page(args)



23
24
25
26
27
# File 'lib/confluence/space.rb', line 23

def find_page(args)
  if args.key? :title
    Page.find :space => self.key, :title => args[:title]
  end
end

- (Object) get_page(args)



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/confluence/space.rb', line 29

def get_page(args)
  args[:parent_title] ||= "Home"

  # check if page already exists
  find_page(args) or begin
    # page does not exist yet, create it
    page = Confluence::Page.new :space => self.key, :title => args[:title]
    
    # look for the parent by title, set parentId if found
    if parent_page = find_page(:title => args[:parent_title])
      page.parent_id = parent_page.page_id 
    end
    
    # store the page  
    page.store
  end
end