Class: LeanTesting::ProjectBugsHandler

Inherits:
EntityHandler show all
Defined in:
lib/Handler/Project/ProjectBugsHandler.rb

Instance Method Summary collapse

Methods inherited from EntityHandler

#delete, #find, #update

Constructor Details

#initialize(origin, projectID) ⇒ ProjectBugsHandler

Returns a new instance of ProjectBugsHandler.



4
5
6
7
8
# File 'lib/Handler/Project/ProjectBugsHandler.rb', line 4

def initialize(origin, projectID)
	super(origin)

	@projectID = projectID
end

Instance Method Details

#all(filters = nil) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/Handler/Project/ProjectBugsHandler.rb', line 55

def all(filters = nil)
	if !filters
		filters = {}
	end

	super

	filters = {'include' => 'steps,platform,attachments,comments,tags'}.merge(filters)

	request = APIRequest.new(@origin, '/v1/projects/' + @projectID.to_s() + '/bugs', 'GET')
	EntityList.new(@origin, request, Bug, filters)
end

#create(fields) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/Handler/Project/ProjectBugsHandler.rb', line 10

def create(fields)
	super

	supports = {
		'title'              => true,
		'status_id'          => true,
		'severity_id'        => true,
		'project_version'    => true,
		'project_version_id' => true,
		'project_section_id' => false,
		'type_id'            => false,
		'reproducibility_id' => false,
		'assigned_user_id'   => false,
		'description'        => false,
		'expected_results'   => false,
		'steps'              => false,
		'platform'           => false
		# 'device_model'       => false,
		# 'device_model_id'    => false,
		# 'os'                 => false,
		# 'os_version'         => false,
		# 'os_version_id'      => false,
		# 'browser_version_id' => false
	}

	if fields.has_key? 'project_version_id'
		supports['project_version'] = false
	elsif fields.has_key? 'project_version'
		supports['project_version_id'] = false
	end

	if enforce(fields, supports)
		fields = {'include' => 'steps,platform'}.merge(fields)

		req = APIRequest.new(
			@origin,
			'/v1/projects/' + @projectID.to_s() + '/bugs',
			'POST',
			{'params' => fields}
		)

		Bug.new(@origin, req.exec)
	end
end