Class: LimdeskApi::Client

Inherits:
LimdeskObject show all
Defined in:
lib/limdesk_api/client.rb

Overview

Client

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from LimdeskObject

all, #delete!, get, object_symbol, #object_symbol, #refresh!

Class Method Details

.create(params) ⇒ LimdeskApi::Client

Creates a new Client

Parameters:

  • params (Hash)

    the options to create a client with

Options Hash (params):

  • :name (String)

    client’s name

  • :nippesel (String)

    unique ID like VATID, passport

  • :phone (String)

    client’s phone number

  • :email (String)

    client’s email address

  • :address (String)

    client’s personal/company address

Returns:



14
15
16
# File 'lib/limdesk_api/client.rb', line 14

def self.create(params)
  super
end

.get_by(action, query) ⇒ LimdeskApi::Client

Gets a Client by property

Parameters:

  • action (String)

    search type

  • query (String)

    search data

Returns:



24
25
26
27
28
29
# File 'lib/limdesk_api/client.rb', line 24

def self.get_by(action, query)
  response = LimdeskApi.get_one object: object_symbol,
                                action: action,
                                query: query
  response ? new(response) : nil
end

.get_by_email(email) ⇒ LimdeskApi::Client

Gets a Client by e-mail

Parameters:

  • email (String)

    find by e-mail

Returns:



36
37
38
# File 'lib/limdesk_api/client.rb', line 36

def self.get_by_email(email)
  get_by('get_by_email', email)
end

.get_by_nippesel(nippesel) ⇒ LimdeskApi::Client

Gets a Client by nippesel (it’s taxid, document_id or other government issued unique id number)

Parameters:

  • phone (String)

    find by phone

Returns:



55
56
57
# File 'lib/limdesk_api/client.rb', line 55

def self.get_by_nippesel(nippesel)
  get_by('get_by_nippesel', nippesel)
end

.get_by_outside_client_id(outside_client_id) ⇒ LimdeskApi::Client

Gets a Client by outside_client_id

Parameters:

  • outside_client_id (String)

    find by outside_client_id

Returns:



64
65
66
# File 'lib/limdesk_api/client.rb', line 64

def self.get_by_outside_client_id(outside_client_id)
  get_by('get_by_outside_id', outside_client_id)
end

.get_by_phone(phone) ⇒ LimdeskApi::Client

Gets a Client by phone

Parameters:

  • phone (String)

    find by phone

Returns:



45
46
47
# File 'lib/limdesk_api/client.rb', line 45

def self.get_by_phone(phone)
  get_by('get_by_phone', phone)
end

Instance Method Details

#update(params) ⇒ LimdeskApi::Client

updates a client

Parameters:

  • params (Hash)

    new client data

Returns:



73
74
75
76
77
# File 'lib/limdesk_api/client.rb', line 73

def update(params)
  LimdeskApi.put object: object_symbol,
                 params: params,
                 id: id
end