Class: OnlyofficeTestrailWrapper::TestrailProject

Inherits:
TestrailApiObject show all
Includes:
ProjectCleanup, TestrailProjectMilestoneMethods, TestrailProjectPlanHelper, TestrailProjectRunMethods, TestrailProjectSuiteMethods
Defined in:
lib/onlyoffice_testrail_wrapper/testrail_project.rb

Overview

Class for working with Test Projects

Author:

  • Roman.Zagudaev

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TestrailProjectSuiteMethods

#create_new_suite, #get_suite_by_id, #get_suite_by_name, #get_suites, #init_suite_by_name, #suite, #suites

Methods included from TestrailProjectRunMethods

#create_new_run, #get_run_by_id, #get_run_by_name, #get_runs, #init_run_by_name, #runs, #runs_older_than_days, #test_run

Methods included from TestrailProjectPlanHelper

#create_new_plan, #get_plan_by_id, #get_plan_by_name, #get_plans, #init_plan_by_name, #plan, #plan_by_name, #plans

Methods included from TestrailProjectMilestoneMethods

#create_new_milestone, #get_milestone_by_id, #get_milestone_by_name, #get_milestones, #init_milestone_by_name, #milestone

Methods included from ProjectCleanup

#close_old_runs

Methods inherited from TestrailApiObject

#init_from_hash, #name_id_pairs

Constructor Details

#initialize(name = '', announcement = nil, show_announcement = true, is_completed = false, id = nil) ⇒ TestRunTestRail

Default constructor

Parameters:

  • id (id) (defaults to: nil)

    id of project, default = nil

  • name (String) (defaults to: '')

    name of project, default = nil

  • announcement (String) (defaults to: nil)

    announcement of project, default = nil

  • is_completed (true, false) (defaults to: false)

    is project completed, default = nil



51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/onlyoffice_testrail_wrapper/testrail_project.rb', line 51

def initialize(name = '', announcement = nil, show_announcement = true, is_completed = false, id = nil)
  super()
  @id = id.to_i
  @name = name
  @announcement = announcement
  @show_announcement = show_announcement
  @is_completed = is_completed
  @suites_names = {}
  @runs_names = {}
  @plans_names = {}
  @milestones_names = {}
end

Instance Attribute Details

#announcementString

Returns announcement string.

Returns:

  • (String)

    announcement string



27
28
29
# File 'lib/onlyoffice_testrail_wrapper/testrail_project.rb', line 27

def announcement
  @announcement
end

#completed_onString

Returns Date, when test completed.

Returns:

  • (String)

    Date, when test completed



33
34
35
# File 'lib/onlyoffice_testrail_wrapper/testrail_project.rb', line 33

def completed_on
  @completed_on
end

#idInteger

Returns Id of project.

Returns:

  • (Integer)

    Id of project



23
24
25
# File 'lib/onlyoffice_testrail_wrapper/testrail_project.rb', line 23

def id
  @id
end

#is_completedtrue, false

Returns is project completed.

Returns:

  • (true, false)

    is project completed



31
32
33
# File 'lib/onlyoffice_testrail_wrapper/testrail_project.rb', line 31

def is_completed
  @is_completed
end

#milestones_namesArray<String>

Returns name of milestones.

Returns:

  • (Array<String>)

    name of milestones



43
44
45
# File 'lib/onlyoffice_testrail_wrapper/testrail_project.rb', line 43

def milestones_names
  @milestones_names
end

#nameString

Returns Name of project.

Returns:

  • (String)

    Name of project



25
26
27
# File 'lib/onlyoffice_testrail_wrapper/testrail_project.rb', line 25

def name
  @name
end

#plans_namesArray<String>

Returns name of planes.

Returns:

  • (Array<String>)

    name of planes



41
42
43
# File 'lib/onlyoffice_testrail_wrapper/testrail_project.rb', line 41

def plans_names
  @plans_names
end

#runs_namesArray<String>

Returns name of runs.

Returns:

  • (Array<String>)

    name of runs



39
40
41
# File 'lib/onlyoffice_testrail_wrapper/testrail_project.rb', line 39

def runs_names
  @runs_names
end

#show_announcementtrue, false

Returns is show announcement option enabled.

Returns:

  • (true, false)

    is show announcement option enabled



29
30
31
# File 'lib/onlyoffice_testrail_wrapper/testrail_project.rb', line 29

def show_announcement
  @show_announcement
end

#suites_namesArray<String>

Returns name of suites.

Returns:

  • (Array<String>)

    name of suites



37
38
39
# File 'lib/onlyoffice_testrail_wrapper/testrail_project.rb', line 37

def suites_names
  @suites_names
end

#urlString

Returns url to project.

Returns:

  • (String)

    url to project



35
36
37
# File 'lib/onlyoffice_testrail_wrapper/testrail_project.rb', line 35

def url
  @url
end

Instance Method Details

#deleteObject



74
75
76
77
# File 'lib/onlyoffice_testrail_wrapper/testrail_project.rb', line 74

def delete
  Testrail2.http_post "index.php?/api/v2/delete_project/#{@id}", {}
  OnlyofficeLoggerHelper.log "Deleted project: #{@name}"
end

#update(is_completed = false, name = @name, announcement = @announcement, show_announcement = @show_announcement) ⇒ Object



64
65
66
67
68
69
70
71
72
# File 'lib/onlyoffice_testrail_wrapper/testrail_project.rb', line 64

def update(is_completed = false, name = @name, announcement = @announcement, show_announcement = @show_announcement)
  updated_project = TestrailProject.new.init_from_hash(Testrail2.http_post("index.php?/api/v2/update_project/#{@id}",
                                                                           name: name,
                                                                           announcement: announcement,
                                                                           show_announcement: show_announcement,
                                                                           is_completed: is_completed))
  OnlyofficeLoggerHelper.log "Updated project: #{updated_project.name}"
  updated_project
end