Class: Harvest::API::InvoiceCategories
- Inherits:
-
Base
- Object
- Base
- Harvest::API::InvoiceCategories
show all
- Includes:
- Behavior::Crud
- Defined in:
- lib/harvest/api/invoice_categories.rb
Instance Attribute Summary
Attributes inherited from Base
#credentials
Instance Method Summary
(collapse)
#all, #delete
Methods inherited from Base
api_model, #initialize
Instance Method Details
- (Object) create(model)
11
12
13
14
15
16
|
# 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.["location"].match(/\/.*\/(\d+)/)[1]
all.detect {|c| c.id == id.to_i }
end
|
- (Object) find
7
8
9
|
# File 'lib/harvest/api/invoice_categories.rb', line 7
def find(*)
raise "find is unsupported for InvoiceCategories"
end
|
- (Object) update(model, user = nil)
18
19
20
21
22
|
# 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
|