class FreeAgent::BillsResource
Public Instance Methods
create(contact:, dated_on:, due_on:, reference:, bill_items:, **params)
click to toggle source
# File lib/free_agent/resources/bills.rb, line 24 def create(contact:, dated_on:, due_on:, reference:, bill_items:, **params) attributes = {contact: contact, dated_on: dated_on, due_on: due_on, reference: reference, bill_items: bill_items} response = post_request("bills", body: {bill: attributes.merge(params)}) Bill.new(response.body["bill"]) if response.success? end
delete(id:)
click to toggle source
# File lib/free_agent/resources/bills.rb, line 36 def delete(id:) response = delete_request("bills/#{id}") response.success? end
list(**params)
click to toggle source
# File lib/free_agent/resources/bills.rb, line 4 def list(**params) response = get_request("bills", params: params) Collection.from_response(response, type: Bill, key: "bills") end
list_for_contact(contact:, **params)
click to toggle source
# File lib/free_agent/resources/bills.rb, line 9 def list_for_contact(contact:, **params) response = get_request("bills?contact=#{contact}", params: params) Collection.from_response(response, type: Bill, key: "bills") end
list_for_project(project:, **params)
click to toggle source
# File lib/free_agent/resources/bills.rb, line 14 def list_for_project(project:, **params) response = get_request("bills?project=#{project}", params: params) Collection.from_response(response, type: Bill, key: "bills") end
retrieve(id:)
click to toggle source
# File lib/free_agent/resources/bills.rb, line 19 def retrieve(id:) response = get_request("bills/#{id}") Bill.new(response.body["bill"]) end
update(id:, **params)
click to toggle source
# File lib/free_agent/resources/bills.rb, line 31 def update(id:, **params) response = put_request("bills/#{id}", body: {bill: params}) Bill.new(response.body["bill"]) if response.success? end