thecompaniesapi 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.env.example +4 -0
- data/.github/workflows/release.yml +106 -0
- data/.github/workflows/tests.yml +93 -0
- data/.gitignore +146 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +36 -0
- data/LICENSE.txt +21 -0
- data/README.md +551 -0
- data/Rakefile +25 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/thecompaniesapi/client.rb +643 -0
- data/lib/thecompaniesapi/error.rb +28 -0
- data/lib/thecompaniesapi/generated/models/action.rb +91 -0
- data/lib/thecompaniesapi/generated/models/company_v2.rb +136 -0
- data/lib/thecompaniesapi/generated/models/email_pattern.rb +51 -0
- data/lib/thecompaniesapi/generated/models/job_title.rb +81 -0
- data/lib/thecompaniesapi/generated/models/list.rb +141 -0
- data/lib/thecompaniesapi/generated/models/list_analytics.rb +46 -0
- data/lib/thecompaniesapi/generated/models/llmanswer.rb +66 -0
- data/lib/thecompaniesapi/generated/models/nominatim_city.rb +101 -0
- data/lib/thecompaniesapi/generated/models/nominatim_continent.rb +111 -0
- data/lib/thecompaniesapi/generated/models/nominatim_country.rb +121 -0
- data/lib/thecompaniesapi/generated/models/nominatim_county.rb +96 -0
- data/lib/thecompaniesapi/generated/models/nominatim_state.rb +96 -0
- data/lib/thecompaniesapi/generated/models/page_contents_ideated.rb +171 -0
- data/lib/thecompaniesapi/generated/models/page_contents_link.rb +41 -0
- data/lib/thecompaniesapi/generated/models/page_contents_page.rb +71 -0
- data/lib/thecompaniesapi/generated/models/pagination_meta.rb +76 -0
- data/lib/thecompaniesapi/generated/models/prompt.rb +91 -0
- data/lib/thecompaniesapi/generated/models/segmentation_condition.rb +56 -0
- data/lib/thecompaniesapi/generated/models/team.rb +101 -0
- data/lib/thecompaniesapi/generated/models/technology.rb +96 -0
- data/lib/thecompaniesapi/generated/models/user.rb +101 -0
- data/lib/thecompaniesapi/generated/operations_map.rb +11 -0
- data/lib/thecompaniesapi/generated/requests/ask_company_request.rb +60 -0
- data/lib/thecompaniesapi/generated/requests/count_companies_post_request.rb +50 -0
- data/lib/thecompaniesapi/generated/requests/create_list_request.rb +70 -0
- data/lib/thecompaniesapi/generated/requests/export_companies_analytics_request.rb +70 -0
- data/lib/thecompaniesapi/generated/requests/fetch_companies_in_list_post_request.rb +70 -0
- data/lib/thecompaniesapi/generated/requests/product_prompt_request.rb +65 -0
- data/lib/thecompaniesapi/generated/requests/prompt_to_segmentation_request.rb +55 -0
- data/lib/thecompaniesapi/generated/requests/request_action_request.rb +80 -0
- data/lib/thecompaniesapi/generated/requests/retry_action_request.rb +30 -0
- data/lib/thecompaniesapi/generated/requests/search_companies_post_request.rb +90 -0
- data/lib/thecompaniesapi/generated/requests/toggle_companies_in_list_request.rb +50 -0
- data/lib/thecompaniesapi/generated/requests/update_list_request.rb +65 -0
- data/lib/thecompaniesapi/generated/requests/update_team_request.rb +45 -0
- data/lib/thecompaniesapi/generated/responses/ask_company_response.rb +38 -0
- data/lib/thecompaniesapi/generated/responses/count_companies_post_response.rb +34 -0
- data/lib/thecompaniesapi/generated/responses/count_companies_response.rb +34 -0
- data/lib/thecompaniesapi/generated/responses/create_list_response.rb +25 -0
- data/lib/thecompaniesapi/generated/responses/delete_list_response.rb +25 -0
- data/lib/thecompaniesapi/generated/responses/delete_prompt_response.rb +25 -0
- data/lib/thecompaniesapi/generated/responses/enrich_job_titles_response.rb +25 -0
- data/lib/thecompaniesapi/generated/responses/export_companies_analytics_response.rb +38 -0
- data/lib/thecompaniesapi/generated/responses/fetch_actions_response.rb +38 -0
- data/lib/thecompaniesapi/generated/responses/fetch_api_health_response.rb +42 -0
- data/lib/thecompaniesapi/generated/responses/fetch_companies_analytics_response.rb +38 -0
- data/lib/thecompaniesapi/generated/responses/fetch_companies_in_list_post_response.rb +42 -0
- data/lib/thecompaniesapi/generated/responses/fetch_companies_in_list_response.rb +42 -0
- data/lib/thecompaniesapi/generated/responses/fetch_company_by_email_response.rb +42 -0
- data/lib/thecompaniesapi/generated/responses/fetch_company_by_social_response.rb +25 -0
- data/lib/thecompaniesapi/generated/responses/fetch_company_context_response.rb +38 -0
- data/lib/thecompaniesapi/generated/responses/fetch_company_email_patterns_response.rb +25 -0
- data/lib/thecompaniesapi/generated/responses/fetch_company_in_list_response.rb +25 -0
- data/lib/thecompaniesapi/generated/responses/fetch_company_response.rb +25 -0
- data/lib/thecompaniesapi/generated/responses/fetch_lists_response.rb +38 -0
- data/lib/thecompaniesapi/generated/responses/fetch_open_api_response.rb +30 -0
- data/lib/thecompaniesapi/generated/responses/fetch_prompts_response.rb +38 -0
- data/lib/thecompaniesapi/generated/responses/fetch_team_response.rb +25 -0
- data/lib/thecompaniesapi/generated/responses/fetch_user_response.rb +25 -0
- data/lib/thecompaniesapi/generated/responses/product_prompt_response.rb +42 -0
- data/lib/thecompaniesapi/generated/responses/prompt_to_segmentation_response.rb +42 -0
- data/lib/thecompaniesapi/generated/responses/request_action_response.rb +34 -0
- data/lib/thecompaniesapi/generated/responses/retry_action_response.rb +34 -0
- data/lib/thecompaniesapi/generated/responses/search_cities_response.rb +38 -0
- data/lib/thecompaniesapi/generated/responses/search_companies_by_name_response.rb +38 -0
- data/lib/thecompaniesapi/generated/responses/search_companies_by_prompt_response.rb +38 -0
- data/lib/thecompaniesapi/generated/responses/search_companies_post_response.rb +42 -0
- data/lib/thecompaniesapi/generated/responses/search_companies_response.rb +42 -0
- data/lib/thecompaniesapi/generated/responses/search_continents_response.rb +38 -0
- data/lib/thecompaniesapi/generated/responses/search_counties_response.rb +38 -0
- data/lib/thecompaniesapi/generated/responses/search_countries_response.rb +38 -0
- data/lib/thecompaniesapi/generated/responses/search_industries_response.rb +38 -0
- data/lib/thecompaniesapi/generated/responses/search_industries_similar_response.rb +38 -0
- data/lib/thecompaniesapi/generated/responses/search_similar_companies_response.rb +38 -0
- data/lib/thecompaniesapi/generated/responses/search_states_response.rb +38 -0
- data/lib/thecompaniesapi/generated/responses/search_technologies_response.rb +38 -0
- data/lib/thecompaniesapi/generated/responses/toggle_companies_in_list_response.rb +25 -0
- data/lib/thecompaniesapi/generated/responses/update_list_response.rb +25 -0
- data/lib/thecompaniesapi/generated/responses/update_team_response.rb +25 -0
- data/lib/thecompaniesapi/http_client.rb +146 -0
- data/lib/thecompaniesapi/version.rb +3 -0
- data/lib/thecompaniesapi.rb +7 -0
- data/script/generate_client.rb +653 -0
- data/thecompaniesapi.gemspec +34 -0
- metadata +188 -0
data/README.md
ADDED
@@ -0,0 +1,551 @@
|
|
1
|
+
# The Companies API SDK for Ruby
|
2
|
+
|
3
|
+
[![Gem Version][gem-version-src]][gem-version-href]
|
4
|
+
[![Gem Downloads][gem-downloads-src]][gem-downloads-href]
|
5
|
+
[![License][license-src]][license-href]
|
6
|
+
|
7
|
+
A fully-featured Ruby SDK for [The Companies API](https://www.thecompaniesapi.com), providing type-safe access to company data, locations, industries, technologies, job titles, lists, and more.
|
8
|
+
|
9
|
+
If you need more details about a specific endpoint, you can find the corresponding documentation in [the API reference](https://www.thecompaniesapi.com/api).
|
10
|
+
|
11
|
+
You can also contact us on our [livechat](https://www.thecompaniesapi.com/) if you have any questions.
|
12
|
+
|
13
|
+
## 🚀 Features
|
14
|
+
|
15
|
+
- Expose all our 30+ endpoints and gives access to 50M+ companies from your codebase
|
16
|
+
- Type-safe API client with full access to our [OpenAPI](https://api.thecompaniesapi.com/v2/openapi) schemas
|
17
|
+
- Real-time company enrichment with both synchronous and asynchronous options
|
18
|
+
- Powerful search capabilities with filters, sorting and pagination
|
19
|
+
- Create and manage your company lists
|
20
|
+
- Track and monitor enrichment actions and requests
|
21
|
+
- Generate detailed analytics and insights for searches and lists
|
22
|
+
- Natural language querying for structured company information
|
23
|
+
- Lightweight with minimal dependencies
|
24
|
+
|
25
|
+
## 📦 Installation
|
26
|
+
|
27
|
+
Add this line to your application's Gemfile:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
gem 'thecompaniesapi'
|
31
|
+
```
|
32
|
+
|
33
|
+
And then execute:
|
34
|
+
|
35
|
+
```bash
|
36
|
+
bundle install
|
37
|
+
```
|
38
|
+
|
39
|
+
Or install it yourself as:
|
40
|
+
|
41
|
+
```bash
|
42
|
+
gem install thecompaniesapi
|
43
|
+
```
|
44
|
+
|
45
|
+
## 🔑 Initialize the client
|
46
|
+
|
47
|
+
Get your API token from [your settings page](https://www.thecompaniesapi.com/settings/api-tokens) and initialize our client with `TheCompaniesAPI::Client.new`.
|
48
|
+
|
49
|
+
The API token is required to authenticate your requests and should be kept secure. Never commit your API token to version control or share it publicly.
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
require 'thecompaniesapi'
|
53
|
+
|
54
|
+
tca = TheCompaniesAPI::Client.new(api_token: 'your-api-token')
|
55
|
+
```
|
56
|
+
|
57
|
+
## 🏬 Companies
|
58
|
+
|
59
|
+
### Search companies
|
60
|
+
|
61
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/search-companies)
|
62
|
+
|
63
|
+
🕹️ [Use case: How to build a company search engine with our API](https://www.thecompaniesapi.com/use-cases/companies-search-engine)
|
64
|
+
|
65
|
+
🔍 To learn more about our query system, please read our [documentation](https://www.thecompaniesapi.com/use-cases/companies-search-engine).
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
# Search companies by industry and size
|
69
|
+
response = tca.search_companies(
|
70
|
+
query: [
|
71
|
+
{ attribute: 'about.industries', operator: 'or', sign: 'equals', values: ['computer-software'] },
|
72
|
+
{ attribute: 'about.totalEmployees', operator: 'or', sign: 'equals', values: ['10-50'] }
|
73
|
+
],
|
74
|
+
size: 25
|
75
|
+
)
|
76
|
+
|
77
|
+
companies = response['companies'] # Companies that match the query
|
78
|
+
meta = response['meta'] # Meta information
|
79
|
+
```
|
80
|
+
|
81
|
+
### Search companies by name
|
82
|
+
|
83
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/search-companies-name)
|
84
|
+
|
85
|
+
🕹️ [Use case: Add a company search with autocomplete to your application](https://www.thecompaniesapi.com/use-cases/company-autocomplete)
|
86
|
+
|
87
|
+
```ruby
|
88
|
+
response = tca.search_companies_by_name(
|
89
|
+
name: 'The Companies API',
|
90
|
+
size: 2
|
91
|
+
)
|
92
|
+
|
93
|
+
companies = response['companies'] # Companies that match the name
|
94
|
+
meta = response['meta'] # Meta information
|
95
|
+
```
|
96
|
+
|
97
|
+
### Search companies using a prompt
|
98
|
+
|
99
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/search-companies-prompt)
|
100
|
+
|
101
|
+
```ruby
|
102
|
+
# Search 25 companies for a specific prompt
|
103
|
+
response = tca.search_companies_by_prompt(
|
104
|
+
prompt: 'SaaS Companies in the United States with more than 100 employees',
|
105
|
+
size: 25
|
106
|
+
)
|
107
|
+
|
108
|
+
companies = response['companies'] # Companies that match the prompt
|
109
|
+
meta = response['meta'] # Meta information
|
110
|
+
```
|
111
|
+
|
112
|
+
### Search similar companies
|
113
|
+
|
114
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/search-similar-companies)
|
115
|
+
|
116
|
+
```ruby
|
117
|
+
# Search 25 companies that are similar to Crisp and Intercom
|
118
|
+
response = tca.search_similar_companies(
|
119
|
+
domains: ['crisp.chat', 'intercom.com'],
|
120
|
+
size: 25
|
121
|
+
)
|
122
|
+
|
123
|
+
companies = response['companies'] # Companies that are similar to the domains
|
124
|
+
meta = response['meta'] # Meta information
|
125
|
+
```
|
126
|
+
|
127
|
+
### Count companies matching your query
|
128
|
+
|
129
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/count-companies)
|
130
|
+
|
131
|
+
```ruby
|
132
|
+
# Count how many companies are in the computer-software industry
|
133
|
+
response = tca.count_companies(
|
134
|
+
query: [
|
135
|
+
{
|
136
|
+
attribute: 'about.industries',
|
137
|
+
operator: 'or',
|
138
|
+
sign: 'equals',
|
139
|
+
values: ['computer-software']
|
140
|
+
}
|
141
|
+
]
|
142
|
+
)
|
143
|
+
|
144
|
+
count = response # Number of companies that match the query
|
145
|
+
```
|
146
|
+
|
147
|
+
### Enrich a company from a domain name
|
148
|
+
|
149
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/enrich-company-from-domain)
|
150
|
+
|
151
|
+
```ruby
|
152
|
+
# Fetch company data from our database without enrichment (faster response)
|
153
|
+
response = tca.fetch_company(domain: 'microsoft.com')
|
154
|
+
|
155
|
+
company = response # The company profile
|
156
|
+
|
157
|
+
# Fetch company data and re-analyze it in real-time to get fresh, up-to-date information (slower but more accurate)
|
158
|
+
response = tca.fetch_company(
|
159
|
+
domain: 'microsoft.com',
|
160
|
+
refresh: true
|
161
|
+
)
|
162
|
+
|
163
|
+
company = response # The company profile
|
164
|
+
```
|
165
|
+
|
166
|
+
### Enrich a company from an email
|
167
|
+
|
168
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/enrich-company-from-email)
|
169
|
+
|
170
|
+
🕹️ [Use case: Enrich your users at signup with the latest information about their company](https://www.thecompaniesapi.com/use-cases/enrich-users-signup)
|
171
|
+
|
172
|
+
```ruby
|
173
|
+
# Fetch the company profile behind a professional email address
|
174
|
+
response = tca.fetch_company_by_email(email: 'jack@openai.com')
|
175
|
+
|
176
|
+
company = response # The company profile
|
177
|
+
```
|
178
|
+
|
179
|
+
### Enrich a company from a social network URL
|
180
|
+
|
181
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/enrich-company-from-social-network-url)
|
182
|
+
|
183
|
+
```ruby
|
184
|
+
# Fetch the company profile behind a social network URL
|
185
|
+
response = tca.fetch_company_by_social(linkedin: 'https://www.linkedin.com/company/apple')
|
186
|
+
|
187
|
+
company = response # The company profile
|
188
|
+
```
|
189
|
+
|
190
|
+
### Find a company email patterns
|
191
|
+
|
192
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/fetch-company-email-patterns)
|
193
|
+
|
194
|
+
```ruby
|
195
|
+
# Fetch the company email patterns for a specific domain
|
196
|
+
response = tca.fetch_company_email_patterns(domain: 'apple.com')
|
197
|
+
|
198
|
+
patterns = response # The company email patterns
|
199
|
+
```
|
200
|
+
|
201
|
+
### Ask a question about a company
|
202
|
+
|
203
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/ask-company)
|
204
|
+
|
205
|
+
```ruby
|
206
|
+
# Ask what products a company offers using its domain
|
207
|
+
response = tca.ask_company(
|
208
|
+
domain: 'microsoft.com',
|
209
|
+
question: 'What products does this company offer?',
|
210
|
+
model: 'large', # 'small' is also available
|
211
|
+
fields: [
|
212
|
+
{
|
213
|
+
key: 'products',
|
214
|
+
type: 'array|string',
|
215
|
+
description: 'The products that the company offers'
|
216
|
+
}
|
217
|
+
]
|
218
|
+
)
|
219
|
+
|
220
|
+
answer = response['answer'] # Structured AI response
|
221
|
+
meta = response['meta'] # Meta information
|
222
|
+
```
|
223
|
+
|
224
|
+
### Fetch the context of a company
|
225
|
+
|
226
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/fetch-company-context)
|
227
|
+
|
228
|
+
```ruby
|
229
|
+
# Get AI-generated strategic insights about a company
|
230
|
+
response = tca.fetch_company_context(domain: 'microsoft.com')
|
231
|
+
|
232
|
+
context = response['context'] # Includes market, model, differentiators, etc.
|
233
|
+
meta = response['meta'] # Meta information
|
234
|
+
```
|
235
|
+
|
236
|
+
### Fetch analytics data for a query or your lists
|
237
|
+
|
238
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/fetch-companies-analytics)
|
239
|
+
|
240
|
+
```ruby
|
241
|
+
# Analyze company distribution by business type
|
242
|
+
response = tca.fetch_companies_analytics(
|
243
|
+
attribute: 'about.businessType',
|
244
|
+
query: [
|
245
|
+
{
|
246
|
+
attribute: 'locations.headquarters.country.code',
|
247
|
+
operator: 'or',
|
248
|
+
sign: 'equals',
|
249
|
+
values: ['us', 'gb', 'fr']
|
250
|
+
}
|
251
|
+
]
|
252
|
+
)
|
253
|
+
|
254
|
+
analytics = response['data'] # Aggregated values
|
255
|
+
meta = response['meta'] # Meta information
|
256
|
+
```
|
257
|
+
|
258
|
+
### Export analytics data in multiple formats for a search
|
259
|
+
|
260
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/export-companies-analytics)
|
261
|
+
|
262
|
+
```ruby
|
263
|
+
# Export analytics to CSV
|
264
|
+
response = tca.export_companies_analytics(
|
265
|
+
format: 'csv',
|
266
|
+
attributes: ['about.industries', 'about.totalEmployees'],
|
267
|
+
query: [
|
268
|
+
{
|
269
|
+
attribute: 'technologies.active',
|
270
|
+
operator: 'or',
|
271
|
+
sign: 'equals',
|
272
|
+
values: ['shopify']
|
273
|
+
}
|
274
|
+
]
|
275
|
+
)
|
276
|
+
|
277
|
+
analytics = response['data'] # Aggregated values
|
278
|
+
meta = response['meta'] # Meta information
|
279
|
+
```
|
280
|
+
|
281
|
+
## 🎯 Actions
|
282
|
+
|
283
|
+
### Request an action on one or more companies
|
284
|
+
|
285
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/request-action)
|
286
|
+
|
287
|
+
```ruby
|
288
|
+
# Request an enrichment job on multiple companies
|
289
|
+
response = tca.request_action(
|
290
|
+
domains: ['microsoft.com', 'apple.com'],
|
291
|
+
job: 'enrich-companies',
|
292
|
+
estimate: false
|
293
|
+
)
|
294
|
+
|
295
|
+
actions = response['actions'] # Track this via fetch_actions
|
296
|
+
meta = response['meta'] # Meta information
|
297
|
+
```
|
298
|
+
|
299
|
+
### Fetch the actions for your actions
|
300
|
+
|
301
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/fetch-actions)
|
302
|
+
|
303
|
+
```ruby
|
304
|
+
# Fetch recent actions
|
305
|
+
response = tca.fetch_actions(
|
306
|
+
status: 'completed',
|
307
|
+
page: 1,
|
308
|
+
size: 5
|
309
|
+
)
|
310
|
+
|
311
|
+
actions = response['actions'] # Actions that match the query
|
312
|
+
meta = response['meta'] # Meta information
|
313
|
+
```
|
314
|
+
|
315
|
+
## 🏭 Industries
|
316
|
+
|
317
|
+
### Search industries
|
318
|
+
|
319
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/search-industries)
|
320
|
+
|
321
|
+
```ruby
|
322
|
+
# Search industries by keyword
|
323
|
+
response = tca.search_industries(
|
324
|
+
search: 'software',
|
325
|
+
size: 10
|
326
|
+
)
|
327
|
+
|
328
|
+
industries = response['industries'] # Industries that match the keyword
|
329
|
+
meta = response['meta'] # Meta information
|
330
|
+
```
|
331
|
+
|
332
|
+
### Find similar industries
|
333
|
+
|
334
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/find-similar-industries)
|
335
|
+
|
336
|
+
```ruby
|
337
|
+
# Find industries similar to given ones
|
338
|
+
response = tca.search_industries_similar(industries: ['saas', 'fintech'])
|
339
|
+
|
340
|
+
similar = response['industries'] # Industries that are similar to the given ones
|
341
|
+
meta = response['meta'] # Meta information
|
342
|
+
```
|
343
|
+
|
344
|
+
## ⚛️ Technologies
|
345
|
+
|
346
|
+
### Search technologies
|
347
|
+
|
348
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/search-technologies)
|
349
|
+
|
350
|
+
```ruby
|
351
|
+
# Search technologies by keyword
|
352
|
+
response = tca.search_technologies(
|
353
|
+
search: 'shopify',
|
354
|
+
size: 10
|
355
|
+
)
|
356
|
+
|
357
|
+
technologies = response['technologies'] # Technologies that match the keyword
|
358
|
+
meta = response['meta'] # Meta information
|
359
|
+
```
|
360
|
+
|
361
|
+
## 🌍 Locations
|
362
|
+
|
363
|
+
### Search cities
|
364
|
+
|
365
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/search-cities)
|
366
|
+
|
367
|
+
```ruby
|
368
|
+
# Search cities by name
|
369
|
+
response = tca.search_cities(
|
370
|
+
search: 'new york',
|
371
|
+
size: 5
|
372
|
+
)
|
373
|
+
|
374
|
+
cities = response['cities'] # Cities that match the name
|
375
|
+
meta = response['meta'] # Meta information
|
376
|
+
```
|
377
|
+
|
378
|
+
### Search counties
|
379
|
+
|
380
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/search-counties)
|
381
|
+
|
382
|
+
```ruby
|
383
|
+
# Search counties by name
|
384
|
+
response = tca.search_counties(
|
385
|
+
search: 'orange',
|
386
|
+
size: 5
|
387
|
+
)
|
388
|
+
|
389
|
+
counties = response['counties'] # Counties that match the name
|
390
|
+
meta = response['meta'] # Meta information
|
391
|
+
```
|
392
|
+
|
393
|
+
### Search states
|
394
|
+
|
395
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/search-states)
|
396
|
+
|
397
|
+
```ruby
|
398
|
+
# Search states by name
|
399
|
+
response = tca.search_states(
|
400
|
+
search: 'california',
|
401
|
+
size: 5
|
402
|
+
)
|
403
|
+
|
404
|
+
states = response['states'] # States that match the name
|
405
|
+
meta = response['meta'] # Meta information
|
406
|
+
```
|
407
|
+
|
408
|
+
### Search countries
|
409
|
+
|
410
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/search-countries)
|
411
|
+
|
412
|
+
```ruby
|
413
|
+
# Search countries by name
|
414
|
+
response = tca.search_countries(
|
415
|
+
search: 'france',
|
416
|
+
size: 5
|
417
|
+
)
|
418
|
+
|
419
|
+
countries = response['countries'] # Countries that match the name
|
420
|
+
meta = response['meta'] # Meta information
|
421
|
+
```
|
422
|
+
|
423
|
+
### Search continents
|
424
|
+
|
425
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/search-continents)
|
426
|
+
|
427
|
+
```ruby
|
428
|
+
# Search continents by name
|
429
|
+
response = tca.search_continents(
|
430
|
+
search: 'asia',
|
431
|
+
size: 5
|
432
|
+
)
|
433
|
+
|
434
|
+
continents = response['continents'] # Continents that match the name
|
435
|
+
meta = response['meta'] # Meta information
|
436
|
+
```
|
437
|
+
|
438
|
+
## 💼 Job titles
|
439
|
+
|
440
|
+
### Enrich a job title from its name
|
441
|
+
|
442
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/enrich-job-title-from-name)
|
443
|
+
|
444
|
+
```ruby
|
445
|
+
# Enrich "chief marketing officer"
|
446
|
+
response = tca.enrich_job_titles(name: 'chief marketing officer')
|
447
|
+
|
448
|
+
job_title = response # Contains department, seniority, etc.
|
449
|
+
```
|
450
|
+
|
451
|
+
## 📋 Lists
|
452
|
+
|
453
|
+
### Fetch your lists
|
454
|
+
|
455
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/fetch-lists)
|
456
|
+
|
457
|
+
```ruby
|
458
|
+
# Fetch your lists
|
459
|
+
response = tca.fetch_lists
|
460
|
+
|
461
|
+
lists = response['lists'] # Lists that match the query
|
462
|
+
meta = response['meta'] # Meta information
|
463
|
+
```
|
464
|
+
|
465
|
+
### Create a list of companies
|
466
|
+
|
467
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/create-list)
|
468
|
+
|
469
|
+
```ruby
|
470
|
+
# Create a list of companies
|
471
|
+
response = tca.create_list(
|
472
|
+
name: 'My SaaS List',
|
473
|
+
type: 'companies'
|
474
|
+
)
|
475
|
+
|
476
|
+
new_list = response # The new list
|
477
|
+
```
|
478
|
+
|
479
|
+
### Fetch companies in your list
|
480
|
+
|
481
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/fetch-companies-in-list)
|
482
|
+
|
483
|
+
```ruby
|
484
|
+
# Fetch companies in a list
|
485
|
+
response = tca.fetch_companies_in_list(list_id: 1234)
|
486
|
+
|
487
|
+
companies = response['companies'] # Companies that match the list
|
488
|
+
meta = response['meta'] # Meta information
|
489
|
+
```
|
490
|
+
|
491
|
+
### Add or remove companies in your list
|
492
|
+
|
493
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/toggle-companies-in-list)
|
494
|
+
|
495
|
+
```ruby
|
496
|
+
# Add companies to a list
|
497
|
+
response = tca.toggle_companies_in_list(
|
498
|
+
list_id: 1234,
|
499
|
+
companies: ['apple.com', 'stripe.com']
|
500
|
+
)
|
501
|
+
|
502
|
+
list = response # The updated list
|
503
|
+
```
|
504
|
+
|
505
|
+
## 👥 Teams
|
506
|
+
|
507
|
+
### Fetch your team
|
508
|
+
|
509
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/fetch-team)
|
510
|
+
|
511
|
+
```ruby
|
512
|
+
# Fetch your team details
|
513
|
+
response = tca.fetch_team
|
514
|
+
|
515
|
+
team = response # Your team details
|
516
|
+
```
|
517
|
+
|
518
|
+
## 🔧 Utilities
|
519
|
+
|
520
|
+
### Fetch the health of the API
|
521
|
+
|
522
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/fetch-api-health)
|
523
|
+
|
524
|
+
```ruby
|
525
|
+
# Check API health status
|
526
|
+
response = tca.fetch_api_health
|
527
|
+
|
528
|
+
health = response # The health of the API
|
529
|
+
```
|
530
|
+
|
531
|
+
### Fetch the OpenAPI schema
|
532
|
+
|
533
|
+
📖 [Documentation](https://www.thecompaniesapi.com/api/fetch-openapi)
|
534
|
+
|
535
|
+
```ruby
|
536
|
+
# Fetch OpenAPI schema
|
537
|
+
response = tca.fetch_open_api
|
538
|
+
|
539
|
+
schema = response # The OpenAPI schema
|
540
|
+
```
|
541
|
+
|
542
|
+
## License
|
543
|
+
|
544
|
+
[MIT](./LICENSE) License © [TheCompaniesAPI](https://github.com/thecompaniesapi)
|
545
|
+
|
546
|
+
[gem-version-src]: https://img.shields.io/gem/v/thecompaniesapi?style=flat&colorA=080f12&colorB=1fa669
|
547
|
+
[gem-version-href]: https://rubygems.org/gems/thecompaniesapi
|
548
|
+
[gem-downloads-src]: https://img.shields.io/gem/dm/thecompaniesapi?style=flat&colorA=080f12&colorB=1fa669
|
549
|
+
[gem-downloads-href]: https://rubygems.org/gems/thecompaniesapi
|
550
|
+
[license-src]: https://img.shields.io/github/license/thecompaniesapi/sdk-ruby.svg?style=flat&colorA=080f12&colorB=1fa669
|
551
|
+
[license-href]: https://github.com/thecompaniesapi/sdk-ruby/blob/main/LICENSE
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rake/testtask"
|
3
|
+
|
4
|
+
# All tests
|
5
|
+
Rake::TestTask.new(:test) do |t|
|
6
|
+
t.libs << "test"
|
7
|
+
t.libs << "lib"
|
8
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
9
|
+
end
|
10
|
+
|
11
|
+
# Unit tests (everything except integration)
|
12
|
+
Rake::TestTask.new("test:unit") do |t|
|
13
|
+
t.libs << "test"
|
14
|
+
t.libs << "lib"
|
15
|
+
t.test_files = FileList["test/**/*_test.rb"].exclude("test/integration_test.rb")
|
16
|
+
end
|
17
|
+
|
18
|
+
# Integration tests
|
19
|
+
Rake::TestTask.new("test:integration") do |t|
|
20
|
+
t.libs << "test"
|
21
|
+
t.libs << "lib"
|
22
|
+
t.test_files = FileList["test/integration_test.rb"]
|
23
|
+
end
|
24
|
+
|
25
|
+
task :default => :test
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "thecompaniesapi"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|