Class: AbideDevUtils::Jira::ClientBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/abide_dev_utils/jira/client_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(config, **options) ⇒ ClientBuilder

Returns a new instance of ClientBuilder.



9
10
11
12
# File 'lib/abide_dev_utils/jira/client_builder.rb', line 9

def initialize(config, **options)
  @options = options
  @config = config
end

Instance Method Details

#auth_typeObject



50
51
52
# File 'lib/abide_dev_utils/jira/client_builder.rb', line 50

def auth_type
  find_option_value(:auth_type, default: :basic)
end

#auth_type=(auth_type) ⇒ Object



54
55
56
# File 'lib/abide_dev_utils/jira/client_builder.rb', line 54

def auth_type=(auth_type)
  @options[:auth_type] = auth_type
end

#buildObject



66
67
68
69
70
71
72
73
74
75
# File 'lib/abide_dev_utils/jira/client_builder.rb', line 66

def build
  JIRA::Client.new({
    username: find_option_value(:username, prompt: true),
    password: find_option_value(:password, prompt: true),
    site: find_option_value(:site, prompt: 'Jira site URL'),
    context_path: find_option_value(:context_path, default: ''),
    auth_type: find_option_value(:auth_type, default: :basic),
    http_debug: find_option_value(:http_debug, default: false),
  })
end

#context_pathObject



42
43
44
# File 'lib/abide_dev_utils/jira/client_builder.rb', line 42

def context_path
  find_option_value(:context_path, default: '')
end

#context_path=(context_path) ⇒ Object



46
47
48
# File 'lib/abide_dev_utils/jira/client_builder.rb', line 46

def context_path=(context_path)
  @options[:context_path] = context_path
end

#http_debugObject



58
59
60
# File 'lib/abide_dev_utils/jira/client_builder.rb', line 58

def http_debug
  find_option_value(:http_debug, default: false)
end

#http_debug=(http_debug) ⇒ Object



62
63
64
# File 'lib/abide_dev_utils/jira/client_builder.rb', line 62

def http_debug=(http_debug)
  @options[:http_debug] = http_debug
end

#passwordObject



22
23
24
25
26
27
28
# File 'lib/abide_dev_utils/jira/client_builder.rb', line 22

def password
  if find_option_value(:password)
    '********'
  else
    nil
  end
end

#password=(password) ⇒ Object



30
31
32
# File 'lib/abide_dev_utils/jira/client_builder.rb', line 30

def password=(password)
  @options[:password] = password
end

#siteObject



34
35
36
# File 'lib/abide_dev_utils/jira/client_builder.rb', line 34

def site
  find_option_value(:site)
end

#site=(site) ⇒ Object



38
39
40
# File 'lib/abide_dev_utils/jira/client_builder.rb', line 38

def site=(site)
  @options[:site] = site
end

#usernameObject



14
15
16
# File 'lib/abide_dev_utils/jira/client_builder.rb', line 14

def username
  find_option_value(:username)
end

#username=(username) ⇒ Object



18
19
20
# File 'lib/abide_dev_utils/jira/client_builder.rb', line 18

def username=(username)
  @options[:username] = username
end