Class: EasyqaApi::Issue

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

Overview

The class for representation EasyQA Issue object

Constant Summary

Constants inherited from Item

EasyqaApi::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 attributes item from response body in your requests.

Returns:

  • (Hash)

    attributes item from response body in your requests



30
# File 'lib/easyqa_api/items/issue.rb', line 30

attr_accessor :id, :attributes, :project_token

#idFixnum, String

Returns:

  • (Fixnum)

    The uniq identeficator issue in EasyQA website

  • (String)

    The uniq identeficator issue in yuor project. In format “pid_your_id_”



30
31
32
# File 'lib/easyqa_api/items/issue.rb', line 30

def id
  @id
end

#project_tokenString

Returns your project token.

Returns:

  • (String)

    your project token



30
# File 'lib/easyqa_api/items/issue.rb', line 30

attr_accessor :id, :attributes, :project_token

Class Method Details

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

Retrieve all issues in project

Parameters:

  • project_token (String)

    token of project

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

    authenticated user in EasyQA

Returns:

  • (Array)

    list of issues on EasyQA website

See Also:



39
40
41
42
43
44
45
46
# File 'lib/easyqa_api/items/issue.rb', line 39

def self.all(project_token, user = @@default_user)
  send_request('issues', :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 new issue 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

    token of Project on EasyQA

  • :summary (String)

    issue summary. This options required for create issue

  • :test_object_id (Fixnum)

    test object uniq identefiactor on EasyQA

  • :description (String)

    issue description

  • :issue_type (String)

    Issue type. Can be in ‘no_type’, ‘documentation’, ‘task’, ‘feature’, ‘usability_problem’, ‘bug’, ‘crash’

  • :priority (String)

    Issue priority. Can be in ‘low’, ‘medium’, ‘high’, ‘critical’

  • :assigner_id (Fixnum)

    Issue assigner uniq identeficator on EasyQA

  • :attachments (Array<Faraday::UploadIO>)

    Array of attachments

Returns:

  • (Hash)

    item attribtues on EasyQA website

See Also:



50
51
52
53
54
55
56
57
58
59
# File 'lib/easyqa_api/items/issue.rb', line 50

def create(attrs, user = @@default_user)
  attrs = { project_token: @project_token }.merge(attrs)
  @attributes = send_request('projects/issues/create', :post, :multipart) do |req|
    req.body = {
      token: attrs[:project_token],
      auth_token: user.auth_token
    }.merge(attrs.except(:project_token, :attachments))
     .merge(retrieve_attachments(attrs[:attachments]))
  end
end

#delete(attrs = {}, user = @@default_user) ⇒ Hash

Delete issue on EasyQA website. Have a class method analog

Parameters:

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

    authenticated user in EasyQA

  • attrs (Hash) (defaults to: {})

    attributes for action

Options Hash (attrs):

  • :project_token (String) — default: @project_token

    Project token on EasyQA

  • :id (Fixnum) — default: @id

    uniq item identeficator

  • :id_in_project (Fixnum)

    uniq issue identeficator in project

Returns:

  • (Hash)

    item attribtues on EasyQA website

See Also:



91
92
93
94
95
96
97
98
99
100
# File 'lib/easyqa_api/items/issue.rb', line 91

def delete(attrs = {}, user = @@default_user)
  attrs = { id: @id, project_token: @project_token }.merge(attrs)
  attrs[:id] = "pid#{attrs.delete(:id_in_project)}" if attrs[:id_in_project]
  @attributes = send_request("issues/#{attrs[:id]}", :delete) do |req|
    req.params = {
      token: attrs[:project_token],
      auth_token: user.auth_token
    }
  end
end

#show(attrs = {}, user = @@default_user) ⇒ Hash

Show issue attributes on EasyQA website. Have a class method analog

Parameters:

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

    authenticated user in EasyQA

  • attrs (Hash) (defaults to: {})

    attributes for action

Options Hash (attrs):

  • :project_token (String) — default: @project_token

    Project token on EasyQA

  • :id (Fixnum) — default: @id

    uniq item identeficator

  • :id_in_project (Fixnum)

    uniq issue identeficator in project

Returns:

  • (Hash)

    item attribtues on EasyQA website

See Also:



63
64
65
66
67
68
69
70
71
72
# File 'lib/easyqa_api/items/issue.rb', line 63

def show(attrs = {}, user = @@default_user)
  attrs = { id: @id, project_token: @project_token }.merge(attrs)
  attrs[:id] = "pid#{attrs.delete(:id_in_project)}" if attrs[:id_in_project]
  @attributes = send_request("issues/#{id}", :get) do |req|
    req.params = {
      token: attrs[:project_token],
      auth_token: user.auth_token
    }
  end
end

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

Update issue 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

    token of Project on EasyQA

  • :summary (String)

    issue summary. This options required for create issue

  • :test_object_id (Fixnum)

    test object uniq identefiactor on EasyQA

  • :description (String)

    issue description

  • :issue_type (String)

    Issue type. Can be in ‘no_type’, ‘documentation’, ‘task’, ‘feature’, ‘usability_problem’, ‘bug’, ‘crash’

  • :priority (String)

    Issue priority. Can be in ‘low’, ‘medium’, ‘high’, ‘critical’

  • :assigner_id (Fixnum)

    Issue assigner uniq identeficator on EasyQA

  • :attachments (Array<Faraday::UploadIO>)

    Array of attachments

  • :id_in_project (Fixnum)

    uniq issue identeficator in project

  • :id (Fixnum)

    uniq issue identeficator on EasyQA

Returns:

  • (Hash)

    item attribtues on EasyQA website

See Also:



78
79
80
81
82
83
84
85
86
87
# File 'lib/easyqa_api/items/issue.rb', line 78

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