Class: EasyqaApi::Issue
Overview
The class for representation EasyQA Issue object
Constant Summary
Constants inherited from Item
Constants included from ClassMethodsSettable
Instance Attribute Summary collapse
-
#attributes ⇒ Hash
Attributes item from response body in your requests.
- #id ⇒ Fixnum, String
-
#project_token ⇒ String
Your project token.
Class Method Summary collapse
-
.all(project_token, user = @@default_user) ⇒ Array
Retrieve all issues in project.
Instance Method Summary collapse
-
#create(attrs, user = @@default_user) ⇒ Hash
Create new issue on EasyQA website.
-
#delete(attrs = {}, user = @@default_user) ⇒ Hash
Delete issue on EasyQA website.
-
#show(attrs = {}, user = @@default_user) ⇒ Hash
Show issue attributes on EasyQA website.
-
#update(attrs, user = @@default_user) ⇒ Hash
Update issue on EasyQA website.
Methods inherited from Item
#initialize, #install_variables!, json_connection, multipart_connection, operation_status, send_request
Methods included from ClassMethodsSettable
Constructor Details
This class inherits a constructor from EasyqaApi::Item
Instance Attribute Details
#attributes ⇒ Hash
Returns attributes item from response body in your requests.
30 |
# File 'lib/easyqa_api/items/issue.rb', line 30 attr_accessor :id, :attributes, :project_token |
#id ⇒ Fixnum, String
30 31 32 |
# File 'lib/easyqa_api/items/issue.rb', line 30 def id @id end |
#project_token ⇒ String
Returns 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
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
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((attrs[:attachments])) end end |
#delete(attrs = {}, user = @@default_user) ⇒ Hash
Delete issue on EasyQA website. Have a class method analog
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
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
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 |