Class: ConfluenceHelper::Confluence
- Inherits:
-
Object
- Object
- ConfluenceHelper::Confluence
- Defined in:
- lib/confluence_helper.rb
Direct Known Subclasses
Defined Under Namespace
Classes: DeliverablePage
Instance Method Summary collapse
- #deliverables_pages(rootpageid) ⇒ Object
- #find_url_by_title_and_space(spacekey, title) ⇒ Object
- #get_labels_for_each_child_page(rootpageid) ⇒ Object
- #save_page_attachment(spacekey, page_title, attachment_name, destination) ⇒ Object
Instance Method Details
#deliverables_pages(rootpageid) ⇒ Object
62 63 64 65 66 67 68 69 70 |
# File 'lib/confluence_helper.rb', line 62 def deliverables_pages(rootpageid) child_pages_in_space(rootpageid, {:expand => "metadata.labels,body.export_view"} ). each_with_object({}) do |page, hash| hash[page["title"]] = DeliverablePage.new( labels: page.fetch("metadata", {}).fetch("labels", {}).fetch("results",[]).map{|l| l["name"]}, body: page.fetch("body", {}).fetch("export_view", {}).fetch("value", "") ) end end |
#find_url_by_title_and_space(spacekey, title) ⇒ Object
53 54 55 |
# File 'lib/confluence_helper.rb', line 53 def find_url_by_title_and_space(spacekey, title) page_by_title_in_space(spacekey, title, {})["_links"]["self"] end |
#get_labels_for_each_child_page(rootpageid) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/confluence_helper.rb', line 41 def get_labels_for_each_child_page(rootpageid) child_pages_in_space(rootpageid, {:expand => "metadata.labels"} ). each_with_object({}) do |page, hash| hash[page["title"]] = page. fetch("metadata", {}). fetch("labels",{}). fetch("results",[]). map{|l| l["name"]} end end |
#save_page_attachment(spacekey, page_title, attachment_name, destination) ⇒ Object
57 58 59 60 |
# File 'lib/confluence_helper.rb', line 57 def ( spacekey, page_title, , destination ) response = query_rest_api( ( spacekey, page_title, ) ) File.open(destination, 'wb') { |fp| fp.write(response.body) } end |