Class: ContactsClient

Inherits:
Object
  • Object
show all
Defined in:
lib/lockstep_sdk/clients/contacts_client.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



25
26
27
# File 'lib/lockstep_sdk/clients/contacts_client.rb', line 25

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



70
71
72
73
# File 'lib/lockstep_sdk/clients/contacts_client.rb', line 70

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



59
60
61
62
# File 'lib/lockstep_sdk/clients/contacts_client.rb', line 59

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:



85
86
87
88
89
# File 'lib/lockstep_sdk/clients/contacts_client.rb', line 85

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



35
36
37
38
39
# File 'lib/lockstep_sdk/clients/contacts_client.rb', line 35

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



48
49
50
51
# File 'lib/lockstep_sdk/clients/contacts_client.rb', line 48

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