Class: EasyqaApi::IssueAttachment
- Defined in:
- lib/easyqa_api/items/issue_attachment.rb
Overview
Representation Issue attachment on EasyQA
Constant Summary
Constants inherited from Item
Constants included from ClassMethodsSettable
Instance Attribute Summary collapse
-
#attributes ⇒ Hash
Item attributes from response body in your requests.
-
#id ⇒ Fixnum
The uniq identeficator item on EasyQA website.
- #issue_id ⇒ Fixnum, String
-
#project_token ⇒ String
Your project token.
Instance Method Summary collapse
-
#create(attrs, user = @@default_user) ⇒ Hash
Create attachment on EasyQA website.
-
#delete(attrs = {}, user = @@default_user) ⇒ Hash
Delete attachment 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 item attributes from response body in your requests.
9 |
# File 'lib/easyqa_api/items/issue_attachment.rb', line 9 attr_accessor :id, :attributes, :project_token, :issue_id |
#id ⇒ Fixnum
Returns The uniq identeficator item on EasyQA website.
9 10 11 |
# File 'lib/easyqa_api/items/issue_attachment.rb', line 9 def id @id end |
#issue_id ⇒ Fixnum, String
9 |
# File 'lib/easyqa_api/items/issue_attachment.rb', line 9 attr_accessor :id, :attributes, :project_token, :issue_id |
#project_token ⇒ String
Returns your project token.
9 |
# File 'lib/easyqa_api/items/issue_attachment.rb', line 9 attr_accessor :id, :attributes, :project_token, :issue_id |
Instance Method Details
#create(attrs, user = @@default_user) ⇒ Hash
Create attachment on EasyQA website. Have a class method analog
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/easyqa_api/items/issue_attachment.rb', line 17 def create(attrs, user = @@default_user) attrs = { project_token: @project_token, issue_id: @issue_id }.merge(attrs) attrs[:issue_id] = "pid#{attrs.delete(:issue_id_in_project)}" if attrs[:issue_id_in_project] @attributes = send_request("issues/#{attrs[:issue_id]}/attachments", :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) ⇒ Hash
Delete attachment on EasyQA website. Have a class method analog
30 31 32 33 34 35 36 37 38 |
# File 'lib/easyqa_api/items/issue_attachment.rb', line 30 def delete(attrs = {}, user = @@default_user) attrs = { id: @id, project_token: @project_token }.merge(attrs) @attributes = send_request("attachments/#{attrs[:id]}", :delete) do |req| req.params = { token: attrs[:project_token], auth_token: user.auth_token } end end |