Class: Usps::Imis::CommandLine::Interface
- Inherits:
-
Object
- Object
- Usps::Imis::CommandLine::Interface
- Includes:
- Performers
- Defined in:
- lib/usps/imis/command_line/interface.rb
Overview
Command line interface for the Api
Constant Summary collapse
- NAME =
'USPS iMIS API - Ruby'- RAW_HASH_RESPONSE_OPTIONS =
CLI options that indicate the response is a raw Hash rather than a Data object, and should not be simplified
%i[business_objects auth_token].freeze
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
26 27 28 |
# File 'lib/usps/imis/command_line/interface.rb', line 26 def logger @logger end |
#options ⇒ Object (readonly)
Options passed in from the command line
22 23 24 |
# File 'lib/usps/imis/command_line/interface.rb', line 22 def @options end |
Class Method Details
.run ⇒ Object
Initialize an Interface and run it with the provided options
32 |
# File 'lib/usps/imis/command_line/interface.rb', line 32 def self.run(...) = new(...).run |
Instance Method Details
#run ⇒ Object
Run the configured action on the API
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/usps/imis/command_line/interface.rb', line 49 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 |