Module: Rubyists::Linear::Issue::ClassMethods

Included in:
Rubyists::Linear::Issue
Defined in:
lib/linear/models/issue/class_methods.rb

Overview

Class methods for Issue

Instance Method Summary collapse

Instance Method Details

#base_fragmentObject



11
12
13
14
15
16
17
# File 'lib/linear/models/issue/class_methods.rb', line 11

def base_fragment
  @base_fragment ||= fragment('BaseIssue', 'Issue') do
    ___ Base
    assignee { ___ User.base_fragment }
    team { ___ Team.base_fragment }
  end
end

#create(title:, description:, team:, project:, labels: []) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/linear/models/issue/class_methods.rb', line 32

def create(title:, description:, team:, project:, labels: [])
  team_id = team.id
  label_ids = labels.map(&:id)
  input = { title:, description:, teamId: team_id }
  input[:labelIds] = label_ids unless label_ids.empty?
  input[:projectId] = project.id if project
  m = mutation { issueCreate(input:) { issue { ___ Issue.base_fragment } } }
  query_data = Api.query(m)
  new query_data.dig(:issueCreate, :issue)
end

#find_all(*slugs) ⇒ Object



28
29
30
# File 'lib/linear/models/issue/class_methods.rb', line 28

def find_all(*slugs)
  slugs.flatten.map { |slug| find(slug) }
end

#full_fragmentObject



19
20
21
22
23
24
25
26
# File 'lib/linear/models/issue/class_methods.rb', line 19

def full_fragment
  @full_fragment ||= fragment('FullIssue', 'Issue') do
    ___ Base
    assignee { ___ User.full_fragment }
    team { ___ Team.full_fragment }
    comments { nodes { ___ Comment.base_fragment } }
  end
end