Class: Rubyists::Linear::Team
- Inherits:
-
Object
- Object
- Rubyists::Linear::Team
- Includes:
- SemanticLogger::Loggable
- Defined in:
- lib/linear/models/team.rb
Overview
The Issue class represents a Linear issue.
Constant Summary collapse
- BaseFilter =
TODO: Make this configurable
{ # rubocop:disable Naming/ConstantName and: [ { name: { notEndsWith: ' Releases' } }, { name: { notEndsWith: '-ios' } }, { name: { notEndsWith: '-android' } } ] }.freeze
- Base =
fragment('BaseTeam', 'Team') do description id key name createdAt updatedAt end
Class Method Summary collapse
Instance Method Summary collapse
- #display(_options) ⇒ Object
- #full ⇒ Object
- #label_groups ⇒ Object
- #label_query ⇒ Object
-
#labels ⇒ Object
rubocop:disable Metrics/CyclomaticComplexity.
- #members ⇒ Object
- #to_s ⇒ Object
- #workflow_states ⇒ Object
- #workflow_states_query ⇒ Object
Class Method Details
Instance Method Details
#display(_options) ⇒ Object
92 93 94 |
# File 'lib/linear/models/team.rb', line 92 def display() printf "%s\n", full end |
#full ⇒ Object
48 49 50 |
# File 'lib/linear/models/team.rb', line 48 def full format('%<key>-6s %<to_s>s', key:, to_s:) end |
#label_groups ⇒ Object
63 64 65 |
# File 'lib/linear/models/team.rb', line 63 def label_groups @label_groups ||= [] end |
#label_query ⇒ Object
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/linear/models/team.rb', line 52 def label_query team_id = id query do team(id: team_id) do labels(first: 100, filter: BaseFilter) do nodes { ___ Label.base_fragment } end end end end |
#labels ⇒ Object
rubocop:disable Metrics/CyclomaticComplexity
67 68 69 70 71 72 73 74 75 76 |
# File 'lib/linear/models/team.rb', line 67 def labels # rubocop:disable Metrics/CyclomaticComplexity return @labels if @labels @labels = Api.query(label_query).dig(:team, :labels, :nodes)&.map do |label| label_groups << Label.new(label) if label[:isGroup] next if label[:isGroup] || label[:parent] Label.new label end&.compact end |
#members ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/linear/models/team.rb', line 78 def members return @members if @members && !@members.empty? q = query do team(id:) do members do nodes { ___ User::Base } end end end data = Api.query(q) @members = data.dig(:team, :members, :nodes)&.map { |member| User.new member } || [] end |
#to_s ⇒ Object
44 45 46 |
# File 'lib/linear/models/team.rb', line 44 def to_s format('%<name>s', name:) end |
#workflow_states ⇒ Object
107 108 109 110 111 112 113 114 |
# File 'lib/linear/models/team.rb', line 107 def workflow_states return @workflow_states if @workflow_states data = Api.query(workflow_states_query) @workflow_states = data.dig(:team, :states, :nodes)&.map do |state| WorkflowState.new state end end |
#workflow_states_query ⇒ Object
96 97 98 99 100 101 102 103 104 105 |
# File 'lib/linear/models/team.rb', line 96 def workflow_states_query team_id = id query do team(id: team_id) do states do nodes { ___ WorkflowState.base_fragment } end end end end |