Class: Cc::Api::Parser::ArgumentsParser

Inherits:
Object
  • Object
show all
Defined in:
lib/cc/api/parser/arguments_parser.rb

Constant Summary collapse

ERRORS =
{'cli_arguments_exception' => "Error. Please run 'cc-cli' for a list of available commands and their corresponding usage"}

Class Method Summary collapse

Class Method Details

.parse(args) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/cc/api/parser/arguments_parser.rb', line 12

def self.parse args
  unless Cc::Api::Parser::ArgumentsMapper::get_url(args[:action]).nil?
    if res = Cc::Api::Parser::ArgumentsMapper.map(args)
      self.build_action_url args, res
    else
      self.raise_cli_arguments_exception
    end
  else
    self.raise_cli_arguments_exception
  end
end

.raise_cli_arguments_exceptionObject



24
25
26
27
28
29
30
# File 'lib/cc/api/parser/arguments_parser.rb', line 24

def self.raise_cli_arguments_exception
  begin
    raise CLIArgumentsException.new(ERRORS['cli_arguments_exception'])
  rescue Exception => e
    puts e.message
  end
end