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_HEADER_ATTRS

Instance Attribute Summary

Attributes inherited from Base

#connection, #options

Instance Method Summary collapse

Methods inherited from Base

#api_methods, #converter, #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



81
82
83
84
# File 'lib/bugherd_client/resources/v2/project.rb', line 81

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



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

def add_guest(project_id, attributes={})
  raw_response = post_request("projects/#{project_id}/add_guest", attributes)
  parse_response(raw_response, :project)
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



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

def add_member(project_id, attributes={})
  raw_response = post_request("projects/#{project_id}/add_member", attributes)
  parse_response(raw_response, :project)
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

Create a new project. The project will initially have no members. POST /api_v2/projects.json

PARAMS:

"name": "My Website",
"devurl": "http://www.example.com",
"is_active": true,
"is_public": false



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

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



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

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



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

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