Class: Usps::Imis::CommandLine::Interface
- Inherits:
-
Object
- Object
- Usps::Imis::CommandLine::Interface
- Includes:
- Formatters, Performers
- Defined in:
- lib/usps/imis/command_line/interface.rb
Overview
Command line interface for the Api
Constant Summary collapse
- CONFIG_PATHS =
Prioritized list of config file paths to automatically check if not provided
{ local_dot: File.join(Dir.pwd, '.imis.yml'), local: File.join(Dir.pwd, 'imis.yml'), local_dot_config: File.join(Dir.pwd, '.config', 'imis.yml'), local_config: File.join(Dir.pwd, 'config', 'imis.yml'), user: File.join(Dir.home, '.config', 'imis.yml'), system: '/usr/local/imis/config.yml' }.freeze
Constants included from Formatters
Formatters::RAW_HASH_RESPONSE_OPTIONS
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Tagged logger.
-
#options ⇒ Object
readonly
Options passed in from the command line.
Class Method Summary collapse
-
.run ⇒ Object
Initialize an
Interfaceand run it with the provided options.
Instance Method Summary collapse
-
#initialize ⇒ Interface
constructor
A new instance of
Interface. -
#run ⇒ Object
Run the configured action on the API.
Constructor Details
Instance Attribute Details
#logger ⇒ Object (readonly)
Tagged logger
32 33 34 |
# File 'lib/usps/imis/command_line/interface.rb', line 32 def logger @logger end |
#options ⇒ Object (readonly)
Options passed in from the command line
28 29 30 |
# File 'lib/usps/imis/command_line/interface.rb', line 28 def @options end |
Class Method Details
.run ⇒ Object
Initialize an Interface and run it with the provided options
38 |
# File 'lib/usps/imis/command_line/interface.rb', line 38 def self.run(...) = new(...).run |
Instance Method Details
#run ⇒ Object
Run the configured action on the API
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/usps/imis/command_line/interface.rb', line 55 def run logger.info 'Running' logger.debug 'CLI Options:' logger.json(.dup.tap { it[:token] = '[FILTERED]' if it[:token] }) set_member result = simplify(perform!) output { result } result end |