Class: EasyqaApi::TestPlan

Inherits:
Item
  • Object
show all
Defined in:
lib/easyqa_api/items/test_plan.rb

Constant Summary

Constants inherited from Item

Item::CONNECTION

Constants included from ClassMethodsSettable

ClassMethodsSettable::METHODS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Item

#initialize, #install_variables!, json_connection, multipart_connection, operation_status, send_request

Methods included from ClassMethodsSettable

#install_class_methods!

Constructor Details

This class inherits a constructor from EasyqaApi::Item

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



3
4
5
# File 'lib/easyqa_api/items/test_plan.rb', line 3

def attributes
  @attributes
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/easyqa_api/items/test_plan.rb', line 3

def id
  @id
end

#project_tokenObject

Returns the value of attribute project_token.



3
4
5
# File 'lib/easyqa_api/items/test_plan.rb', line 3

def project_token
  @project_token
end

#titleObject

Returns the value of attribute title.



3
4
5
# File 'lib/easyqa_api/items/test_plan.rb', line 3

def title
  @title
end

Class Method Details

.all(project_token, user = @@default_user) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/easyqa_api/items/test_plan.rb', line 7

def self.all(project_token, user = @@default_user)
  send_request('test_plans', :get) do |req|
    req.params = {
      auth_token: user.auth_token,
      token: project_token
    }
  end
end

Instance Method Details

#create(attrs, user = @@default_user) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/easyqa_api/items/test_plan.rb', line 16

def create(attrs, user = @@default_user)
  attrs = { project_token: @project_token }.merge(attrs)
  @attributes = send_request('test_plans', :post) do |req|
    req.body = {
      test_plan: attrs.except(:project_token),
      token: attrs[:project_token],
      auth_token: user.auth_token
    }
  end
end

#delete(project_token = @project_token, id = @id, user = @@default_user) ⇒ Object



47
48
49
50
51
52
53
54
# File 'lib/easyqa_api/items/test_plan.rb', line 47

def delete(project_token = @project_token, id = @id, user = @@default_user)
  @attributes = send_request("test_plans/#{id}", :delete) do |req|
    req.params = {
      token: project_token,
      auth_token: user.auth_token
    }
  end
end

#show(project_token = @project_token, id = @id, user = @@default_user) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/easyqa_api/items/test_plan.rb', line 27

def show(project_token = @project_token, id = @id, user = @@default_user)
  @attributes = send_request("test_plans/#{id}", :get) do |req|
    req.params = {
      token: project_token,
      auth_token: user.auth_token
    }
  end
end

#update(attrs, user = @@default_user) ⇒ Object



36
37
38
39
40
41
42
43
44
45
# File 'lib/easyqa_api/items/test_plan.rb', line 36

def update(attrs, user = @@default_user)
  attrs = { id: @id, project_token: @project_token }.merge(attrs)
  @attributes = send_request("test_plans/#{attrs[:id]}", :put) do |req|
    req.body = {
      test_plan: attrs.except(:project_token),
      token: attrs[:project_token],
      auth_token: user.auth_token
    }
  end
end