Module: Rexpense::Resources::Comment
- Included in:
- Advancement, Expense, Reimbursement
- Defined in:
- lib/rexpense/resources/nested_endpoints/comment.rb
Instance Method Summary collapse
-
#comments(resource_id) ⇒ Object
Get resource comments.
-
#create_comment(resource_id, params) ⇒ Object
Create resource comment.
-
#destroy_comment(resource_id, comment_id) ⇒ Object
Destroy resource comment.
-
#find_comment(resource_id, comment_id) ⇒ Object
Get resource comment.
-
#update_comment(resource_id, comment_id, params) ⇒ Object
Update resource comment.
Instance Method Details
#comments(resource_id) ⇒ Object
Get resource comments
- API
-
Method:
GET /api/v1/reimbursements/:id/commentsMethod:GET /api/v1/expenses/:id/commentsMethod:GET /api/v1/advancements/:id/commentsDocumentation: developers.rexpense.com/api/comments#index
12 13 14 15 16 |
# File 'lib/rexpense/resources/nested_endpoints/comment.rb', line 12 def comments(resource_id) http.get(comment_endpoint(resource_id)) do |response| Rexpense::Entities::CommentCollection.build response end end |
#create_comment(resource_id, params) ⇒ Object
Create resource comment
- API
-
Method:
POST /api/v1/reimbursements/:id/commentsMethod:POST /api/v1/expenses/:id/commentsMethod:POST /api/v1/advancements/:id/commentsDocumentation: developers.rexpense.com/api/comments#create
42 43 44 45 46 |
# File 'lib/rexpense/resources/nested_endpoints/comment.rb', line 42 def create_comment(resource_id, params) http.post(comment_endpoint(resource_id), body: params) do |response| Rexpense::Entities::Comment.new response.parsed_body end end |
#destroy_comment(resource_id, comment_id) ⇒ Object
Destroy resource comment
- API
-
Method:
DELETE /api/v1/reimbursements/:id/comments/:comment_idMethod:DELETE /api/v1/expenses/:id/comments/:comment_idMethod:DELETE /api/v1/advancements/:id/comments/:comment_idDocumentation: developers.rexpense.com/api/comments#destroy
72 73 74 75 76 |
# File 'lib/rexpense/resources/nested_endpoints/comment.rb', line 72 def destroy_comment(resource_id, comment_id) http.delete("#{comment_endpoint(resource_id)}/#{comment_id}") do |response| true end end |
#find_comment(resource_id, comment_id) ⇒ Object
Get resource comment
- API
-
Method:
GET /api/v1/reimbursements/:id/comments/:comment_idMethod:GET /api/v1/expenses/:id/comments/:comment_idMethod:GET /api/v1/advancements/:id/comments/:comment_idDocumentation: developers.rexpense.com/api/comments#show
27 28 29 30 31 |
# File 'lib/rexpense/resources/nested_endpoints/comment.rb', line 27 def find_comment(resource_id, comment_id) http.get("#{comment_endpoint(resource_id)}/#{comment_id}") do |response| Rexpense::Entities::Comment.new response.parsed_body end end |
#update_comment(resource_id, comment_id, params) ⇒ Object
Update resource comment
- API
-
Method:
PUT /api/v1/reimbursements/:id/comments/:comment_idMethod:PUT /api/v1/expenses/:id/comments/:comment_idMethod:PUT /api/v1/advancements/:id/comments/:comment_idDocumentation: developers.rexpense.com/api/comments#update
57 58 59 60 61 |
# File 'lib/rexpense/resources/nested_endpoints/comment.rb', line 57 def update_comment(resource_id, comment_id, params) http.put("#{comment_endpoint(resource_id)}/#{comment_id}", body: params) do |response| Rexpense::Entities::Comment.new response.parsed_body end end |