Class: EasyqaApi::TestModule

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

Overview

Test module representation from EasyQA website

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

#attributesHash

Returns item attributes from response body in your requests.

Returns:

  • (Hash)

    item attributes from response body in your requests



21
# File 'lib/easyqa_api/items/test_module.rb', line 21

attr_accessor :title, :id, :attributes, :project_token, :test_plan_id

#idFixnum

Returns The uniq identeficator item on EasyQA website.

Returns:

  • (Fixnum)

    The uniq identeficator item on EasyQA website



21
# File 'lib/easyqa_api/items/test_module.rb', line 21

attr_accessor :title, :id, :attributes, :project_token, :test_plan_id

#project_tokenString

Returns your project token.

Returns:

  • (String)

    your project token



21
# File 'lib/easyqa_api/items/test_module.rb', line 21

attr_accessor :title, :id, :attributes, :project_token, :test_plan_id

#test_plan_idString

Returns Test plan id on EasyQA.

Returns:

  • (String)

    Test plan id on EasyQA



21
# File 'lib/easyqa_api/items/test_module.rb', line 21

attr_accessor :title, :id, :attributes, :project_token, :test_plan_id

#titleString

Returns Test module title on EasyQA.

Returns:

  • (String)

    Test module title on EasyQA



21
22
23
# File 'lib/easyqa_api/items/test_module.rb', line 21

def title
  @title
end

Class Method Details

.all(project_token, test_plan_id, user = @@default_user) ⇒ Array

List of all test modules

Parameters:

  • test_plan_id (Fixnum)

    Test plan id on EasyQA website

  • project_token (String)

    token of project

  • user (Easyqapi::User) (defaults to: @@default_user)

    authenticated user in EasyQA

Returns:

  • (Array)

    list of test modules on EasyQA website

See Also:



31
32
33
34
35
36
37
38
# File 'lib/easyqa_api/items/test_module.rb', line 31

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

Instance Method Details

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

Create test module on EasyQA website. Have a class method analog

Parameters:

  • user (Easyqapi::User) (defaults to: @@default_user)

    authenticated user in EasyQA

  • attrs (Hash)

    attributes for action

Options Hash (attrs):

  • :project_token (String) — default: @project_token

    Project token on EasyQA

  • :title (String)

    test module title on EasyQA website

  • :description (String)

    test module description

  • :parent_id (Fixnum)

    id of parent test module. If you give this parameter, this test module will be nested in parent test module.

  • :test_plan_id (Fixnum) — default: @test_plan_id

    Test plan id

Returns:

  • (Hash)

    item attribtues on EasyQA website

See Also:



43
44
45
46
47
48
49
50
51
52
# File 'lib/easyqa_api/items/test_module.rb', line 43

def create(attrs, user = @@default_user)
  attrs = { project_token: @project_token, test_plan_id: @test_plan_id }.merge(attrs)
  @attributes = send_request("test_plans/#{attrs[:test_plan_id]}/test_modules", :post) do |req|
    req.body = {
      test_module: attrs.except(:project_token, :test_plan_id),
      token: attrs[:project_token],
      auth_token: user.auth_token
    }
  end
end

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

Delete Test Case on EasyQA website. Have a class method analog

Parameters:

  • user (Easyqapi::User) (defaults to: @@default_user)

    authenticated user in EasyQA

  • project_token (String) (defaults to: @project_token)

    token of project

  • id (String) (defaults to: @id)

    item id

Returns:

  • (Hash)

    item attribtues on EasyQA website

See Also:



81
82
83
84
85
86
87
88
# File 'lib/easyqa_api/items/test_module.rb', line 81

def delete(project_token = @project_token, id = @id, user = @@default_user)
  @attributes = send_request("test_modules/#{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) ⇒ Hash

Show Test Case from EasyQA website. Have a class method analog

Parameters:

  • user (Easyqapi::User) (defaults to: @@default_user)

    authenticated user in EasyQA

  • project_token (String) (defaults to: @project_token)

    token of project

  • id (String) (defaults to: @id)

    item id

Returns:

  • (Hash)

    item attribtues on EasyQA website

See Also:



56
57
58
59
60
61
62
63
# File 'lib/easyqa_api/items/test_module.rb', line 56

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

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

Update Test Case on EasyQA website. Have a class method analog

Parameters:

  • user (Easyqapi::User) (defaults to: @@default_user)

    authenticated user in EasyQA

  • attrs (Hash)

    attributes for action

Options Hash (attrs):

  • :project_token (String) — default: @project_token

    Project token on EasyQA

  • :title (String)

    test module title on EasyQA website

  • :description (String)

    test module description

  • :parent_id (Fixnum)

    id of parent test module. If you give this parameter, this test module will be nested in parent test module.

  • :id (Fixnum) — default: @id

    item id

Returns:

  • (Hash)

    item attribtues on EasyQA website

See Also:



68
69
70
71
72
73
74
75
76
77
# File 'lib/easyqa_api/items/test_module.rb', line 68

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