class AgileNotifier::Jira
Constants
- API_VERSION_URL
- USERAGENT
Public Class Methods
new(args)
click to toggle source
# File lib/agile_notifier/jira.rb, line 13 def initialize(args) @url = args.fetch(:url).gsub(/\/$/, '') + API_VERSION_URL @username = args.fetch(:username) @password = args.fetch(:password) @wip = Hash.new end
Public Instance Methods
exceeds_limit?()
click to toggle source
# File lib/agile_notifier/jira.rb, line 32 def exceeds_limit? @wip.inject({}) do |result, (key, value)| result.merge({key => query_amount_of_tickets(value[:query]) > value[:limit]}) end end
is_available?()
click to toggle source
# File lib/agile_notifier/jira.rb, line 20 def is_available? original_is_available?(@url + 'serverInfo') end
Also aliased as: original_is_available?
query_amount_of_tickets(jql)
click to toggle source
# File lib/agile_notifier/jira.rb, line 24 def query_amount_of_tickets(jql) get_value('total', jql) end
set_limit(project, query, limit)
click to toggle source
# File lib/agile_notifier/jira.rb, line 28 def set_limit(project, query, limit) @wip[project] = {:query => query, :limit => limit} end
Private Instance Methods
get_value(key, jql, max = 1)
click to toggle source
# File lib/agile_notifier/jira.rb, line 38 def get_value(key, jql, max = 1) get_value_of_key(key, @url + 'search', :method => :post, :headers => {'Content-Type' => 'application/json', 'User-Agent' => USERAGENT}, :basic_auth => {:username => @username, :password => @password}, :body => {'jql' => jql, 'maxResults' => max}.to_json) end