Class: Kaseya::BMS::Client::Accounts

Inherits:
Api
  • Object
show all
Defined in:
lib/kaseya/bms/client/accounts.rb

Instance Attribute Summary

Attributes inherited from Api

#connection

Instance Method Summary collapse

Methods inherited from Api

#get_many, #get_one, #initialize, #post, #put

Constructor Details

This class inherits a constructor from Kaseya::BMS::Api

Instance Method Details

#activities(id, params = {}) ⇒ Object



40
41
42
# File 'lib/kaseya/bms/client/accounts.rb', line 40

def activities(id, params = {})
  get_many "crm/accounts/#{id}/activity", params
end

#all(params = {}) ⇒ Object



3
4
5
# File 'lib/kaseya/bms/client/accounts.rb', line 3

def all(params = {})
  get_many "crm/accounts", params
end

#create(params = {}) ⇒ Object



11
12
13
# File 'lib/kaseya/bms/client/accounts.rb', line 11

def create(params = {})
  post "crm/accounts", params
end

#delete(id) ⇒ Object



19
20
21
# File 'lib/kaseya/bms/client/accounts.rb', line 19

def delete(id)
  delete "crm/accounts/#{id}"
end

#find(id) ⇒ Object



7
8
9
# File 'lib/kaseya/bms/client/accounts.rb', line 7

def find(id)
  get_one "crm/accounts/#{id}"
end

#linked(id, params = {}) ⇒ Object



44
45
46
# File 'lib/kaseya/bms/client/accounts.rb', line 44

def linked(id, params = {})
  get_many "crm/accounts/#{id}/linkedaccounts", params
end

#locations(id, params = {}) ⇒ Object



23
24
25
# File 'lib/kaseya/bms/client/accounts.rb', line 23

def locations(id, params = {})
  get_many "crm/accounts/#{id}/locations", params
end

#main_location(id) ⇒ Object



27
28
29
30
# File 'lib/kaseya/bms/client/accounts.rb', line 27

def main_location(id)
  response = get_many("crm/accounts/#{id}/locations", top: 1, filter: "IsMain eq true")
  response.first
end

#main_location_id(id) ⇒ Object



32
33
34
# File 'lib/kaseya/bms/client/accounts.rb', line 32

def main_location_id(id)
  (main_location(id) || {})["Id"]
end

#new_type(params = {}) ⇒ Object



52
53
54
# File 'lib/kaseya/bms/client/accounts.rb', line 52

def new_type(params = {})
  post "crm/accounts/types", params
end

#notes(id, params = {}) ⇒ Object



36
37
38
# File 'lib/kaseya/bms/client/accounts.rb', line 36

def notes(id, params = {})
  get_many "crm/accounts/#{id}/notes", params
end

#types(params = {}) ⇒ Object



48
49
50
# File 'lib/kaseya/bms/client/accounts.rb', line 48

def types(params = {})
  get_many "crm/accounts/types", params
end

#update(id, params = {}) ⇒ Object



15
16
17
# File 'lib/kaseya/bms/client/accounts.rb', line 15

def update(id, params = {})
  put "crm/accounts/#{id}", params
end