Class: LinearApi::Label

Inherits:
Object
  • Object
show all
Defined in:
lib/linear_api/label.rb

Overview

Represents a Linear label

Constant Summary collapse

LIST_QUERY =
<<~GRAPHQL
  query ListLabels($teamId: String!) {
    team(id: $teamId) {
      labels {
        nodes {
          id
          name
          color
          description
        }
      }
    }
  }
GRAPHQL
CREATE_MUTATION =
<<~GRAPHQL
  mutation CreateLabel($input: IssueLabelCreateInput!) {
    issueLabelCreate(input: $input) {
      success
      issueLabel {
        id
        name
        color
        description
      }
    }
  }
GRAPHQL

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Label

Returns a new instance of Label.



37
38
39
40
41
42
43
# File 'lib/linear_api/label.rb', line 37

def initialize(data)
  @raw = data
  @id = data['id']
  @name = data['name']
  @color = data['color']
  @description = data['description']
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



35
36
37
# File 'lib/linear_api/label.rb', line 35

def color
  @color
end

#descriptionObject (readonly)

Returns the value of attribute description.



35
36
37
# File 'lib/linear_api/label.rb', line 35

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



35
36
37
# File 'lib/linear_api/label.rb', line 35

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



35
36
37
# File 'lib/linear_api/label.rb', line 35

def name
  @name
end

#rawObject (readonly)

Returns the value of attribute raw.



35
36
37
# File 'lib/linear_api/label.rb', line 35

def raw
  @raw
end

Instance Method Details

#to_hObject



45
46
47
48
49
50
51
52
# File 'lib/linear_api/label.rb', line 45

def to_h
  {
    id: id,
    name: name,
    color: color,
    description: description
  }
end