Class: Bl::Wiki
Constant Summary
Constants inherited from Command
Command::ACTIVITY_TYPES, Command::CATEGORY_FIELDS, Command::FILE_FIELDS, Command::GIT_REPO_FIELDS, Command::ISSUES_PARAMS, Command::ISSUE_BASE_ATTRIBUTES, Command::ISSUE_FIELDS, Command::MILESTONE_FIELDS, Command::MILESTONE_PARAMS, Command::PROJECT_FIELDS, Command::PROJECT_PARAMS, Command::ROLES, Command::SPACE_DISK_USAGE, Command::SPACE_DISK_USAGE_DETAILS_FIELDS, Command::SPACE_FIELDS, Command::SPACE_NOTIFICATION_FIELDS, Command::TYPE_COLORS, Command::USER_FIELDS, Command::USER_PARAMS, Command::WATCHINGS_PARAMS, Command::WEBHOOK_FIELDS, Command::WEBHOOK_PARAMS, Command::WIKI_FIELDS
Instance Method Summary collapse
- #edit(id) ⇒ Object
-
#initialize ⇒ Wiki
constructor
A new instance of Wiki.
- #list ⇒ Object
- #show(id) ⇒ Object
Methods included from Formatting
colorize_priority, colorize_status, colorize_type
Methods included from Requestable
Constructor Details
Instance Method Details
#edit(id) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/bl/wiki.rb', line 29 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
11 12 13 14 |
# File 'lib/bl/wiki.rb', line 11 def list res = client.get(@url, projectIdOrKey: @config[:project_key]) puts formatter.render(res.body, fields: WIKI_FIELDS) end |
#show(id) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/bl/wiki.rb', line 17 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 |