Class: TheCompaniesAPI::Client

Inherits:
HttpClient show all
Defined in:
lib/thecompaniesapi/client.rb

Overview

The Companies API client with auto-generated methods

This class extends HttpClient with auto-generated methods from the OpenAPI specification.

Constant Summary

Constants inherited from HttpClient

HttpClient::DEFAULT_API_URL, HttpClient::DEFAULT_TIMEOUT

Instance Attribute Summary

Attributes inherited from HttpClient

#api_token, #api_url, #connection, #visitor_id

Instance Method Summary collapse

Methods inherited from HttpClient

#delete, #get, #initialize, #patch, #post, #put

Constructor Details

This class inherits a constructor from TheCompaniesAPI::HttpClient

Instance Method Details

#ask_company(domain, data: {}, headers: {}) ⇒ Hash

Ask a question about a company by its domain.

Parameters:

  • domain (String)

    Path parameter

  • data (Hash) (defaults to: {})

    Request body data

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



248
249
250
251
252
# File 'lib/thecompaniesapi/client.rb', line 248

def ask_company(domain, data: {}, headers: {})
        endpoint = "/v2/companies/#{domain}/ask"

        post(endpoint, body: data)
end

#count_companies(params: {}, headers: {}) ⇒ Hash

Get the count of companies using a segmentation query.

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



176
177
178
179
180
# File 'lib/thecompaniesapi/client.rb', line 176

def count_companies(params: {}, headers: {})
        endpoint = '/v2/companies/count'

        get(endpoint, params: params)
end

#count_companies_post(data: {}, headers: {}) ⇒ Hash

Get the count of companies using a segmentation body.

Parameters:

  • data (Hash) (defaults to: {})

    Request body data

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



190
191
192
193
194
# File 'lib/thecompaniesapi/client.rb', line 190

def count_companies_post(data: {}, headers: {})
        endpoint = '/v2/companies/count'

        post(endpoint, body: data)
end

#create_list(data: {}, headers: {}) ⇒ Hash

Create a new list.

Parameters:

  • data (Hash) (defaults to: {})

    Request body data

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



445
446
447
448
449
# File 'lib/thecompaniesapi/client.rb', line 445

def create_list(data: {}, headers: {})
        endpoint = '/v2/lists'

        post(endpoint, body: data)
end

#delete_list(list_id, params: {}, headers: {}) ⇒ Hash

Delete a list.

Parameters:

  • list_id (String)

    Path parameter

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



475
476
477
478
479
# File 'lib/thecompaniesapi/client.rb', line 475

def delete_list(list_id, params: {}, headers: {})
        endpoint = "/v2/lists/#{list_id}"

        delete(endpoint, params: params)
end

#delete_prompt(prompt_id, params: {}, headers: {}) ⇒ Hash

Delete a prompt.

Parameters:

  • prompt_id (String)

    Path parameter

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



609
610
611
612
613
# File 'lib/thecompaniesapi/client.rb', line 609

def delete_prompt(prompt_id, params: {}, headers: {})
        endpoint = "/v2/prompts/#{prompt_id}"

        delete(endpoint, params: params)
end

#enrich_job_titles(params: {}, headers: {}) ⇒ Hash

Enrich job titles.

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



417
418
419
420
421
# File 'lib/thecompaniesapi/client.rb', line 417

def enrich_job_titles(params: {}, headers: {})
        endpoint = '/v2/job-titles/enrich'

        get(endpoint, params: params)
end

#export_companies_analytics(data: {}, headers: {}) ⇒ Hash

Export analytics data for search segmentations and lists.

Parameters:

  • data (Hash) (defaults to: {})

    Request body data

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



291
292
293
294
295
# File 'lib/thecompaniesapi/client.rb', line 291

def export_companies_analytics(data: {}, headers: {})
        endpoint = '/v2/companies/analytics/export'

        post(endpoint, body: data)
end

#fetch_actions(params: {}, headers: {}) ⇒ Hash

Get and filter your actions.

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



48
49
50
51
52
# File 'lib/thecompaniesapi/client.rb', line 48

def fetch_actions(params: {}, headers: {})
        endpoint = '/v2/actions'

        get(endpoint, params: params)
end

#fetch_api_health(params: {}, headers: {}) ⇒ Hash

Get the health status of the API.

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



20
21
22
23
24
# File 'lib/thecompaniesapi/client.rb', line 20

def fetch_api_health(params: {}, headers: {})
        endpoint = '/'

        get(endpoint, params: params)
end

#fetch_companies_analytics(params: {}, headers: {}) ⇒ Hash

Fetch analytics data for search segmentations and lists.

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



277
278
279
280
281
# File 'lib/thecompaniesapi/client.rb', line 277

def fetch_companies_analytics(params: {}, headers: {})
        endpoint = '/v2/companies/analytics'

        get(endpoint, params: params)
end

#fetch_companies_in_list(list_id, params: {}, headers: {}) ⇒ Hash

Get companies in a list with a segmentation query.

Parameters:

  • list_id (String)

    Path parameter

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



490
491
492
493
494
# File 'lib/thecompaniesapi/client.rb', line 490

def fetch_companies_in_list(list_id, params: {}, headers: {})
        endpoint = "/v2/lists/#{list_id}/companies"

        get(endpoint, params: params)
end

#fetch_companies_in_list_post(list_id, data: {}, headers: {}) ⇒ Hash

Get companies in a list with a segmentation body.

Parameters:

  • list_id (String)

    Path parameter

  • data (Hash) (defaults to: {})

    Request body data

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



505
506
507
508
509
# File 'lib/thecompaniesapi/client.rb', line 505

def fetch_companies_in_list_post(list_id, data: {}, headers: {})
        endpoint = "/v2/lists/#{list_id}/companies"

        post(endpoint, body: data)
end

#fetch_company(domain, params: {}, headers: {}) ⇒ Hash

Get a single company data by its domain.

Parameters:

  • domain (String)

    Path parameter

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



120
121
122
123
124
# File 'lib/thecompaniesapi/client.rb', line 120

def fetch_company(domain, params: {}, headers: {})
        endpoint = "/v2/companies/#{domain}"

        get(endpoint, params: params)
end

#fetch_company_by_email(params: {}, headers: {}) ⇒ Hash

Get a company data by email.

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



204
205
206
207
208
# File 'lib/thecompaniesapi/client.rb', line 204

def fetch_company_by_email(params: {}, headers: {})
        endpoint = '/v2/companies/by-email'

        get(endpoint, params: params)
end

#fetch_company_by_social(params: {}, headers: {}) ⇒ Hash

Get a company data by social media.

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



218
219
220
221
222
# File 'lib/thecompaniesapi/client.rb', line 218

def fetch_company_by_social(params: {}, headers: {})
        endpoint = '/v2/companies/by-social'

        get(endpoint, params: params)
end

#fetch_company_context(domain, params: {}, headers: {}) ⇒ Hash

Get the full context of a company by its domain.

Parameters:

  • domain (String)

    Path parameter

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



263
264
265
266
267
# File 'lib/thecompaniesapi/client.rb', line 263

def fetch_company_context(domain, params: {}, headers: {})
        endpoint = "/v2/companies/#{domain}/context"

        get(endpoint, params: params)
end

#fetch_company_email_patterns(domain, params: {}, headers: {}) ⇒ Hash

Get email patterns for a company by its domain.

Parameters:

  • domain (String)

    Path parameter

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



233
234
235
236
237
# File 'lib/thecompaniesapi/client.rb', line 233

def fetch_company_email_patterns(domain, params: {}, headers: {})
        endpoint = "/v2/companies/#{domain}/email-patterns"

        get(endpoint, params: params)
end

#fetch_company_in_list(list_id, domain, params: {}, headers: {}) ⇒ Hash

Get a company in a list.

Parameters:

  • list_id (String)

    Path parameter

  • domain (String)

    Path parameter

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



521
522
523
524
525
# File 'lib/thecompaniesapi/client.rb', line 521

def fetch_company_in_list(list_id, domain, params: {}, headers: {})
        endpoint = "/v2/lists/#{list_id}/companies/#{domain}"

        get(endpoint, params: params)
end

#fetch_lists(params: {}, headers: {}) ⇒ Hash

Get and filter your lists.

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



431
432
433
434
435
# File 'lib/thecompaniesapi/client.rb', line 431

def fetch_lists(params: {}, headers: {})
        endpoint = '/v2/lists'

        get(endpoint, params: params)
end

#fetch_open_api(params: {}, headers: {}) ⇒ Hash

Get the current OpenAPI specification.

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



34
35
36
37
38
# File 'lib/thecompaniesapi/client.rb', line 34

def fetch_open_api(params: {}, headers: {})
        endpoint = '/v2/openapi'

        get(endpoint, params: params)
end

#fetch_prompts(params: {}, headers: {}) ⇒ Hash

Fetch prompts history.

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



594
595
596
597
598
# File 'lib/thecompaniesapi/client.rb', line 594

def fetch_prompts(params: {}, headers: {})
        endpoint = '/v2/prompts'

        get(endpoint, params: params)
end

#fetch_team(team_id, params: {}, headers: {}) ⇒ Hash

Get team information.

Parameters:

  • team_id (String)

    Path parameter

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



551
552
553
554
555
# File 'lib/thecompaniesapi/client.rb', line 551

def fetch_team(team_id, params: {}, headers: {})
        endpoint = "/v2/teams/#{team_id}"

        get(endpoint, params: params)
end

#fetch_user(params: {}, headers: {}) ⇒ Hash

Get current user information.

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



580
581
582
583
584
# File 'lib/thecompaniesapi/client.rb', line 580

def fetch_user(params: {}, headers: {})
        endpoint = '/v2/user'

        get(endpoint, params: params)
end

#product_prompt(data: {}, headers: {}) ⇒ Hash

Query the product prompt.

Parameters:

  • data (Hash) (defaults to: {})

    Request body data

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



623
624
625
626
627
# File 'lib/thecompaniesapi/client.rb', line 623

def product_prompt(data: {}, headers: {})
        endpoint = '/v2/prompts/product'

        post(endpoint, body: data)
end

#prompt_to_segmentation(data: {}, headers: {}) ⇒ Hash

Convert a query to a segmentation.

Parameters:

  • data (Hash) (defaults to: {})

    Request body data

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



637
638
639
640
641
# File 'lib/thecompaniesapi/client.rb', line 637

def prompt_to_segmentation(data: {}, headers: {})
        endpoint = '/v2/prompts/segmentation'

        post(endpoint, body: data)
end

#request_action(data: {}, headers: {}) ⇒ Hash

Request or estimate a new action.

Parameters:

  • data (Hash) (defaults to: {})

    Request body data

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



62
63
64
65
66
# File 'lib/thecompaniesapi/client.rb', line 62

def request_action(data: {}, headers: {})
        endpoint = '/v2/actions'

        post(endpoint, body: data)
end

#retry_action(action_id, data: {}, headers: {}) ⇒ Hash

Ask for a retry of failed action.

Parameters:

  • action_id (String)

    Path parameter

  • data (Hash) (defaults to: {})

    Request body data

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



77
78
79
80
81
# File 'lib/thecompaniesapi/client.rb', line 77

def retry_action(action_id, data: {}, headers: {})
        endpoint = "/v2/actions/#{action_id}/retry"

        post(endpoint, body: data)
end

#search_cities(params: {}, headers: {}) ⇒ Hash

Search cities.

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



347
348
349
350
351
# File 'lib/thecompaniesapi/client.rb', line 347

def search_cities(params: {}, headers: {})
        endpoint = '/v2/locations/cities'

        get(endpoint, params: params)
end

#search_companies(params: {}, headers: {}) ⇒ Hash

Search companies using a segmentation query.

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



91
92
93
94
95
# File 'lib/thecompaniesapi/client.rb', line 91

def search_companies(params: {}, headers: {})
        endpoint = '/v2/companies'

        get(endpoint, params: params)
end

#search_companies_by_name(params: {}, headers: {}) ⇒ Hash

Search companies by name.

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



134
135
136
137
138
# File 'lib/thecompaniesapi/client.rb', line 134

def search_companies_by_name(params: {}, headers: {})
        endpoint = '/v2/companies/by-name'

        get(endpoint, params: params)
end

#search_companies_by_prompt(params: {}, headers: {}) ⇒ Hash

Search companies by prompt.

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



148
149
150
151
152
# File 'lib/thecompaniesapi/client.rb', line 148

def search_companies_by_prompt(params: {}, headers: {})
        endpoint = '/v2/companies/by-prompt'

        get(endpoint, params: params)
end

#search_companies_post(data: {}, headers: {}) ⇒ Hash

Search companies using a segmentation query.

Parameters:

  • data (Hash) (defaults to: {})

    Request body data

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



105
106
107
108
109
# File 'lib/thecompaniesapi/client.rb', line 105

def search_companies_post(data: {}, headers: {})
        endpoint = '/v2/companies'

        post(endpoint, body: data)
end

#search_continents(params: {}, headers: {}) ⇒ Hash

Search continents.

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



403
404
405
406
407
# File 'lib/thecompaniesapi/client.rb', line 403

def search_continents(params: {}, headers: {})
        endpoint = '/v2/locations/continents'

        get(endpoint, params: params)
end

#search_counties(params: {}, headers: {}) ⇒ Hash

Search counties.

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



361
362
363
364
365
# File 'lib/thecompaniesapi/client.rb', line 361

def search_counties(params: {}, headers: {})
        endpoint = '/v2/locations/counties'

        get(endpoint, params: params)
end

#search_countries(params: {}, headers: {}) ⇒ Hash

Search countries.

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



375
376
377
378
379
# File 'lib/thecompaniesapi/client.rb', line 375

def search_countries(params: {}, headers: {})
        endpoint = '/v2/locations/countries'

        get(endpoint, params: params)
end

#search_industries(params: {}, headers: {}) ⇒ Hash

Search industries.

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



305
306
307
308
309
# File 'lib/thecompaniesapi/client.rb', line 305

def search_industries(params: {}, headers: {})
        endpoint = '/v2/industries'

        get(endpoint, params: params)
end

#search_industries_similar(params: {}, headers: {}) ⇒ Hash

Get similar industries from one or many industries.

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



319
320
321
322
323
# File 'lib/thecompaniesapi/client.rb', line 319

def search_industries_similar(params: {}, headers: {})
        endpoint = '/v2/industries/similar'

        get(endpoint, params: params)
end

#search_similar_companies(params: {}, headers: {}) ⇒ Hash

Get similar companies from one or many domains.

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



162
163
164
165
166
# File 'lib/thecompaniesapi/client.rb', line 162

def search_similar_companies(params: {}, headers: {})
        endpoint = '/v2/companies/similar'

        get(endpoint, params: params)
end

#search_states(params: {}, headers: {}) ⇒ Hash

Search states.

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



389
390
391
392
393
# File 'lib/thecompaniesapi/client.rb', line 389

def search_states(params: {}, headers: {})
        endpoint = '/v2/locations/states'

        get(endpoint, params: params)
end

#search_technologies(params: {}, headers: {}) ⇒ Hash

Search technologies.

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



333
334
335
336
337
# File 'lib/thecompaniesapi/client.rb', line 333

def search_technologies(params: {}, headers: {})
        endpoint = '/v2/technologies'

        get(endpoint, params: params)
end

#toggle_companies_in_list(list_id, data: {}, headers: {}) ⇒ Hash

Toggle one or more companies in a list.

Parameters:

  • list_id (String)

    Path parameter

  • data (Hash) (defaults to: {})

    Request body data

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



536
537
538
539
540
# File 'lib/thecompaniesapi/client.rb', line 536

def toggle_companies_in_list(list_id, data: {}, headers: {})
        endpoint = "/v2/lists/#{list_id}/companies/toggle"

        patch(endpoint, body: data)
end

#update_list(list_id, data: {}, headers: {}) ⇒ Hash

Update a list.

Parameters:

  • list_id (String)

    Path parameter

  • data (Hash) (defaults to: {})

    Request body data

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



460
461
462
463
464
# File 'lib/thecompaniesapi/client.rb', line 460

def update_list(list_id, data: {}, headers: {})
        endpoint = "/v2/lists/#{list_id}"

        patch(endpoint, body: data)
end

#update_team(team_id, data: {}, headers: {}) ⇒ Hash

Update a team.

Parameters:

  • team_id (String)

    Path parameter

  • data (Hash) (defaults to: {})

    Request body data

  • headers (Hash) (defaults to: {})

    Additional headers

Returns:

  • (Hash)

    API response



566
567
568
569
570
# File 'lib/thecompaniesapi/client.rb', line 566

def update_team(team_id, data: {}, headers: {})
        endpoint = "/v2/teams/#{team_id}"

        patch(endpoint, body: data)
end