Module: Rexpense::Resources::Attachment
- Included in:
- Expense
- Defined in:
- lib/rexpense/resources/nested_endpoints/attachment.rb
Instance Method Summary collapse
-
#attachments(resource_id) ⇒ Object
Get resource attachments.
-
#destroy_attachment(resource_id, attachment_id) ⇒ Object
Destroy resource attachment.
-
#find_attachment(resource_id, attachment_id) ⇒ Object
Get resource attachment.
Instance Method Details
#attachments(resource_id) ⇒ Object
Get resource attachments
- API
-
Method:
GET /api/v1/expenses/:id/attachments
Documentation: developers.rexpense.com/api/attachments#index
10 11 12 13 14 |
# File 'lib/rexpense/resources/nested_endpoints/attachment.rb', line 10 def (resource_id) http.get((resource_id)) do |response| Rexpense::Entities::AttachmentCollection.build response end end |
#destroy_attachment(resource_id, attachment_id) ⇒ Object
Destroy resource attachment
- API
-
Method:
DELETE /api/v1/expenses/:id/attachments/:id
Documentation: developers.rexpense.com/api/attachments#show
36 37 38 39 40 |
# File 'lib/rexpense/resources/nested_endpoints/attachment.rb', line 36 def (resource_id, ) http.delete("#{(resource_id)}/#{}") do |response| true end end |
#find_attachment(resource_id, attachment_id) ⇒ Object
Get resource attachment
- API
-
Method:
GET /api/v1/expenses/:id/attachments/:id
Documentation: developers.rexpense.com/api/attachments#show
23 24 25 26 27 |
# File 'lib/rexpense/resources/nested_endpoints/attachment.rb', line 23 def (resource_id, ) http.get("#{(resource_id)}/#{}") do |response| Rexpense::Entities::Attachment.new response.parsed_body end end |