Class: Rexpense::Resources::Expense

Inherits:
ResourceBase show all
Includes:
Attachment, Comment, Participant
Defined in:
lib/rexpense/resources/expense.rb

Overview

A wrapper to Rexpense expenses API

API

Documentation: developers.rexpense.com/api/v1/expenses/

Instance Attribute Summary

Attributes inherited from Base

#http

Instance Method Summary collapse

Methods included from Attachment

#attachments, #destroy_attachment, #find_attachment

Methods included from Participant

#leave_participant, #participants

Methods included from Comment

#comments, #create_comment, #destroy_comment, #find_comment, #update_comment

Methods inherited from ResourceBase

#create, #destroy, #find, #find_all, #update

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Rexpense::Resources::Base

Instance Method Details

#mentionables(id) ⇒ Object



26
27
28
29
30
# File 'lib/rexpense/resources/expense.rb', line 26

def mentionables(id)
  http.get("#{endpoint_base}/#{id}/mentionables") do |response|
    Rexpense::Entities::UserCollection.build response.parsed_body
  end
end

#status(id) ⇒ Object



14
15
16
17
18
# File 'lib/rexpense/resources/expense.rb', line 14

def status(id)
  http.get("#{search_endpoint}/#{id}/status") do |response|
    Rexpense::Entities::ExpenseStatus.new response.parsed_body
  end
end

#update_status(id, params) ⇒ Object



20
21
22
23
24
# File 'lib/rexpense/resources/expense.rb', line 20

def update_status(id, params)
  http.put("#{search_endpoint}/#{id}/status", body: params) do |response|
    Rexpense::Entities::ExpenseStatus.new response.parsed_body
  end
end