Class: Lazylead::Jira

Inherits:
Object
  • Object
show all
Defined in:
lib/lazylead/system/jira.rb

Overview

Jira system for manipulation with issues.

Author

Yurii Dubinka ([email protected])

Copyright

Copyright © 2019-2020 Yurii Dubinka

License

MIT

Instance Method Summary collapse

Constructor Details

#initialize(opts, salt = NoSalt.new, log = Log.new) ⇒ Jira

TODO:

#57/DEV The debug method should be moved outside of ctor. This was moved here from ‘client’ method because Rubocop failed the build due to ‘Metrics/AbcSize’ violation.

Returns a new instance of Jira.



39
40
41
42
43
44
45
46
# File 'lib/lazylead/system/jira.rb', line 39

def initialize(opts, salt = NoSalt.new, log = Log.new)
  @opts = opts
  @salt = salt
  @log = log
  @log.debug "Initiate a Jira client using following opts: " \
             "#{@opts.except 'password', :password} " \
             " and salt #{@salt.id} (found=#{@salt.specified?})"
end

Instance Method Details

#issues(jql, opts = {}) ⇒ Object



48
49
50
51
52
# File 'lib/lazylead/system/jira.rb', line 48

def issues(jql, opts = {})
  raw do |jira|
    jira.Issue.jql(jql, opts).map { |i| Lazylead::Issue.new(i, jira) }
  end
end

#raw {|client| ... } ⇒ Object

Execute request to the ticketing system using raw client. For Jira the raw client is ‘jira-ruby’ gem.

Yields:

  • (client)


56
57
58
59
# File 'lib/lazylead/system/jira.rb', line 56

def raw
  raise "ll-06: No block given to method" unless block_given?
  yield client
end