Class: Unfuzzle::Project

Inherits:
Object
  • Object
show all
Includes:
Graft
Defined in:
lib/unfuzzle/lib/unfuzzle/project.rb

Overview

Project

Represents an Unfuddle project. Has the following attributes:

id

The unique identifier for this project

slug

The “short name” for this project

name

The name of this project

description

The description for the project

archived

The archived status of this project (see Project#archived?)

created_at

The date/time that this project was created

updated_at

The date/time that this project was last updated

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Graft

included

Class Method Details

.allObject

Return a list of all projects to which the current user has access



29
30
31
32
# File 'lib/unfuzzle/lib/unfuzzle/project.rb', line 29

def self.all
  response = Request.get('/projects')
  collection_from(response.body, 'projects/project')
end

.find_by_id(id) ⇒ Object

Find a single project by its ID



41
42
43
44
# File 'lib/unfuzzle/lib/unfuzzle/project.rb', line 41

def self.find_by_id(id)
  response = Request.get("/projects/#{id}")
  new(response.body)
end

.find_by_slug(slug) ⇒ Object

Find a single project by its slug (short name)



35
36
37
38
# File 'lib/unfuzzle/lib/unfuzzle/project.rb', line 35

def self.find_by_slug(slug)
  response = Request.get("/projects/by_short_name/#{slug}")
  new(response.body)
end

Instance Method Details

#archived?Boolean

Has this project been archived?

Returns:

  • (Boolean)


47
48
49
# File 'lib/unfuzzle/lib/unfuzzle/project.rb', line 47

def archived?
  archived == true
end

#milestonesObject

The collection of Milestones associated to this project



52
53
54
# File 'lib/unfuzzle/lib/unfuzzle/project.rb', line 52

def milestones
  Milestone.find_all_by_project_id(id)
end

#ticketsObject

The collection of Tickets associated to this project



57
58
59
# File 'lib/unfuzzle/lib/unfuzzle/project.rb', line 57

def tickets
  Ticket.find_all_by_project_id(id)
end