Class: Cipherpipe::OnePassword::Download
- Inherits:
-
Object
- Object
- Cipherpipe::OnePassword::Download
- Defined in:
- lib/cipherpipe/one_password/download.rb
Constant Summary collapse
- UnknownDocument =
Class.new Cipherpipe::Error
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(external_source) ⇒ Download
constructor
A new instance of Download.
Constructor Details
#initialize(external_source) ⇒ Download
Returns a new instance of Download.
10 11 12 |
# File 'lib/cipherpipe/one_password/download.rb', line 10 def initialize(external_source) @external_source = external_source end |
Class Method Details
.call(external_source) ⇒ Object
6 7 8 |
# File 'lib/cipherpipe/one_password/download.rb', line 6 def self.call(external_source) new(external_source).call end |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/cipherpipe/one_password/download.rb', line 14 def call hash = documents.detect do |document| document["overview"]["title"] == external_source.destination end if hash.nil? raise UnknownDocument, "Cannot find #{external_source.destination} in 1Password vault #{vault}" end JSON.load `op get document \"#{hash["uuid"]}\" --vault \"#{vault}\"` end |