Class: RapidVaults::API
- Inherits:
-
Object
- Object
- RapidVaults::API
- Defined in:
- lib/rapid-vaults/api.rb
Overview
provides an application programming interface to interact with rapid vaults
Class Method Summary collapse
-
.main(settings) ⇒ Object
lightweight api.
-
.parse(settings) ⇒ Object
parse api options; this is mostly here for unit testing.
Class Method Details
.main(settings) ⇒ Object
lightweight api
6 7 8 9 |
# File 'lib/rapid-vaults/api.rb', line 6 def self.main(settings) # parse pass-by-value settings for api and run RapidVaults with specified settings RapidVaults.new.main(parse(settings)) end |
.parse(settings) ⇒ Object
parse api options; this is mostly here for unit testing
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rapid-vaults/api.rb', line 12 def self.parse(settings) # validate args if %i[encrypt decrypt].include?(settings[:action]) raise 'no file specified for encryption or decryption' if !settings.key?(:file) end raise 'input password cannot be empty' if settings.key?(:pw) && settings[:pw].empty? # establish settings for api and denote using api settings.merge({ ui: :api }) end |