module JiraCache

JiraCache enables storing JIRA issues fetched from the API in a local storage for easier and faster processing.

This is the main module and it provides some high level methods to either trigger a full project sync, a single issue sync or start a Sinatra webhook app to trigger sync on JIRA“s webhooks.

Constants

VERSION

Public Class Methods

default_client() click to toggle source
# File lib/jira_cache.rb, line 34
def self.default_client
  JiraCache::Client.new(
    domain: ENV["JIRA_DOMAIN"],
    username: ENV["JIRA_USERNAME"],
    password: ENV["JIRA_PASSWORD"],
    logger: default_logger,
    notifier: default_notifier
  )
end
default_logger() click to toggle source
# File lib/jira_cache.rb, line 44
def self.default_logger
  logger = Logger.new(STDOUT)
  logger.level = Logger::DEBUG
  logger
end
default_notifier(logger: default_logger) click to toggle source
# File lib/jira_cache.rb, line 50
def self.default_notifier(logger: default_logger)
  JiraCache::Notifier.new(logger)
end
sync_issue(issue_key, client: default_client) click to toggle source
# File lib/jira_cache.rb, line 20
def self.sync_issue(issue_key, client: default_client)
  Sync.new(client).sync_issue(issue_key)
end
sync_issues(client: default_client, project_key: nil) click to toggle source

Sync issues using the specified client. If a `project_key` is specified, only syncs the issues for the corresponding project.

# File lib/jira_cache.rb, line 16
def self.sync_issues(client: default_client, project_key: nil)
  Sync.new(client).sync_issues(project_key: project_key)
end
webhook_app(client: default_client) click to toggle source

@param client [JiraCache::Client]: defaults to a default

client using environment variables for domain, username
and password, a logger writing to STDOUT and a default
`JiraCache::Notifier` instance as notifier.
# File lib/jira_cache.rb, line 28
def self.webhook_app(client: default_client)
  Sinatra.new(JiraCache::WebhookApp) do
    set(:client, client)
  end
end