Class: AbideDevUtils::Jira::Client

Inherits:
Object
  • Object
show all
Extended by:
DryRun
Defined in:
lib/abide_dev_utils/jira/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DryRun

dry_run, dry_run_return_false, dry_run_return_true, dry_run_simple

Constructor Details

#initialize(dry_run: false, **options) ⇒ Client

Returns a new instance of Client.



21
22
23
24
25
26
27
28
29
30
# File 'lib/abide_dev_utils/jira/client.rb', line 21

def initialize(dry_run: false, **options)
  @dry_run = dry_run
  @options = options
  @config = AbideDevUtils::Config.config_section('jira')
  @default_project = @config[:default_project]
  @client = nil
  @finder = nil
  @issue_builder = nil
  @helper = nil
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



19
20
21
# File 'lib/abide_dev_utils/jira/client.rb', line 19

def config
  @config
end

#default_projectObject

Returns the value of attribute default_project.



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

def default_project
  @default_project
end

Instance Method Details

#create(type, **fields) ⇒ Object



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

def create(type, **fields)
  issue_builder.create(type, **fields)
end

#find(type, id) ⇒ Object

Raises:

  • (ArgumentError)


36
37
38
39
40
# File 'lib/abide_dev_utils/jira/client.rb', line 36

def find(type, id)
  raise ArgumentError, "Invalid type #{type}" unless finder.respond_to?(type.to_sym)

  finder.send(type.to_sym, id)
end

#helperObject



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

def helper
  @helper ||= Helper.new(self, dry_run: @dry_run)
end

#myselfObject



32
33
34
# File 'lib/abide_dev_utils/jira/client.rb', line 32

def myself
  @myself ||= finder.myself
end

#translate_issue_custom_field(name) ⇒ Object



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

def translate_issue_custom_field(name)
  IssueBuilder::CUSTOM_FIELDS[name] || IssueBuilder::CUSTOM_FIELDS.invert[name]
end