Class: LinearApi::Team

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

Overview

Represents a Linear team

Constant Summary collapse

GET_QUERY =
<<~GRAPHQL
  query GetTeam($teamId: String!) {
    team(id: $teamId) {
      id
      name
      key
      description
    }
  }
GRAPHQL
STATES_QUERY =
<<~GRAPHQL
  query GetStates($teamId: String!) {
    team(id: $teamId) {
      states {
        nodes {
          id
          name
          type
          position
          color
        }
      }
    }
  }
GRAPHQL
USERS_QUERY =
<<~GRAPHQL
  query ListUsers($teamId: String!) {
    team(id: $teamId) {
      members {
        nodes {
          id
          name
          email
          displayName
          active
        }
      }
    }
  }
GRAPHQL
ALL_METADATA_QUERY =

Fetch all team metadata in a single query (for CacheSync)

<<~GRAPHQL
  query FetchAllMetadata($teamId: String!) {
    team(id: $teamId) {
      labels {
        nodes {
          id
          name
          color
          description
        }
      }
      projects {
        nodes {
          id
          name
          description
          state
          progress
        }
      }
      states {
        nodes {
          id
          name
          type
          position
          color
        }
      }
      members {
        nodes {
          id
          name
          email
          displayName
          active
        }
      }
    }
  }
GRAPHQL

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Team

Returns a new instance of Team.



94
95
96
97
98
99
100
# File 'lib/linear_api/team.rb', line 94

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

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



92
93
94
# File 'lib/linear_api/team.rb', line 92

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



92
93
94
# File 'lib/linear_api/team.rb', line 92

def id
  @id
end

#keyObject (readonly)

Returns the value of attribute key.



92
93
94
# File 'lib/linear_api/team.rb', line 92

def key
  @key
end

#nameObject (readonly)

Returns the value of attribute name.



92
93
94
# File 'lib/linear_api/team.rb', line 92

def name
  @name
end

#rawObject (readonly)

Returns the value of attribute raw.



92
93
94
# File 'lib/linear_api/team.rb', line 92

def raw
  @raw
end

Instance Method Details

#to_hObject



102
103
104
105
106
107
108
109
# File 'lib/linear_api/team.rb', line 102

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