Module: LinearApi
- Defined in:
- lib/linear_api.rb,
lib/linear_api/team.rb,
lib/linear_api/issue.rb,
lib/linear_api/label.rb,
lib/linear_api/client.rb,
lib/linear_api/engine.rb,
lib/linear_api/result.rb,
lib/linear_api/project.rb,
lib/linear_api/version.rb,
lib/linear_api/cache_sync.rb,
lib/linear_api/issue_tracker.rb,
app/models/linear_api/synced_issue.rb,
app/models/linear_api/cached_metadata.rb,
app/models/linear_api/application_record.rb
Defined Under Namespace
Classes: ApplicationRecord, AuthenticationError, CacheSync, CachedMetadata, Client, Engine, Error, Issue, IssueTracker, Label, NotFoundError, Project, RateLimitError, Result, SyncedIssue, Team
Constant Summary collapse
- SENSITIVE_KEY_PATTERN =
Sensitive key patterns to redact from issue descriptions
/password|secret|token|key|credential|ssn|api_key|authorization/i- VERSION =
'0.5.1'
Class Attribute Summary collapse
-
.api_key ⇒ Object
Returns the value of attribute api_key.
- .logger ⇒ Object
-
.team_id ⇒ Object
Returns the value of attribute team_id.
-
.workspace_slug ⇒ Object
Returns the value of attribute workspace_slug.
Class Method Summary collapse
- .client ⇒ Object
- .configure {|_self| ... } ⇒ Object
-
.eager_load! ⇒ Object
Rails calls eager_load! on all registered eager_load_namespaces.
-
.healthy? ⇒ Boolean
Quick health check against the Linear API.
- .reset_client! ⇒ Object
Class Attribute Details
.api_key ⇒ Object
Returns the value of attribute api_key.
37 38 39 |
# File 'lib/linear_api.rb', line 37 def api_key @api_key end |
.logger ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/linear_api.rb', line 44 def logger @logger ||= if defined?(Rails) && Rails.respond_to?(:logger) && Rails.logger Rails.logger else Logger.new($stdout, level: Logger::WARN) end end |
.team_id ⇒ Object
Returns the value of attribute team_id.
37 38 39 |
# File 'lib/linear_api.rb', line 37 def team_id @team_id end |
.workspace_slug ⇒ Object
Returns the value of attribute workspace_slug.
37 38 39 |
# File 'lib/linear_api.rb', line 37 def workspace_slug @workspace_slug end |
Class Method Details
.client ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'lib/linear_api.rb', line 52 def client @client_mutex ||= Mutex.new @client_mutex.synchronize do raise AuthenticationError, 'API key not configured' unless api_key @client ||= Client.new(api_key: api_key, team_id: team_id) end end |
.configure {|_self| ... } ⇒ Object
40 41 42 |
# File 'lib/linear_api.rb', line 40 def configure yield self end |
.eager_load! ⇒ Object
Rails calls eager_load! on all registered eager_load_namespaces. LinearApi::Engine (a Rails::Engine) registers this module's namespace, so Rails expects it to respond to eager_load!. Without this, CI fails with NoMethodError when config.eager_load = true.
82 83 |
# File 'lib/linear_api.rb', line 82 def eager_load! end |
.healthy? ⇒ Boolean
Quick health check against the Linear API
71 72 73 74 75 76 |
# File 'lib/linear_api.rb', line 71 def healthy? result = client.query('query { viewer { id } }') result.success? rescue StandardError false end |
.reset_client! ⇒ Object
61 62 63 64 65 66 |
# File 'lib/linear_api.rb', line 61 def reset_client! @client_mutex ||= Mutex.new @client_mutex.synchronize do @client = nil end end |