Class: CompaniesClient

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

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ CompaniesClient

Initialize the CompaniesClient class with an API client instance.

Parameters:

  • connection (LockstepApi)

    The API client object for this connection



22
23
24
# File 'lib/lockstep_sdk/clients/companies_client.rb', line 22

def initialize(connection)
    @connection = connection
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



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

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

#delete_companies(body:) ⇒ Object

Delete the Companies referred to by these unique identifiers.

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 (BulkDeleteRequestModel)

    The unique Lockstep Platform ID numbers of the Companies to delete; NOT the customer’s ERP key



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

def delete_companies(body:)
    path = "/api/v1/Companies"
    @connection.request(:delete, path, body, nil)
end

#delete_company(id:) ⇒ Object

Delete 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



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

def delete_company(id:)
    path = "/api/v1/Companies/#{id}"
    @connection.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 250, maximum of 500)

  • page_number (int32)

    The page number for results (default 0)



111
112
113
114
115
# File 'lib/lockstep_sdk/clients/companies_client.rb', line 111

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}
    @connection.request(:get, path, nil, params)
end

#query_customer_summary(filter:, include_param:, order:, page_size:, page_number:, report_date:) ⇒ 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 250, maximum of 500)

  • page_number (int32)

    The page number for results (default 0)

  • report_date (date-time)

    The date to calculate the fields on. If no date is entered the current UTC date will be used.



132
133
134
135
136
# File 'lib/lockstep_sdk/clients/companies_client.rb', line 132

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

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

Queries Vendor 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 Vendor 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 Vendor 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 250, maximum of 500)

  • page_number (int32)

    The page number for results (default 0)

  • report_date (date-time)

    The date to calculate the fields on. If no date is entered the current UTC date will be used.



153
154
155
156
157
# File 'lib/lockstep_sdk/clients/companies_client.rb', line 153

def query_vendor_summary(filter:, include_param:, order:, page_size:, page_number:, report_date:)
    path = "/api/v1/Companies/views/vendor-summary"
    params = {:filter => filter, :include => include_param, :order => order, :pageSize => page_size, :pageNumber => page_number, :reportDate => report_date}
    @connection.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



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

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

#retrieve_company_detail(id:) ⇒ Object

Retrieves the Company Details specified by this unique identifier, optionally including nested data sets.

The Company 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 Company 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 company’s ERP key



167
168
169
170
# File 'lib/lockstep_sdk/clients/companies_client.rb', line 167

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

#set_company_logo(id:, min_x:, min_y:, width:, height:, filename:) ⇒ Object

Sets the logo for specified company. The logo will be stored in the Lockstep Platform and will be **publicly accessible**.

.jpg, .jpeg, .png, and .webp are supported. 2MB maximum. If no logo is uploaded, the existing logo will be deleted.

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.

Optional view box meta data for the provided logo may be supplied using the following query parameters. Please note that you must supply either all of the values or none of the values. <ul><li>min_x</li><li>min_y</li><li>width</li><li>height</li></ul>

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

  • min_x (double)

    ViewBox minX setting for this Company’s logo.

  • min_y (double)

    ViewBox minY setting for this Company’s logo.

  • width (double)

    ViewBox width setting for this Company’s logo.

  • height (double)

    ViewBox height setting for this Company’s logo.

  • filename (File)

    The full path of a file to upload to the API



189
190
191
192
193
# File 'lib/lockstep_sdk/clients/companies_client.rb', line 189

def (id:, min_x:, min_y:, width:, height:, filename:)
    path = "/api/v1/Companies/#{id}/logo"
    params = {:min_x => min_x, :min_y => min_y, :width => width, :height => height}
    @connection.request(:post, path, nil, params)
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



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

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

#update_logo_view_box_settings(id:, body:) ⇒ Object

Update view box meta data for the given Company id.

Parameters:

  • id (uuid)

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

  • body (ViewBoxSettingsModel)

    The ‘ViewBoxSettingsModel` containing meta data value updates



200
201
202
203
# File 'lib/lockstep_sdk/clients/companies_client.rb', line 200

def update_logo_view_box_settings(id:, body:)
    path = "/api/v1/Companies/#{id}/logo-settings"
    @connection.request(:patch, path, body, nil)
end