Class: Apadmi::Grout::DIWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/apadmi_grout/utils/di_wrapper.rb

Overview

Helper function for constructing the DI from params

Class Method Summary collapse

Class Method Details

.di(params, logger) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/fastlane/plugin/apadmi_grout/utils/di_wrapper.rb', line 7

def self.di(params, logger)
  case params[:board_provider]
  when "ADO"
    raise "Invalid ADO personal access token" if params[:ado_pat].blank?

    Apadmi::Grout::DependencyInjector.init_for_ado(
      params[:ado_pat],
      params[:board_base_url],
      logger
    )
  when "JIRA"
    raise "Invalid jira username" if params[:jira_username].blank?
    raise "Invalid jira_api_token" if params[:jira_api_token].blank?
    raise "Invalid jira_project_key" if params[:jira_project_key].blank?

    Apadmi::Grout::DependencyInjector.init_for_jira(
      params[:jira_username],
      params[:jira_api_token],
      params[:board_base_url],
      params[:jira_context_path],
      params[:jira_project_key],
      logger
    )
  else
    raise "Unsupported board provider: #{params[:board_provider]}"
  end
end