lib/td/command/common.rb in td-0.7.2 vs lib/td/command/common.rb in td-0.7.3

- old
+ new

@@ -1,7 +1,7 @@ -module TD +module TreasureData module Command private def cmd_opt(name, *args) if args.last.to_s =~ /_$/ multi = true @@ -54,17 +54,17 @@ end op end - def cmd_api + def get_client apikey = Config.apikey unless apikey raise ConfigError, "Account is not configured." end - require 'td/api' - api = API.new(apikey) + require 'td/client' + Client.new(apikey) end def cmd_render_table(rows, *opts) require 'hirb' Hirb::Helpers::Table.render(rows, *opts) @@ -83,23 +83,23 @@ } $stderr.puts "" end end - def find_database(api, db_name) + def find_database(client, db_name) begin - return api.database(db_name) + return client.database(db_name) rescue cmd_debug_error $! $stderr.puts $! $stderr.puts "Use '#{$prog} show-databases' to show the list of databases." exit 1 end db end - def find_table(api, db_name, table_name, type=nil) - db = find_database(api, db_name) + def find_table(client, db_name, table_name, type=nil) + db = find_database(client, db_name) begin table = db.table(table_name) rescue $stderr.puts $! $stderr.puts "Use '#{$prog} show-tables #{db_name}' to show the list of tables."