class Koho::Client

Constants

API_BASE_URL

Attributes

company_id[RW]
token[RW]

Public Class Methods

new(company_id, token) click to toggle source
# File lib/koho.rb, line 23
def initialize company_id, token
  @company_id = company_id
  @token = token
end

Public Instance Methods

contracts() click to toggle source
# File lib/koho.rb, line 49
def contracts; Contracts.new company_id, token; end
customers() click to toggle source
# File lib/koho.rb, line 45
def customers; Customers.new company_id, token; end
delete(action) click to toggle source
# File lib/koho.rb, line 41
def delete action
  JSON.parse((self.class.delete action, {method: '_DELETE', body: {company_id: @company_id, token: @token}}).response.body)
end
get(action, data = {}) click to toggle source
# File lib/koho.rb, line 28
def get action, data = {}
  res = (self.class.get action, query: data.merge(company_id: @company_id, token: @token)).response.body
  JSON.parse(res)
end
inbound_invoices() click to toggle source
# File lib/koho.rb, line 47
def inbound_invoices; InboundInvoices.new company_id, token; end
info() click to toggle source

3

# File lib/koho.rb, line 56
def info 
  get '/info'
end
invoice_terms() click to toggle source
# File lib/koho.rb, line 48
def invoice_terms; InvoiceTerms.new company_id, token; end
invoices() click to toggle source
# File lib/koho.rb, line 46
def invoices; Invoices.new company_id, token; end
post(action, data = {}) click to toggle source
# File lib/koho.rb, line 33
def post action, data = {}
  JSON.parse((self.class.post action, {method: '_POST', body: {company_id: @company_id, token: @token}.merge(data)}).response.body)
end
project_tasks() click to toggle source
# File lib/koho.rb, line 51
def project_tasks; ProjectTasks.new company_id, token; end
projects() click to toggle source
# File lib/koho.rb, line 50
def projects; Projects.new company_id, token; end
put(action, data = {}) click to toggle source
# File lib/koho.rb, line 37
def put action, data = {}
  JSON.parse((self.class.put action, {method: '_PUT', body: {company_id: @company_id, token: @token}.merge(data)}).response.body)
end
work_sessions() click to toggle source
# File lib/koho.rb, line 52
def work_sessions; WorkSessions.new company_id, token; end