Class: Basecamp3::Project

Inherits:
Model
  • Object
show all
Defined in:
lib/basecamp3/models/project.rb

Overview

Constant Summary

REQUIRED_FIELDS =
%w(name)

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Model

#initialize

Constructor Details

This class inherits a constructor from Basecamp3::Model

Instance Attribute Details

#bookmarked ⇒ Object

Returns the value of attribute bookmarked



5
6
7
# File 'lib/basecamp3/models/project.rb', line 5

def bookmarked
  @bookmarked
end

#created_at ⇒ Object

Returns the value of attribute created_at



5
6
7
# File 'lib/basecamp3/models/project.rb', line 5

def created_at
  @created_at
end

#description ⇒ Object

Returns the value of attribute description



5
6
7
# File 'lib/basecamp3/models/project.rb', line 5

def description
  @description
end

#id ⇒ Object

Returns the value of attribute id



5
6
7
# File 'lib/basecamp3/models/project.rb', line 5

def id
  @id
end

#name ⇒ Object

Returns the value of attribute name



5
6
7
# File 'lib/basecamp3/models/project.rb', line 5

def name
  @name
end

#status ⇒ Object

Returns the value of attribute status



5
6
7
# File 'lib/basecamp3/models/project.rb', line 5

def status
  @status
end

#updated_at ⇒ Object

Returns the value of attribute updated_at



5
6
7
# File 'lib/basecamp3/models/project.rb', line 5

def updated_at
  @updated_at
end

Class Method Details

.all(params = {}) ⇒ Array<Basecamp3::Project>

Returns a paginated list of active projects (basecamps) visible to the current user sorted by most recently created project (basecamp) first.

will return archived or trashed projects (basecamps) visible to the current user

Parameters:

  • params (Hash) (defaults to: {}) —

    additional parameters

Options Hash (params):

  • :page (Integer) — default: optional —

    to paginate results

  • :status (String) — default: optional —

    when set to archived or trashed,

Returns:



24
25
26
# File 'lib/basecamp3/models/project.rb', line 24

def self.all(params = {})
  Basecamp3.request.get("/projects", params, Basecamp3::Project)
end

.create(data) ⇒ Basecamp3::Project

Creates a project.

Parameters:

  • data (Hash) —

    the data to create a project with

  • params (Hash) —

    a customizable set of options

Returns:



44
45
46
47
# File 'lib/basecamp3/models/project.rb', line 44

def self.create(data)
  self.validate_required(data)
  Basecamp3.request.post("/projects", data, Basecamp3::Project)
end

.delete(id) ⇒ Boolean

Deletes the project.

Parameters:

  • id (Integer) —

    the id of the project

Returns:

  • (Boolean)


67
68
69
# File 'lib/basecamp3/models/project.rb', line 67

def self.delete(id)
  Basecamp3.request.delete("/projects/#{id}")
end

.find(id) ⇒ Basecamp3::Project

Returns the project (basecamp).

Parameters:

  • id (Integer) —

    the id of the project

Returns:



33
34
35
# File 'lib/basecamp3/models/project.rb', line 33

def self.find(id)
  Basecamp3.request.get("/projects/#{id}", {}, Basecamp3::Project)
end

.update(id, data) ⇒ Basecamp3::Project

Updates the project.

Parameters:

  • id (Integer) —

    the id of the project

  • data (Hash) —

    the data to update the project with

  • params (Hash) —

    a customizable set of options

Returns:



57
58
59
60
# File 'lib/basecamp3/models/project.rb', line 57

def self.update(id, data)
  self.validate_required(data)
  Basecamp3.request.put("/projects/#{id}", data, Basecamp3::Project)
end