Class: Harvest::API::InvoiceCategories
Instance Attribute Summary
Attributes inherited from Base
#credentials
Instance Method Summary
collapse
#all, #delete
Methods inherited from Base
api_model, #initialize
Instance Method Details
#create(model) ⇒ Object
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
|
#find ⇒ Object
7
8
9
|
# File 'lib/harvest/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/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
|