123456789_123456789_123456789_123456789_123456789_

Module: Octokit::Client::Projects

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/octokit/client/projects.rb

Overview

Methods for Projects API

Instance Method Summary

Instance Method Details

#column_cards(id, options = {}) ⇒ Array<Sawyer::Resource>

List columns cards

Requires authenticated client

Examples:

@client.column_cards(30294)

Parameters:

  • id (Integer)

    Project column id

Returns:

  • (Array<Sawyer::Resource>)

    Cards in the column

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/projects.rb', line 217

def column_cards(id, options = {})
  opts = ensure_api_media_type(:projects, options)
  paginate "projects/columns/#{id}/cards", opts
end

#create_org_project(org, name, options = {}) ⇒ Sawyer::Resource Also known as: #create_organization_project

Create organization project

Requires authenticated client

Examples:

Create with only a name

@client.create_org_project("octocat", "make more octocats")

Create a project with name and body

@client.create_org_project("octokit", "octocan", body: 'Improve clients')

Parameters:

  • org (String)

    A GitHub organization

  • name (String)

    Project name

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :body (String)

    Project body

Returns:

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/projects.rb', line 71

def create_org_project(org, name, options = {})
  opts = ensure_api_media_type(:projects, options)
  opts[:name] = name
  post "orgs/#{org}/projects", opts
end

#create_organization_project(org, name, options = {})

Alias for #create_org_project.

[ GitHub ]

  
# File 'lib/octokit/client/projects.rb', line 76

alias create_organization_project create_org_project

#create_project(repo, name, options = {}) ⇒ Sawyer::Resource

Create a project

Requires authenticated client

Examples:

Create project with only a name

@client.create_project('octokit/octokit.rb', 'implement new APIs')

Create project with name and body

@client.create_project('octokit/octokit.rb', 'bugs be gone', body: 'Fix all the bugs @joeyw creates')

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

  • name (String)

    Project name

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :body (String)

    Body of the project

Returns:

  • (Sawyer::Resource)

    Fresh new project

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/projects.rb', line 37

def create_project(repo, name, options = {})
  opts = ensure_api_media_type(:projects, options)
  opts[:name] = name
  post "#{Repository.path repo}/projects", opts
end

#create_project_card(id, options = {}) ⇒ Sawyer::Resource

Note:

If :note is supplied, :content_id and :content_type must be excluded. Similarly, if :content_id is supplied, :content_type must be set and :note must not be included.

Create project card

Requires authenticated client

Examples:

Create a project card with a note

@client.create_project_card(123495, note: 'New note card')

Create a project card for an repository issue

@client.create_project_card(123495, content_id: 1, content_type: 'Issue')

Parameters:

  • id (Integer)

    Project column id

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :note (String)

    Card contents for a note type

  • :content_id (Integer)

    Issue ID for the card contents

  • :content_type (String)

    Type of content to associate with the card. Issue is presently the only avaiable value

Returns:

  • (Sawyer::Resource)

    Newly created card

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/projects.rb', line 240

def create_project_card(id, options = {})
  opts = ensure_api_media_type(:projects, options)
  post "projects/columns/#{id}/cards", opts
end

#create_project_column(id, name, options = {}) ⇒ Sawyer::Resource

Create a project column

Requires authenticated client

Examples:

@client.create_project_column(123942, "To Dones")

Parameters:

  • id (Integer)

    Project column id

  • name (String)

    New column name

Returns:

  • (Sawyer::Resource)

    Newly created column

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/projects.rb', line 142

def create_project_column(id, name, options = {})
  opts = ensure_api_media_type(:projects, options)
  opts[:name] = name
  post "projects/#{id}/columns", opts
end

#delete_project(id, options = {}) ⇒ Boolean

Delete a project

Requires authenticated client

Examples:

@client.delete_project(123942)

Parameters:

  • id (Integer)

    Project id

Returns:

  • (Boolean)

    Result of deletion

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/projects.rb', line 115

def delete_project(id, options = {})
  opts = ensure_api_media_type(:projects, options)
  boolean_from_response :delete, "projects/#{id}", opts
end

#delete_project_card(id, options = {}) ⇒ Boolean

Delete a project card

Requires authenticated client

Examples:

@client.delete_project_card(123495)

Parameters:

  • id (Integer)

    Project card id

Returns:

  • (Boolean)

    True of deleted, false otherwise

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/projects.rb', line 307

def delete_project_card(id, options = {})
  opts = ensure_api_media_type(:projects, options)
  boolean_from_response :delete, "projects/columns/cards/#{id}", opts
end

#delete_project_column(id, options = {}) ⇒ Boolean

Delete a project column

Requires authenticated client

Examples:

@client.delete_project_column(30294)

Parameters:

  • id (Integer)

    Project column id

Returns:

  • (Boolean)

    Result of deletion request, true when deleted

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/projects.rb', line 185

def delete_project_column(id, options = {})
  opts = ensure_api_media_type(:projects, options)
  boolean_from_response :delete, "projects/columns/#{id}", opts
end

#move_project_card(id, position, options = {}) ⇒ Sawyer::Resource

Move a project card

Requires authenticated client

Examples:

Move a card to the bottom of the same column

@client.move_project_card(123495, 'bottom')

Move a card to the top of another column

@client.move_project_card(123495, 'top', column_id: 59402)

Parameters:

  • id (Integer)

    Project card id

  • position (String)

    Can be one of top, bottom, or after:, where is the id value of a card in the same column, or in the new column specified by column_id.

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :column_id (Integer)

    The column id to move the card to, must be column in same project

Returns:

  • (Sawyer::Resource)

    Empty sawyer resource

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/projects.rb', line 292

def move_project_card(id, position, options = {})
  opts = ensure_api_media_type(:projects, options)
  opts[:position] = position
  post "projects/columns/cards/#{id}/moves", opts
end

#move_project_column(id, position, options = {}) ⇒ Sawyer::Resource

Move a project column

Requires authenticated client

Examples:

@client.move_project_column(30294, "last")

Parameters:

  • id (Integer)

    Project column id

  • position (String)

    New position for the column. Can be one of first, last, or after:, where is the id value of a column in the same project.

Returns:

  • (Sawyer::Resource)

    Result

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/projects.rb', line 202

def move_project_column(id, position, options = {})
  opts = ensure_api_media_type(:projects, options)
  opts[:position] = position
  post "projects/columns/#{id}/moves", opts
end

#org_projects(org, options = {}) ⇒ Array<Sawyer::Resource> Also known as: #organization_projects

List organization projects

Requires authenticated client

Examples:

@client.org_projects("octokit")

Parameters:

  • org (String)

    A GitHub organization

Returns:

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/projects.rb', line 52

def org_projects(org, options = {})
  opts = ensure_api_media_type(:projects, options)
  paginate "orgs/#{org}/projects", opts
end

#organization_projects(org, options = {})

Alias for #org_projects.

[ GitHub ]

  
# File 'lib/octokit/client/projects.rb', line 56

alias organization_projects org_projects

#project(id, options = {}) ⇒ Sawyer::Resource

Get a project by id

Examples:

Octokit.project(123942)

Parameters:

  • id (Integer)

    Project id

Returns:

  • (Sawyer::Resource)

    Project

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/projects.rb', line 85

def project(id, options = {})
  opts = ensure_api_media_type(:projects, options)
  get "projects/#{id}", opts
end

#project_card(id, options = {}) ⇒ Sawyer::Resource

Get a project card

Requires authenticated client

Examples:

@client.project_card(123495)

Parameters:

  • id (Integer)

    Project card id

Returns:

  • (Sawyer::Resource)

    Project card

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/projects.rb', line 254

def project_card(id, options = {})
  opts = ensure_api_media_type(:projects, options)
  get "projects/columns/cards/#{id}", opts
end

#project_column(id, options = {}) ⇒ Sawyer::Resource

Get a project column by ID

Examples:

Octokit.project_column(30294)

Parameters:

  • id (Integer)

    Project column id

Returns:

  • (Sawyer::Resource)

    Project column

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/projects.rb', line 155

def project_column(id, options = {})
  opts = ensure_api_media_type(:projects, options)
  get "projects/columns/#{id}", opts
end

#project_columns(id, options = {}) ⇒ Array<Sawyer::Resource>

List project columns

Examples:

@client.project_columns(123942)

Parameters:

  • id (Integer)

    Project id

Returns:

  • (Array<Sawyer::Resource>)

    List of project columns

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/projects.rb', line 127

def project_columns(id, options = {})
  opts = ensure_api_media_type(:projects, options)
  paginate "projects/#{id}/columns", opts
end

#projects(repo, options = {}) ⇒ Array<Sawyer::Resource>

List projects for a repository

Requires authenticated client

Examples:

@client.projects('octokit/octokit.rb')

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

Returns:

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/projects.rb', line 18

def projects(repo, options = {})
  opts = ensure_api_media_type(:projects, options)
  paginate "#{Repository.path repo}/projects", opts
end

#update_project(id, options = {}) ⇒ Sawyer::Resource

Update a project

Requires authenticated client

Examples:

Update project name

@client.update_project(123942, name: 'New name')

Parameters:

  • id (Integer)

    Project id

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :name (String)

    Project name

  • :body (String)

    Project body

Returns:

  • (Sawyer::Resource)

    Project

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/projects.rb', line 101

def update_project(id, options = {})
  opts = ensure_api_media_type(:projects, options)
  patch "projects/#{id}", opts
end

#update_project_card(id, options = {}) ⇒ Sawyer::Resource

Update a project card

Requires authenticated client

Examples:

@client.update_project_card(12345, note: 'new note')

Parameters:

  • id (Integer)

    Project card id

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :note (String)

    The card's note content. Only valid for cards without another type of content, so this cannot be specified if the card already has a content_id and content_type.

Returns:

  • (Sawyer::Resource)

    Updated project card

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/projects.rb', line 271

def update_project_card(id, options = {})
  opts = ensure_api_media_type(:projects, options)
  patch "projects/columns/cards/#{id}", opts
end

#update_project_column(id, name, options = {}) ⇒ Sawyer::Resource

Update a project column

Requires authenticated client

Examples:

@client.update_project_column(30294, "new column name")

Parameters:

  • id (Integer)

    Project column id

  • name (String)

    New column name

Returns:

  • (Sawyer::Resource)

    Updated column

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/projects.rb', line 170

def update_project_column(id, name, options = {})
  opts = ensure_api_media_type(:projects, options)
  opts[:name] = name
  patch "projects/columns/#{id}", opts
end