Class: ZohoBooks::Item

Inherits:
Object
  • Object
show all
Defined in:
lib/zoho_books/item.rb

Class Method Summary collapse

Class Method Details

.create(body, opts = {}) ⇒ Object



13
14
15
# File 'lib/zoho_books/item.rb', line 13

def self.create(body, opts = {})
  ZohoBooks::Connection.post("#{BASE_URL}/items?organization_id=#{ZohoBooks.config.organization_id}", body.to_json)
end

.delete(id, opts = {}) ⇒ Object



21
22
23
# File 'lib/zoho_books/item.rb', line 21

def self.delete(id, opts = {})
  ZohoBooks::Connection.delete("#{BASE_URL}/items/#{id}?organization_id=#{ZohoBooks.config.organization_id}")
end

.list(opts = {}) ⇒ Object



8
9
10
11
# File 'lib/zoho_books/item.rb', line 8

def self.list(opts = {})
  query = opts.map { |k, v| "#{k}=#{v}" }.join('&')
  ZohoBooks::Connection.get("#{BASE_URL}/items?organization_id=#{ZohoBooks.config.organization_id}&#{query}")
end

.update(id, body, opts = {}) ⇒ Object



17
18
19
# File 'lib/zoho_books/item.rb', line 17

def self.update(id, body, opts = {})
  ZohoBooks::Connection.put("#{BASE_URL}/items/#{id}?organization_id=#{ZohoBooks.config.organization_id}", body.to_json)
end