Class: Soapstone::FetchLinearIssue
- Inherits:
-
Object
- Object
- Soapstone::FetchLinearIssue
- Defined in:
- lib/soapstone/core/fetch_linear_issue.rb
Constant Summary collapse
- LINEAR_URL =
"https://api.linear.app/graphql"
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize ⇒ FetchLinearIssue
constructor
A new instance of FetchLinearIssue.
Constructor Details
#initialize ⇒ FetchLinearIssue
Returns a new instance of FetchLinearIssue.
10 11 12 13 14 |
# File 'lib/soapstone/core/fetch_linear_issue.rb', line 10 def initialize @config = Soapstone::Config::Load.call @git_context = Soapstone::Context::GitBranch.call @linear_context = Soapstone::Context::Linear.call(@git_context.current_branch) end |
Class Method Details
.call ⇒ Object
6 7 8 |
# File 'lib/soapstone/core/fetch_linear_issue.rb', line 6 def self.call new.call end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/soapstone/core/fetch_linear_issue.rb', line 16 def call return unless linear_context.enabled? return unless linear_context.pattern && !linear_context.pattern.empty? return {} if git_context.default_branch? return unless linear_context.matches_pattern? response = Faraday.post(LINEAR_URL, payload, headers) body = JSON.parse(response.body) body.dig("data", "issue") || {} end |