Class: TicketAbstractorClient::Jira::Attachment
- Inherits:
-
Base::Attachment
- Object
- Base::Attachment
- TicketAbstractorClient::Jira::Attachment
- Defined in:
- lib/ticket_abstractor_client/jira/attachment.rb
Constant Summary
Constants inherited from Base::Attachment
Base::Attachment::SANITIZE_REGEXP
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#project ⇒ Object
Returns the value of attribute project.
-
#ticket_id ⇒ Object
Returns the value of attribute ticket_id.
Attributes inherited from Base::Attachment
#communications_stack, #data_hash, #external_created_at, #file_path
Class Method Summary collapse
- .fetch_by_id_and_name(id, name, endpoint) ⇒ Object
- .fetch_by_ticket_id(ticket_id, endpoint) ⇒ Object (also: fetch)
Instance Method Summary collapse
-
#initialize(opts) ⇒ Attachment
constructor
A new instance of Attachment.
- #sync! ⇒ Object
Methods inherited from Base::Attachment
#set_data_hash!, #to_hash, #to_json
Constructor Details
#initialize(opts) ⇒ Attachment
Returns a new instance of Attachment.
31 32 33 34 |
# File 'lib/ticket_abstractor_client/jira/attachment.rb', line 31 def initialize(opts) super(opts) @ticket_id, @endpoint, @project = opts.values_at(:ticket_id, :endpoint, :project) end |
Instance Attribute Details
#endpoint ⇒ Object
Returns the value of attribute endpoint.
4 5 6 |
# File 'lib/ticket_abstractor_client/jira/attachment.rb', line 4 def endpoint @endpoint end |
#project ⇒ Object
Returns the value of attribute project.
4 5 6 |
# File 'lib/ticket_abstractor_client/jira/attachment.rb', line 4 def project @project end |
#ticket_id ⇒ Object
Returns the value of attribute ticket_id.
4 5 6 |
# File 'lib/ticket_abstractor_client/jira/attachment.rb', line 4 def ticket_id @ticket_id end |
Class Method Details
.fetch_by_id_and_name(id, name, endpoint) ⇒ Object
7 8 9 10 |
# File 'lib/ticket_abstractor_client/jira/attachment.rb', line 7 def fetch_by_id_and_name(id, name, endpoint) file_path = (id, name, endpoint) new(file_path: file_path, endpoint: endpoint) end |
.fetch_by_ticket_id(ticket_id, endpoint) ⇒ Object Also known as: fetch
12 13 14 15 16 17 18 19 20 |
# File 'lib/ticket_abstractor_client/jira/attachment.rb', line 12 def fetch_by_ticket_id(ticket_id, endpoint) ticket = Client.new(endpoint).get_ticket_by_id(ticket_id: ticket_id, fields: :attachment) ticket['fields']['attachment'].each_with_object([]) do |hash, | = fetch_by_id_and_name(hash['id'], hash['filename'], endpoint) .ticket_id = ticket_id << end end |