class Daimyo::List

Public Class Methods

new() click to toggle source
# File lib/daimyo/list.rb, line 7
def initialize
  @wiki ||= Daimyo::Client.new
end

Public Instance Methods

output_table(wikis) click to toggle source
# File lib/daimyo/list.rb, line 26
def output_table(wikis)
  table = Terminal::Table.new(:headings => ['ID',
                                            'Name',
                                            'Created',
                                            'Updated'],
                              :rows => wikis)
  puts table
end
run(project_id) click to toggle source
# File lib/daimyo/list.rb, line 11
def run(project_id)
  wikis = []
  res = @wiki.list(project_id)
  res.body.each do |w|
    wiki = []
    wiki << w.id
    wiki << w.name
    wiki << w.created
    wiki <<  w.updated
    wikis << wiki
  end

  output_table(wikis)
end