Class: Harvest::API::InvoiceCategories
- Inherits:
-
Base
- Object
- Base
- Harvest::API::InvoiceCategories
- Includes:
- Behavior::Crud
- Defined in:
- lib/forecast/api/invoice_categories.rb
Instance Method Summary collapse
Instance Method Details
#create(model) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/forecast/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 ⇒ Object
7 8 9 |
# File 'lib/forecast/api/invoice_categories.rb', line 7 def find(*) raise "find is unsupported for InvoiceCategories" end |
#update(model, user = nil) ⇒ Object
18 19 20 21 22 |
# File 'lib/forecast/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 |