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.71 lib/td/command/org.rb
td-0.10.70 lib/td/command/org.rb
td-0.10.69 lib/td/command/org.rb
td-0.10.68 lib/td/command/org.rb
td-0.10.67 lib/td/command/org.rb
td-0.10.66 lib/td/command/org.rb
td-0.10.65 lib/td/command/org.rb
td-0.10.64 lib/td/command/org.rb
td-0.10.63 lib/td/command/org.rb
td-0.10.62 lib/td/command/org.rb
td-0.10.61 lib/td/command/org.rb
td-0.10.60 lib/td/command/org.rb
td-0.10.59 lib/td/command/org.rb
td-0.10.58 lib/td/command/org.rb
td-0.10.57 lib/td/command/org.rb
td-0.10.56 lib/td/command/org.rb
td-0.10.55 lib/td/command/org.rb
td-0.10.54 lib/td/command/org.rb
td-0.10.53 lib/td/command/org.rb
td-0.10.52 lib/td/command/org.rb