class Harvest::API::InvoiceCategories

Public Instance Methods

create(model) click to toggle source
# File lib/harvest/api/invoice_categories.rb, line 11
def create(model)
  model = api_model.wrap(model)
  response = request(:post, credentials, "#{api_model.api_path}", :body => model.to_json)
  id = response.headers["location"].match(/\/.*\/(\d+)/)[1]
  all.detect {|c| c.id == id.to_i }
end
find(*) click to toggle source
# File lib/harvest/api/invoice_categories.rb, line 7
def find(*)
  raise "find is unsupported for InvoiceCategories"
end
update(model, user = nil) click to toggle source
# File lib/harvest/api/invoice_categories.rb, line 18
def update(model, user = nil)
  model = api_model.wrap(model)
  request(:put, credentials, "#{api_model.api_path}/#{model.to_i}", :body => model.to_json, :query => of_user_query(user))
  all.detect {|c| c.id == model.id }
end