Class: EasyqaApi::IssueAttachment
- Defined in:
- lib/easyqa_api/items/issue_attachment.rb
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.
-
#issue_id ⇒ Object
Returns the value of attribute issue_id.
-
#project_token ⇒ Object
Returns the value of attribute project_token.
Instance Method Summary collapse
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_attachment.rb', line 3 def attributes @attributes end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/easyqa_api/items/issue_attachment.rb', line 3 def id @id end |
#issue_id ⇒ Object
Returns the value of attribute issue_id.
3 4 5 |
# File 'lib/easyqa_api/items/issue_attachment.rb', line 3 def issue_id @issue_id end |
#project_token ⇒ Object
Returns the value of attribute project_token.
3 4 5 |
# File 'lib/easyqa_api/items/issue_attachment.rb', line 3 def project_token @project_token end |
Instance Method Details
#create(attrs, user = @@default_user) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/easyqa_api/items/issue_attachment.rb', line 7 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) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/easyqa_api/items/issue_attachment.rb', line 18 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 |