Class: EasyqaApi::Issue
Constant Summary
Constants inherited from Item
Constants included from ClassMethodsSettable
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#id ⇒ Object
Returns the value of attribute id.
-
#project_token ⇒ Object
Returns the value of attribute project_token.
Class Method Summary collapse
Instance Method Summary collapse
- #create(attrs, user = @@default_user) ⇒ Object
- #delete(attrs = {}, user = @@default_user) ⇒ Object
- #show(attrs = {}, user = @@default_user) ⇒ Object
- #update(attrs, user = @@default_user) ⇒ Object
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 ⇒ Object
Returns the value of attribute attributes.
3 4 5 |
# File 'lib/easyqa_api/items/issue.rb', line 3 def attributes @attributes end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/easyqa_api/items/issue.rb', line 3 def id @id end |
#project_token ⇒ Object
Returns the value of attribute project_token.
3 4 5 |
# File 'lib/easyqa_api/items/issue.rb', line 3 def project_token @project_token end |
Class Method Details
.all(project_token, user = @@default_user) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/easyqa_api/items/issue.rb', line 7 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) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/easyqa_api/items/issue.rb', line 16 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)) end end |
#delete(attrs = {}, user = @@default_user) ⇒ Object
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/easyqa_api/items/issue.rb', line 48 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) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/easyqa_api/items/issue.rb', line 26 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) ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/easyqa_api/items/issue.rb', line 37 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 |