class ATS::CLI::Command
Public Class Methods
printable_commands(*args)
click to toggle source
Calls superclass method
# File lib/ats/cli/command.rb, line 7 def self.printable_commands(*args) super.map do |x| x[0] = x[0].gsub(/^ats/, "ats #{service_name.downcase}") x end end
Protected Class Methods
constant_name()
click to toggle source
# File lib/ats/cli/command.rb, line 38 def self.constant_name Kernel.const_get("ATS::#{service_name}::API") end
service_name()
click to toggle source
# File lib/ats/cli/command.rb, line 42 def self.service_name name.split("::")[2] end
Protected Instance Methods
api()
click to toggle source
# File lib/ats/cli/command.rb, line 16 def api self.class.constant_name.new( configuration: configuration.fetch(profile)[self.class.service_name.downcase.to_sym], debug: configuration.debug, ) end
configuration()
click to toggle source
# File lib/ats/cli/command.rb, line 27 def configuration ATS.configure do |x| Net::Hippie.logger = Logger.new('/dev/null') unless options['debug'] x.debug = options['debug'] end end
print_json(json)
click to toggle source
# File lib/ats/cli/command.rb, line 23 def print_json(json) say JSON.pretty_generate(json), :green end
profile()
click to toggle source
# File lib/ats/cli/command.rb, line 34 def profile options['profile'].to_sym end