Class: Fastlane::Actions::BitwardenDownloadAttachmentAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/bitwarden/actions/bitwarden_download_attachment.rb

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



65
66
67
# File 'lib/fastlane/plugin/bitwarden/actions/bitwarden_download_attachment.rb', line 65

def self.authors
  ["[email protected]"]
end

.available_optionsObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/fastlane/plugin/bitwarden/actions/bitwarden_download_attachment.rb', line 31

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :cli_path,
                                 env_name: "BW_CLI_PATH",
                                 optional: true,
                                 description: "Override path to the Bitwarden CLI"),
    FastlaneCore::ConfigItem.new(key: :item_id,
                                 env_name: "BW_ITEM_ID",
                                 description: "ID of the item the Attachment belongs to",
                                 verify_block: proc do |value|
                                    UI.user_error!("No Item ID provided to the Bitwarden Download Attachment Action, pass it like so: `item_id: '<...item_id...>'`") unless value and not value.empty?
                                 end),
    FastlaneCore::ConfigItem.new(key: :attachment_id,
                                 env_name: "BW_ATTACHMENT_ID",
                                 description: "ID of the Attachment to be downloaded",
                                 verify_block: proc do |value|
                                    UI.user_error!("No Attachment ID provided to the Bitwarden Download Attachment Action `email: '<...attachment_id...>'`") unless value and not value.empty?
                                 end),
    FastlaneCore::ConfigItem.new(key: :output_path,
                                 env_name: "BW_ATTACHMENT_OUTPUT",
                                 description: "Output path of the Attachment to be downloaded",
                                 optional: true),
  ]
end

.descriptionObject



23
24
25
# File 'lib/fastlane/plugin/bitwarden/actions/bitwarden_download_attachment.rb', line 23

def self.description
  "You can use this action to download an item's attachment from BitWarden."
end

.detailsObject



27
28
29
# File 'lib/fastlane/plugin/bitwarden/actions/bitwarden_download_attachment.rb', line 27

def self.details
  "You can use this action to download an item's attachment from BitWarden."
end

.is_supported?(platform) ⇒ Boolean



69
70
71
# File 'lib/fastlane/plugin/bitwarden/actions/bitwarden_download_attachment.rb', line 69

def self.is_supported?(platform)
  true
end

.outputObject



56
57
58
59
# File 'lib/fastlane/plugin/bitwarden/actions/bitwarden_download_attachment.rb', line 56

def self.output
  [
  ]
end

.return_valueObject



61
62
63
# File 'lib/fastlane/plugin/bitwarden/actions/bitwarden_download_attachment.rb', line 61

def self.return_value
  "The resulting file path"
end

.run(params) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fastlane/plugin/bitwarden/actions/bitwarden_download_attachment.rb', line 6

def self.run(params)
  @helper = Helper::BitwardenHelper.new(params[:cli_path])
  item_id = params[:item_id]
  attachment_id = params[:attachment_id]
  output_path = params[:output_path]
  args = ['get', 'attachment', '--itemid', item_id, attachment_id, '--raw']
  if output_path
    args += ['--output', output_path]
  end

  @helper.exec(*args)
end