Class: ContactsClient

Inherits:
Object
  • Object
show all
Defined in:
lib/lockstep_sdk/clients/contacts.rb

Instance Method Summary collapse

Constructor Details

#initialize(lockstepsdk) ⇒ ContactsClient

Initialize the ContactsClient class with a lockstepsdk instance.

Parameters:

  • lockstepsdk (LockstepApi)

    The Lockstep API client object for this connection



24
25
26
# File 'lib/lockstep_sdk/clients/contacts.rb', line 24

def initialize(lockstepsdk)
    @lockstepsdk = lockstepsdk
end

Instance Method Details

#create_contacts(body:) ⇒ Object

Creates one or more contacts from a given model.

A Contact contains information about a person or role within a Company. You can use Contacts to track information about who is responsible for a specific project, who handles invoices, or information about which role at a particular customer or vendor you should speak with about invoices.

Parameters:

  • body (ContactModel)

    The Contacts to create



65
66
67
68
# File 'lib/lockstep_sdk/clients/contacts.rb', line 65

def create_contacts(body:)
    path = "/api/v1/Contacts"
    @lockstepsdk.request(:post, path, body, nil)
end

#disable_contact(id:) ⇒ Object

Disable the Contact referred to by this unique identifier.

A Contact contains information about a person or role within a Company. You can use Contacts to track information about who is responsible for a specific project, who handles invoices, or information about which role at a particular customer or vendor you should speak with about invoices.

Parameters:

  • id (uuid)

    The unique Lockstep Platform ID number of the Contact to disable; NOT the customer's ERP key



55
56
57
58
# File 'lib/lockstep_sdk/clients/contacts.rb', line 55

def disable_contact(id:)
    path = "/api/v1/Contacts/#{id}"
    @lockstepsdk.request(:delete, path, nil, nil)
end

#query_contacts(filter:, include_param:, order:, page_size:, page_number:) ⇒ Object

Queries Contacts for this account using the specified filtering, sorting, nested fetch, and pagination rules requested.

More information on querying can be found on the [Searchlight Query Language](developer.lockstep.io/docs/querying-with-searchlight) page on the Lockstep Developer website. A Contact contains information about a person or role within a Company. You can use Contacts to track information about who is responsible for a specific project, who handles invoices, or information about which role at a particular customer or vendor you should speak with about invoices.

Parameters:



79
80
81
82
83
# File 'lib/lockstep_sdk/clients/contacts.rb', line 79

def query_contacts(filter:, include_param:, order:, page_size:, page_number:)
    path = "/api/v1/Contacts/query"
    params = {:filter => filter, :include => include_param, :order => order, :pageSize => page_size, :pageNumber => page_number}
    @lockstepsdk.request(:get, path, nil, params)
end

#retrieve_contact(id:, include_param:) ⇒ Object

Retrieves the Contact specified by this unique identifier, optionally including nested data sets. A Contact contains information about a person or role within a Company. You can use Contacts to track information about who is responsible for a specific project, who handles invoices, or information about which role at a particular customer or vendor you should speak with about invoices.

Parameters:

  • id (uuid)

    The unique Lockstep Platform ID number of this Contact; NOT the customer's ERP key

  • include_param (string)

    To fetch additional data on this object, specify the list of elements to retrieve. Available collections: Attachments, CustomFields, Notes



33
34
35
36
37
# File 'lib/lockstep_sdk/clients/contacts.rb', line 33

def retrieve_contact(id:, include_param:)
    path = "/api/v1/Contacts/#{id}"
    params = {:include => include_param}
    @lockstepsdk.request(:get, path, nil, params)
end

#update_contact(id:, body:) ⇒ Object

Updates a contact that matches the specified id with the requested information.

The PATCH method allows you to change specific values on the object while leaving other values alone. As input you should supply a list of field names and new values. If you do not provide the name of a field, that field will remain unchanged. This allows you to ensure that you are only updating the specific fields desired. A Contact contains information about a person or role within a Company. You can use Contacts to track information about who is responsible for a specific project, who handles invoices, or information about which role at a particular customer or vendor you should speak with about invoices.

Parameters:

  • id (uuid)

    The unique Lockstep Platform ID number of the Contact to update; NOT the customer's ERP key

  • body (object)

    A list of changes to apply to this Contact



45
46
47
48
# File 'lib/lockstep_sdk/clients/contacts.rb', line 45

def update_contact(id:, body:)
    path = "/api/v1/Contacts/#{id}"
    @lockstepsdk.request(:patch, path, body.to_camelback_keys.to_json, nil)
end