Sha256: d4c6adc19a8da63f5512ebe8078d5e6fc604f3c4f2d5ba84e1fc80cf38836026

Contents?: true

Size: 1.13 KB

Versions: 55

Compression:

Stored size: 1.13 KB

Contents

module TreasureData
module Command

  def org_show(op)
    name = op.cmd_parse

    client = get_client

    orgs = client.organizations
    org = orgs.find {|org| name == org.name }
    unless org
      $stderr.puts "Organization '#{name}' does not exist."
      $stderr.puts "Use '#{$prog} org:create <name>' to create an organization."
      exit 1
    end

    $stderr.puts "Name         : #{org.name}"
  end

  def org_list(op)
    op.cmd_parse

    client = get_client

    orgs = client.organizations

    rows = []
    orgs.each {|org|
      rows << {:Name => org.name}
    }

    puts cmd_render_table(rows, :fields => [:Name])

    if rows.empty?
      $stderr.puts "There are no organizations."
      $stderr.puts "Use '#{$prog} org:create <name>' to create an organization."
    end
  end

  def org_create(op)
    name = op.cmd_parse

    client = get_client

    client.create_organization(name)

    $stderr.puts "Organization '#{name}' is created."
  end

  def org_delete(op)
    name = op.cmd_parse

    client = get_client

    client.delete_organization(name)

    $stderr.puts "Organization '#{name}' is deleted."
  end

end
end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
td-0.10.92 lib/td/command/org.rb
td-0.10.91 lib/td/command/org.rb
td-0.10.90 lib/td/command/org.rb
td-0.10.89 lib/td/command/org.rb
td-0.10.88 lib/td/command/org.rb
td-0.10.87 lib/td/command/org.rb
td-0.10.86 lib/td/command/org.rb
td-0.10.85 lib/td/command/org.rb
td-0.10.84 lib/td/command/org.rb
td-0.10.83 lib/td/command/org.rb
td-0.10.82 lib/td/command/org.rb
td-0.10.81 lib/td/command/org.rb
td-0.10.79 lib/td/command/org.rb
td-0.10.78 lib/td/command/org.rb
td-0.10.77 lib/td/command/org.rb
td-0.10.76 lib/td/command/org.rb
td-0.10.75 lib/td/command/org.rb
td-0.10.74 lib/td/command/org.rb
td-0.10.73 lib/td/command/org.rb
td-0.10.72 lib/td/command/org.rb