Class: CompaniesClient

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

Instance Method Summary collapse

Constructor Details

#initialize(lockstepsdk) ⇒ CompaniesClient

Initialize the CompaniesClient class with a lockstepsdk instance.

Parameters:

  • lockstepsdk (LockstepApi)

    The Lockstep API client object for this connection



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

def initialize(lockstepsdk)
    @lockstepsdk = lockstepsdk
end

Instance Method Details

#create_companies(body:) ⇒ Object

Creates one or more Companies from a given model. A Company represents a customer, a vendor, or a company within the organization of the account holder. Companies can have parents and children, representing an organizational hierarchy of corporate entities. You can use Companies to track projects and financial data under this Company label.

See [Vendors, Customers, and Companies](developer.lockstep.io/docs/companies-customers-and-vendors) for more information.

Parameters:

  • body (CompanyModel)

    The Companies to create



76
77
78
79
# File 'lib/lockstep_sdk/clients/companies_client.rb', line 76

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

#disable_company(id:) ⇒ Object

Disable the Company referred to by this unique identifier.

A Company represents a customer, a vendor, or a company within the organization of the account holder. Companies can have parents and children, representing an organizational hierarchy of corporate entities. You can use Companies to track projects and financial data under this Company label.

See [Vendors, Customers, and Companies](developer.lockstep.io/docs/companies-customers-and-vendors) for more information.

Parameters:

  • id (uuid)

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



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

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

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

Queries Companies 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 Company represents a customer, a vendor, or a company within the organization of the account holder. Companies can have parents and children, representing an organizational hierarchy of corporate entities. You can use Companies to track projects and financial data under this Company label.

See [Vendors, Customers, and Companies](developer.lockstep.io/docs/companies-customers-and-vendors) for more information.

Parameters:

  • filter (string)

    The filter for this query. See [Searchlight Query Language](developer.lockstep.io/docs/querying-with-searchlight)

  • include_param (string)

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

  • order (string)

    The sort order for the results, in the [Searchlight order syntax](github.com/tspence/csharp-searchlight).

  • page_size (int32)

    The page size for results (default 200, maximum of 10,000)

  • page_number (int32)

    The page number for results (default 0)



93
94
95
96
97
# File 'lib/lockstep_sdk/clients/companies_client.rb', line 93

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

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

Queries Customer Summaries 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. The Customer Summary View represents a slightly different view of the data and includes some extra fields that might be useful. For more information, see the data format of the Customer Summary Model. See [Vendors, Customers, and Companies](developer.lockstep.io/docs/companies-customers-and-vendors) for more information.

Parameters:

  • filter (string)

    The filter for this query. See [Searchlight Query Language](developer.lockstep.io/docs/querying-with-searchlight)

  • include_param (string)

    To fetch additional data on this object, specify the list of elements to retrieve. No collections are currently available but may be offered in the future

  • order (string)

    The sort order for the results, in the [Searchlight order syntax](github.com/tspence/csharp-searchlight).

  • page_size (int32)

    The page size for results (default 200, maximum of 10,000)

  • page_number (int32)

    The page number for results (default 0)



109
110
111
112
113
# File 'lib/lockstep_sdk/clients/companies_client.rb', line 109

def query_customer_summary(filter:, include_param:, order:, page_size:, page_number:)
    path = "/api/v1/Companies/views/customer-summary"
    params = {:filter => filter, :include => include_param, :order => order, :pageSize => page_size, :pageNumber => page_number}
    @lockstepsdk.request(:get, path, nil, params)
end

#retrieve_company(id:, include_param:) ⇒ Object

Retrieves the Company specified by this unique identifier, optionally including nested data sets. A Company represents a customer, a vendor, or a company within the organization of the account holder. Companies can have parents and children, representing an organizational hierarchy of corporate entities. You can use Companies to track projects and financial data under this Company label.

See [Vendors, Customers, and Companies](developer.lockstep.io/docs/companies-customers-and-vendors) for more information.

Parameters:

  • id (uuid)

    The unique Lockstep Platform ID number of this Company; 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, Contacts, CustomFields, Invoices, Notes, Classification



37
38
39
40
41
# File 'lib/lockstep_sdk/clients/companies_client.rb', line 37

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

#retrieve_customer_detail(id:) ⇒ Object

Retrieves the Customer Details specified by this unique identifier, optionally including nested data sets. The Customer Detail View represents a slightly different view of the data and includes some extra fields that might be useful. For more information, see the data format of the Customer Detail Model. See [Vendors, Customers, and Companies](developer.lockstep.io/docs/companies-customers-and-vendors) for more information.

Parameters:

  • id (uuid)

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



119
120
121
122
# File 'lib/lockstep_sdk/clients/companies_client.rb', line 119

def retrieve_customer_detail(id:)
    path = "/api/v1/Companies/views/customer-details/#{id}"
    @lockstepsdk.request(:get, path, nil, nil)
end

#update_company(id:, body:) ⇒ Object

Updates a Company 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 Company represents a customer, a vendor, or a company within the organization of the account holder. Companies can have parents and children, representing an organizational hierarchy of corporate entities. You can use Companies to track projects and financial data under this Company label.

See [Vendors, Customers, and Companies](developer.lockstep.io/docs/companies-customers-and-vendors) for more information.

Parameters:

  • id (uuid)

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

  • body (object)

    A list of changes to apply to this Company



52
53
54
55
# File 'lib/lockstep_sdk/clients/companies_client.rb', line 52

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