Class: LinearApi::Project

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

Overview

Represents a Linear project (epic)

Constant Summary collapse

LIST_QUERY =
<<~GRAPHQL
  query ListProjects($teamId: String!) {
    team(id: $teamId) {
      projects {
        nodes {
          id
          name
          description
          state
          progress
          url
        }
      }
    }
  }
GRAPHQL
CREATE_MUTATION =
<<~GRAPHQL
  mutation CreateProject($input: ProjectCreateInput!) {
    projectCreate(input: $input) {
      success
      project {
        id
        name
        description
        url
        color
        state
        progress
      }
    }
  }
GRAPHQL

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Project

Returns a new instance of Project.



42
43
44
45
46
47
48
49
50
51
# File 'lib/linear_api/project.rb', line 42

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

Instance Attribute Details

#color ⇒ Object (readonly)

Returns the value of attribute color.



40
41
42
# File 'lib/linear_api/project.rb', line 40

def color
  @color
end

#description ⇒ Object (readonly)

Returns the value of attribute description.



40
41
42
# File 'lib/linear_api/project.rb', line 40

def description
  @description
end

#id ⇒ Object (readonly)

Returns the value of attribute id.



40
41
42
# File 'lib/linear_api/project.rb', line 40

def id
  @id
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



40
41
42
# File 'lib/linear_api/project.rb', line 40

def name
  @name
end

#progress ⇒ Object (readonly)

Returns the value of attribute progress.



40
41
42
# File 'lib/linear_api/project.rb', line 40

def progress
  @progress
end

#raw ⇒ Object (readonly)

Returns the value of attribute raw.



40
41
42
# File 'lib/linear_api/project.rb', line 40

def raw
  @raw
end

#state ⇒ Object (readonly)

Returns the value of attribute state.



40
41
42
# File 'lib/linear_api/project.rb', line 40

def state
  @state
end

#url ⇒ Object (readonly)

Returns the value of attribute url.



40
41
42
# File 'lib/linear_api/project.rb', line 40

def url
  @url
end

Instance Method Details

#to_h ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
# File 'lib/linear_api/project.rb', line 53

def to_h
  {
    id: id,
    name: name,
    description: description,
    state: state,
    progress: progress,
    url: url,
    color: color
  }
end