class Myfinance::Resources::Sale

Public Instance Methods

create(entity_id, params = {}) click to toggle source
# File lib/myfinance/resources/sale.rb, line 17
def create(entity_id, params = {})
  path = "/entities/#{entity_id}/sales/"
  http.post(path, body: { sale: params }) do |response|
    respond_with_object(response, "sale")
  end
end
destroy(entity_id, sale_id, params = {}) click to toggle source
# File lib/myfinance/resources/sale.rb, line 31
def destroy(entity_id, sale_id, params = {})
  path = "/entities/#{entity_id}/sales/#{sale_id}"
  http.delete(path, body: { sale: params }) do |response|
    response
  end
end
find(entity_id, sale_id) click to toggle source
# File lib/myfinance/resources/sale.rb, line 10
def find(entity_id, sale_id)
  path = "/entities/#{entity_id}/sales/#{sale_id}"
  http.get(path, body: {}) do |response|
    respond_with_object(response, "sale")
  end
end
find_all(entity_id) click to toggle source
# File lib/myfinance/resources/sale.rb, line 4
def find_all(entity_id)
  http.get("/entities/#{entity_id}/sales", body: {}) do |response|
    respond_with_collection(response)
  end
end
update(entity_id, sale_id, params = {}) click to toggle source
# File lib/myfinance/resources/sale.rb, line 24
def update(entity_id, sale_id, params = {})
  path = "/entities/#{entity_id}/sales/#{sale_id}"
  http.put(path, body: { sale: params }) do |response|
    respond_with_object(response, "sale")
  end
end