Module: JiraCache
- Defined in:
- lib/jira_cache.rb,
lib/jira_cache/data.rb,
lib/jira_cache/sync.rb,
lib/jira_cache/client.rb,
lib/jira_cache/version.rb,
lib/jira_cache/notifier.rb,
lib/jira_cache/webhook_app.rb,
lib/jira_cache/data/issue_repository.rb
Overview
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.
Defined Under Namespace
Modules: Data
Classes: Client, Notifier, Sync, WebhookApp
Constant Summary
collapse
- VERSION =
File.read(File.expand_path('../../../VERSION', __FILE__)).strip
Class Method Summary
collapse
Class Method Details
.default_client ⇒ Object
34
35
36
37
38
39
40
41
42
|
# 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 ⇒ Object
44
45
46
47
48
|
# 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) ⇒ Object
50
51
52
|
# 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) ⇒ Object
20
21
22
|
# 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) ⇒ Object
Sync issues using the specified client. If a ‘project_key` is specified, only syncs the issues for the corresponding project.
16
17
18
|
# 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) ⇒ Object
28
29
30
31
32
|
# File 'lib/jira_cache.rb', line 28
def self.webhook_app(client: default_client)
Sinatra.new(JiraCache::WebhookApp) do
set(:client, client)
end
end
|