Class: Bl::Wiki
Instance Method Summary collapse
- #edit(id) ⇒ Object
-
#initialize ⇒ Wiki
constructor
A new instance of Wiki.
- #list ⇒ Object
- #show(id) ⇒ Object
Methods included from Requestable
Constructor Details
Instance Method Details
#edit(id) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/bl/wiki.rb', line 31 def edit(id) wiki_content = client.get("#{@url}/#{id}").body.content file = Tempfile.new file.puts(wiki_content) file.close begin file.open system("$EDITOR #{file.path}") new_content = file.read client.patch("#{@url}/#{id}", content: new_content) puts "wiki #{id} updated." ensure file.close file.unlink end end |
#list ⇒ Object
12 13 14 15 16 |
# File 'lib/bl/wiki.rb', line 12 def list client.get(@url, projectIdOrKey: @config[:project_key]).body.each do |w| puts [w.id, w.projectId, w.name, w.updated].join("\t") end end |
#show(id) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/bl/wiki.rb', line 19 def show(id) body = client.get("#{@url}/#{id}").body puts "id: #{body.id}" puts "projectId: #{body.projectId}" puts "name: #{body.name}" puts "updated: #{body.updated}" puts '--' puts 'content:' puts body.content end |