Module: Octonaut::Printers::Organizations

Defined in:
lib/octonaut/printers/organizations.rb

Constant Summary collapse

ORG_FIELDS =
{
  "id"         => "ID",
  "created_at" => "JOINED",
  "login"      => "LOGIN",
  "name"       => "NAME",
  "location"   => "LOCATION",
  "blog"       => "URL"
}

Instance Method Summary collapse

Instance Method Details

#ls_orgs(orgs, options = {}) ⇒ Object



32
33
34
# File 'lib/octonaut/printers/organizations.rb', line 32

def ls_orgs(orgs, options = {})
  orgs.each {|o| puts o. }
end


27
28
29
30
# File 'lib/octonaut/printers/organizations.rb', line 27

def print_csv_orgs(orgs, options = {})
  options[:fields] = ORG_FIELDS
  print_csv orgs, options
end


14
15
16
17
18
19
20
21
# File 'lib/octonaut/printers/organizations.rb', line 14

def print_org_table(org, options = {})
  data = {}
  ORG_FIELDS.each do |field, heading|
    data[heading] = org[field]
  end

  print_table(data)
end


23
24
25
# File 'lib/octonaut/printers/organizations.rb', line 23

def print_orgs(orgs, options = {})
  options[:csv] ? print_csv_orgs(orgs) : ls_orgs(orgs)
end