Class: ConfluenceClient

Inherits:
Object
  • Object
show all
Defined in:
lib/confluence.rb

Direct Known Subclasses

PageObject

Instance Method Summary collapse

Constructor Details

#initialize(url, name, password) ⇒ ConfluenceClient

Returns a new instance of ConfluenceClient.



6
7
8
9
10
11
# File 'lib/confluence.rb', line 6

def initialize(url, name, password)
  @@conf_url = url
  @@login    = name
  @@pwd      = password
  @@urn      = 'rest/api/content'
end

Instance Method Details

#create_page_with_no_parent(title, spacekey, content) ⇒ Object



41
42
43
44
45
46
47
48
49
50
# File 'lib/confluence.rb', line 41

def create_page_with_no_parent(title, spacekey, content)

  page_meta = { type:     'create_page_with_no_parent',
                title:    title,
                spacekey: spacekey,
                content:  content }

  create_page(PagePayload.new(page_meta).page_format)

end

#create_page_with_parent(title, spacekey, content, parentid) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/confluence.rb', line 13

def create_page_with_parent(title, spacekey, content, parentid)

  page_meta = { type:     'create_page_with_parent',
                title:    title,
                spacekey: spacekey,
                content:  content,
                parentid: parentid }

  create_page(PagePayload.new(page_meta).page_format)

end

#update_page_with_no_parent(page_obj, spacekey, content) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/confluence.rb', line 52

def update_page_with_no_parent(page_obj, spacekey, content)

  version = page_obj.version + 1

  page_meta = { type:     'update_page_with_no_parent',
                pageid:   page_obj.id,
                title:    page_obj.title,
                spacekey: spacekey,
                content:  content,
                version:  version }

  update_page(PagePayload.new(page_meta).page_format, page_obj.id)

end

#update_page_with_parent(page_obj, parent_page_obj, spacekey, content) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/confluence.rb', line 25

def update_page_with_parent(page_obj, parent_page_obj, spacekey, content)

  version = page_obj.version + 1

  page_meta = { type:     'update_page_with_parent',
                pageid:   page_obj.id,
                parentid: parent_page_obj.id,
                title:    page_obj.title,
                spacekey: spacekey,
                content:  content,
                version:  version }

  update_page(PagePayload.new(page_meta).page_format, page_obj.id)

end