Class: BugherdClient::Resources::V2::Project

Inherits:
Base
  • Object
show all
Defined in:
lib/bugherd_client/resources/v2/project.rb

Constant Summary

Constants inherited from Base

Base::DEFAULT_HEADERS

Instance Attribute Summary

Attributes inherited from Base

#connection, #options

Instance Method Summary collapse

Methods inherited from Base

#initialize, #parse_response, #send_request

Constructor Details

This class inherits a constructor from BugherdClient::Resources::V2::Base

Instance Method Details

#activeObject

Get all active projects



72
73
74
75
# File 'lib/bugherd_client/resources/v2/project.rb', line 72

def active
  raw_response = get_request('projects/active')
  parse_response(raw_response, :projects)
end

#add_guest(project_id, attributes = {}) ⇒ Object

Add an existing guest to a project, or invite someone by email address. required: project_id attributes: user_id, email API: 2



53
54
55
56
# File 'lib/bugherd_client/resources/v2/project.rb', line 53

def add_guest(project_id, attributes={})
  raw_response = post_request("projects/#{project_id}/add_guest", attributes)
  parse_response(raw_response)
end

#add_member(project_id, attributes = {}) ⇒ Object

Add an existing guest to a project, or invite someone by email address. required: project_id attributes: user_id



63
64
65
66
# File 'lib/bugherd_client/resources/v2/project.rb', line 63

def add_member(project_id, attributes={})
  raw_response = post_request("projects/#{project_id}/add_member", attributes)
  parse_response(raw_response)
end

#allObject

Get more detail of your account.



10
11
12
13
# File 'lib/bugherd_client/resources/v2/project.rb', line 10

def all
  raw_response = get_request('projects')
  parse_response(raw_response, :projects)
end

#create(attributes = {}) ⇒ Object

Create a Project, will initially have no members attributes: name, devurl, is_public, is_active



27
28
29
30
# File 'lib/bugherd_client/resources/v2/project.rb', line 27

def create(attributes={})
  raw_response = post_request("projects", project: attributes)
  parse_response(raw_response, :project)
end

#delete(project_id) ⇒ Object

Delete a project and all associated data. Use with care, deleted projects cannot be recovered. API: 1,2



43
44
45
46
# File 'lib/bugherd_client/resources/v2/project.rb', line 43

def delete(project_id)
  raw_response = delete_request("projects/#{project_id}")
  parse_response(raw_response)
end

#find(project_id) ⇒ Object

Show details for a specific project



18
19
20
21
# File 'lib/bugherd_client/resources/v2/project.rb', line 18

def find(project_id)
  raw_response = get_request("projects/#{project_id}")
  parse_response(raw_response, :project)
end

#update(project_id, attributes = {}) ⇒ Object

Update settings for an existing project under your control (ie: only the ones you own). API: 1,2



35
36
37
38
# File 'lib/bugherd_client/resources/v2/project.rb', line 35

def update(project_id, attributes={})
  raw_response = put_request("projects/#{project_id}", project: attributes)
  parse_response(raw_response, :project)
end