Class: OnlyofficeTestrailWrapper::TestrailMilestone

Inherits:
TestrailApiObject show all
Defined in:
lib/onlyoffice_testrail_wrapper/testrail_milestone.rb

Overview

Class for describing milestone data

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from TestrailApiObject

#init_from_hash, #name_id_pairs

Constructor Details

#initialize(name = '', description = '', is_completed = false, id = nil) ⇒ TestrailMilestone

Returns a new instance of TestrailMilestone.



15
16
17
18
19
20
21
# File 'lib/onlyoffice_testrail_wrapper/testrail_milestone.rb', line 15

def initialize(name = '', description = '', is_completed = false, id = nil)
  super()
  @id = id.to_i
  @name = name
  @description = description
  @is_completed = is_completed
end

Instance Attribute Details

#descriptionString

Returns description of milestone.

Returns:

  • (String)

    description of milestone



11
12
13
# File 'lib/onlyoffice_testrail_wrapper/testrail_milestone.rb', line 11

def description
  @description
end

#idInteger

Returns id of milestone.

Returns:

  • (Integer)

    id of milestone



7
8
9
# File 'lib/onlyoffice_testrail_wrapper/testrail_milestone.rb', line 7

def id
  @id
end

#is_completedBoolean

Returns is this milestone completed.

Returns:

  • (Boolean)

    is this milestone completed



13
14
15
# File 'lib/onlyoffice_testrail_wrapper/testrail_milestone.rb', line 13

def is_completed
  @is_completed
end

#nameString

Returns name of milestone.

Returns:

  • (String)

    name of milestone



9
10
11
# File 'lib/onlyoffice_testrail_wrapper/testrail_milestone.rb', line 9

def name
  @name
end

Instance Method Details

#deleteHash

Delete current milestone

Returns:

  • (Hash)

    result of http request



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

def delete
  Testrail2.http_post "index.php?/api/v2/delete_milestone/#{@id}", {}
end

#update(is_completed = false, name = @name, description = @description) ⇒ TestrailMilestone

Update current milestone

Parameters:

  • is_completed (Boolean) (defaults to: false)

    is milestone should be completed

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

    new name of milestone

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

    new description of milestone

Returns:



28
29
30
31
32
33
# File 'lib/onlyoffice_testrail_wrapper/testrail_milestone.rb', line 28

def update(is_completed = false, name = @name, description = @description)
  TestrailMilestone.new.init_from_hash(Testrail2.http_post("index.php?/api/v2/update_milestone/#{@id}",
                                                           name: name,
                                                           description: description,
                                                           is_completed: is_completed))
end