Module: KayakoClient::PostClient
- Included in:
- TicketPost
- Defined in:
- lib/kayako_client/mixins/post_client.rb
Instance Method Summary collapse
- #attachments(options = {}) ⇒ Object
- #delete_attachment(attachment, options = {}) ⇒ Object (also: #destroy_attachment)
- #get_attachment(attachment, options = {}) ⇒ Object (also: #find_attachment)
- #post_attachment(options = {}) ⇒ Object (also: #create_attachment)
Instance Method Details
#attachments(options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/kayako_client/mixins/post_client.rb', line 18 def ( = {}) values = [] if ticket_id && id items = KayakoClient::TicketAttachment.all(ticket_id, .merge()) items.each do |item| values << item if item.ticket_post_id == id end end values end |
#delete_attachment(attachment, options = {}) ⇒ Object Also known as: destroy_attachment
49 50 51 |
# File 'lib/kayako_client/mixins/post_client.rb', line 49 def (, = {}) KayakoClient::TicketAttachment.delete(ticket_id, , .merge()) if ticket_id end |
#get_attachment(attachment, options = {}) ⇒ Object Also known as: find_attachment
29 30 31 |
# File 'lib/kayako_client/mixins/post_client.rb', line 29 def (, = {}) KayakoClient::TicketAttachment.get(ticket_id, , .merge()) if ticket_id end |
#post_attachment(options = {}) ⇒ Object Also known as: create_attachment
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/kayako_client/mixins/post_client.rb', line 35 def ( = {}) if ticket_id && id if logger logger.warn "overwriting :ticket_id" if [:ticket_id] && [:ticket_id].to_i != ticket_id logger.warn "overwriting :ticket_post_id" if [:ticket_post_id] && [:ticket_post_id].to_i != id end [:ticket_id] = ticket_id [:ticket_post_id] = id KayakoClient::TicketAttachment.post(.merge()) end end |