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::NOTHING) ⇒ 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.



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

def initialize(opts, salt = NoSalt.new, log = Log::NOTHING)
  @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



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

def issues(jql, opts = {})
  raw do |jira|
    jira.Issue.jql(jql, opts).map { |i| Lazylead::Issue.new(i) }
  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)


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

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