Class: Sem4rCli::CommandReport
- Inherits:
-
OptParseCommand::Command
- Object
- OptParseCommand::Command
- Sem4rCli::CommandReport
- Defined in:
- lib/sem4r_cli/commands/cmd_report.rb
Overview
report (v13 api)
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(common_args) ⇒ CommandReport
constructor
A new instance of CommandReport.
- #parse_and_run(argv) ⇒ Object
Constructor Details
#initialize(common_args) ⇒ CommandReport
Returns a new instance of CommandReport.
42 43 44 45 |
# File 'lib/sem4r_cli/commands/cmd_report.rb', line 42 def initialize(common_args) @common_args = common_args @subcommands = %w{list download schedule} end |
Class Method Details
.command ⇒ Object
34 35 36 |
# File 'lib/sem4r_cli/commands/cmd_report.rb', line 34 def self.command "report" end |
.description ⇒ Object
38 39 40 |
# File 'lib/sem4r_cli/commands/cmd_report.rb', line 38 def self.description "manage v13 report" end |
Instance Method Details
#parse_and_run(argv) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/sem4r_cli/commands/cmd_report.rb', line 47 def parse_and_run(argv) = OpenStruct.new rest = command_opt_parser().parse(argv) return false if .exit if rest.length == 0 puts "missing sub command" return false end ret = true subcommand = rest[0] subcommand_args = rest[1..-1] case subcommand when "list" Sem4rCli::report(@common_args.account.reports, :id, :name, :status) when "download" ret = download(subcommand_args) when "schedule" ret = schedule(subcommand_args) else puts "unknow subcommand '#{subcommand}'; must be one of #{@subcomands.join(", ")}" return false end @common_args.account.adwords.p_counters ret end |