crunchbase4 0.1.1 → 0.1.6

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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +5 -0
  3. data/CHANGELOG.md +66 -0
  4. data/Gemfile.lock +1 -1
  5. data/README.md +392 -40
  6. data/crunchbase4.gemspec +2 -2
  7. data/lib/crunchbase.rb +30 -1
  8. data/lib/crunchbase/autocompletes/client.rb +75 -0
  9. data/lib/crunchbase/client.rb +4 -0
  10. data/lib/crunchbase/deleted_entities/client.rb +69 -0
  11. data/lib/crunchbase/entities/client.rb +24 -12
  12. data/lib/crunchbase/models.rb +10 -1
  13. data/lib/crunchbase/models/address.rb +36 -0
  14. data/lib/crunchbase/models/autocomplete_entity.rb +25 -0
  15. data/lib/crunchbase/models/concerns/entity.rb +53 -0
  16. data/lib/crunchbase/models/concerns/mappings.rb +37 -0
  17. data/lib/crunchbase/models/deleted_entity.rb +26 -0
  18. data/lib/crunchbase/models/event_appearance.rb +39 -0
  19. data/lib/crunchbase/models/fund.rb +43 -0
  20. data/lib/crunchbase/models/ipo.rb +48 -0
  21. data/lib/crunchbase/models/job.rb +42 -0
  22. data/lib/crunchbase/models/organization.rb +9 -0
  23. data/lib/crunchbase/models/ownership.rb +39 -0
  24. data/lib/crunchbase/models/principal.rb +112 -0
  25. data/lib/crunchbase/utilities/autocomplete.rb +51 -0
  26. data/lib/crunchbase/utilities/deleted_entities.rb +47 -0
  27. data/lib/crunchbase/utilities/entity_endpoints.rb +58 -24
  28. data/lib/crunchbase/utilities/request.rb +28 -11
  29. data/lib/crunchbase/utilities/response.rb +1 -1
  30. data/lib/crunchbase/utilities/search_endpoints.rb +22 -0
  31. data/lib/crunchbase/utilities/search_query_parameters.rb +64 -0
  32. data/lib/crunchbase/utilities/veriables.rb +335 -0
  33. data/lib/crunchbase/version.rb +1 -1
  34. metadata +23 -7
  35. data/lib/crunchbase/models/entity.rb +0 -32
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Crunchbase
4
+ # Get the Entities data from API
5
+ module Models
6
+ # For AutocompleteEntity
7
+ class DeletedEntity < Entity
8
+ def field_ids
9
+ basis_fields
10
+ end
11
+
12
+ def basis_fields
13
+ %w[
14
+ uuid
15
+ entity_def_id
16
+ deleted_at
17
+ identifier
18
+ ]
19
+ end
20
+
21
+ def parse_response(response)
22
+ dynamic_attributes(self, field_ids, response)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Crunchbase
4
+ # Get the Entities data from API
5
+ module Models
6
+ # Get the EventAppearances data from API
7
+ class EventAppearance < Entity
8
+ RESOURCE_LIST = 'event_appearances'
9
+
10
+ def field_ids
11
+ %w[
12
+ created_at
13
+ updated_at
14
+ entity_def_id
15
+ event_identifier
16
+ event_location_identifiers
17
+ participant_identifier
18
+ ] + basis_fields
19
+ end
20
+
21
+ def basis_fields
22
+ %w[
23
+ appearance_type
24
+ identifier
25
+ name
26
+ permalink
27
+ short_description
28
+ event_starts_on
29
+ uuid
30
+ ]
31
+ end
32
+
33
+ def full_cards
34
+ %w[
35
+ ]
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Crunchbase
4
+ # Get the Entities data from API
5
+ module Models
6
+ # Get the Fund data from API
7
+ class Fund < Entity
8
+ RESOURCE_LIST = 'funds'
9
+
10
+ def field_ids
11
+ %w[
12
+ created_at
13
+ entity_def_id
14
+ image_id
15
+ investor_identifiers
16
+ num_investors
17
+ owner_identifier
18
+ short_description
19
+ started_on
20
+ updated_at
21
+ ] + basis_fields
22
+ end
23
+
24
+ def basis_fields
25
+ %w[
26
+ uuid
27
+ name
28
+ announced_on
29
+ money_raised
30
+ permalink
31
+ ]
32
+ end
33
+
34
+ def full_cards
35
+ %w[
36
+ investors
37
+ owner
38
+ press_references
39
+ ]
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Crunchbase
4
+ # Get the Entities data from API
5
+ module Models
6
+ # Get the person data from API
7
+ class Ipo < Entity
8
+ RESOURCE_LIST = 'ipos'
9
+
10
+ def field_ids
11
+ %w[
12
+ created_at
13
+ entity_def_id
14
+ image_id
15
+ rank
16
+ rank_ipo
17
+ shares_outstanding
18
+ shares_sold
19
+ stock_exchange_symbol
20
+ stock_full_symbol
21
+ updated_at
22
+ ] + basis_fields
23
+ end
24
+
25
+ def basis_fields
26
+ %w[
27
+ uuid
28
+ permalink
29
+ identifier
30
+ amount_raised
31
+ share_price
32
+ stock_symbol
33
+ valuation
34
+ delisted_on
35
+ went_public_on
36
+ short_description
37
+ ]
38
+ end
39
+
40
+ def full_cards
41
+ %w[
42
+ organization
43
+ press_references
44
+ ]
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Crunchbase
4
+ # Get the Entities data from API
5
+ module Models
6
+ # Get the Principal data from API
7
+ class Job < Entity
8
+ RESOURCE_LIST = 'jobs'
9
+
10
+ def field_ids
11
+ %w[
12
+ created_at
13
+ employee_featured_order
14
+ entity_def_id
15
+ identifier
16
+ short_description
17
+ updated_at
18
+ ] + basis_fields
19
+ end
20
+
21
+ def basis_fields
22
+ %w[
23
+ uuid
24
+ name
25
+ title
26
+ started_on
27
+ ended_on
28
+ permalink
29
+ job_type
30
+ is_current
31
+ organization_identifier
32
+ person_identifier
33
+ ]
34
+ end
35
+
36
+ def full_cards
37
+ %w[
38
+ ]
39
+ end
40
+ end
41
+ end
42
+ end
@@ -134,6 +134,15 @@ module Crunchbase
134
134
  headquarters_address
135
135
  ]
136
136
  end
137
+
138
+ def employees_range
139
+ Crunchbase::Utils::NUM_EMPLOYEES_ENUM[num_employees_enum]
140
+ end
141
+
142
+ private
143
+ def custom_fields
144
+ %w[employees_range]
145
+ end
137
146
  end
138
147
  end
139
148
  end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Crunchbase
4
+ # Get the Entities data from API
5
+ module Models
6
+ # Get the Ownership data from API
7
+ class Ownership < Entity
8
+ RESOURCE_LIST = 'ownerships'
9
+
10
+ def field_ids
11
+ %w[
12
+ created_at
13
+ entity_def_id
14
+ identifier
15
+ updated_at
16
+ ] + basis_fields
17
+ end
18
+
19
+ def basis_fields
20
+ %w[
21
+ uuid
22
+ permalink
23
+ name
24
+ ownee_identifier
25
+ owner_identifier
26
+ ownership_type
27
+ ]
28
+ end
29
+
30
+ def full_cards
31
+ %w[
32
+ child_organization
33
+ parent_organization
34
+ press_references
35
+ ]
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,112 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Crunchbase
4
+ # Get the Entities data from API
5
+ module Models
6
+ # Get the Principal data from API
7
+ class Principal < Entity
8
+ RESOURCE_LIST = 'principals'
9
+
10
+ def field_ids
11
+ %w[
12
+ category_groups
13
+ created_at
14
+ delisted_on
15
+ description
16
+ died_on
17
+ entity_def_id
18
+ equity_funding_total
19
+ exited_on
20
+ facet_ids
21
+ first_name
22
+ founded_on
23
+ founder_identifiers
24
+ funding_stage
25
+ funding_total
26
+ gender
27
+ hub_tags
28
+ identifier
29
+ image_id
30
+ image_url
31
+ investor_identifiers
32
+ ipo_status
33
+ last_equity_funding_total
34
+ last_equity_funding_type
35
+ last_funding_at
36
+ last_funding_total
37
+ last_funding_type
38
+ last_name
39
+ layout_id
40
+ location_group_identifiers
41
+ location_identifiers
42
+ num_alumni
43
+ num_articles
44
+ num_employees_enum
45
+ num_enrollments
46
+ num_event_appearances
47
+ num_exits
48
+ num_exits_ipo
49
+ num_founded_organizations
50
+ num_founders
51
+ num_funding_rounds
52
+ num_funds
53
+ num_investments
54
+ num_investments_funding_rounds
55
+ num_investors
56
+ num_jobs
57
+ num_lead_investments
58
+ num_lead_investors
59
+ num_partner_investments
60
+ num_portfolio_organizations
61
+ program_application_deadline
62
+ program_duration
63
+ program_type
64
+ rank_delta_d30
65
+ rank_delta_d7
66
+ rank_delta_d90
67
+ rank_principal
68
+ revenue_range
69
+ school_method
70
+ school_program
71
+ school_type
72
+ status
73
+ stock_exchange_symbol
74
+ stock_symbol
75
+ updated_at
76
+ went_public_on
77
+ ] + basis_fields
78
+ end
79
+
80
+ def basis_fields
81
+ %w[
82
+ name
83
+ uuid
84
+ website
85
+ short_description
86
+ operating_status
87
+ permalink
88
+ permalink_aliases
89
+ phone_number
90
+ primary_job_title
91
+ primary_organization
92
+ contact_email
93
+ aliases
94
+ born_on
95
+ closed_on
96
+ categories
97
+ company_type
98
+ linkedin
99
+ twitter
100
+ facebook
101
+ investor_stage
102
+ investor_type
103
+ ]
104
+ end
105
+
106
+ def full_cards
107
+ %w[
108
+ ]
109
+ end
110
+ end
111
+ end
112
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../autocompletes/client'
4
+
5
+ module Crunchbase
6
+ # Utilities
7
+ module Utilities
8
+ # Autocomplete on Searches
9
+ module Autocomplete
10
+ # endpoint: /autocompletes
11
+ #
12
+ # Suggests matching Identifier entities based on the query and entity_def_ids provided.
13
+ #
14
+ # query * string
15
+ # Value to perform the autocomplete search with.
16
+ # collection_ids string
17
+ # A comma separated list of collection ids to search against.
18
+ # Leaving this blank means it will search across all identifiers.
19
+ # Entity defs can be constrained to specific facets by providing them as facet collections.
20
+ # Relationship collections will resolve to their underlying entity def.
21
+ #
22
+ # Collection ids are:
23
+ # organizations, people, funding_rounds, acquisitions, investments, events,
24
+ # press_references, funds, event_appearances, ipos, ownerships, categories,
25
+ # category_groups, locations, jobs
26
+ # limit integer
27
+ # Number of results to retrieve; default = 10, max = 25
28
+ #
29
+ #
30
+ # Example for organizations
31
+ #
32
+ # raw_data = {
33
+ # query: keyword,
34
+ # collection_ids: 'organizations'
35
+ # }
36
+ def autocomplete(keyword, **args)
37
+ crunchbase_autocompletes(wrapper_autocompletes_data(keyword, args))
38
+ end
39
+
40
+ private
41
+
42
+ def crunchbase_autocompletes(raw_data)
43
+ Crunchbase::Autocompletes::Client.new(raw_data).autocompletes
44
+ end
45
+
46
+ def wrapper_autocompletes_data(keyword, **args)
47
+ { query: keyword }.merge(args)
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../deleted_entities/client'
4
+
5
+ module Crunchbase
6
+ # Utilities
7
+ module Utilities
8
+ # Autocomplete on Searches
9
+ module DeletedEntities
10
+ # endpoint: /deleted_entities
11
+ #
12
+ # Retrieve deleted entities
13
+ # Retrieve deleted entities for a collection id
14
+ #
15
+ # API doc:
16
+ # https://app.swaggerhub.com/apis-docs/Crunchbase/crunchbase-enterprise_api/1.0.1#/Deleted%20Entities/get_deleted_entities
17
+ #
18
+ # Parameters:
19
+ # collection_ids: string
20
+ # Filter by collection id(s). Comma separated list of collection ids.
21
+ # E.g.
22
+ # organizations, people, funding_rounds, acquisitions, investments,
23
+ # events, press_references, funds, event_appearances, ipos, ownerships,
24
+ # categories, category_groups, locations, jobs
25
+ # before_id: string
26
+ # Used to paginate search results to the previous page. before_id should be the uuid of the first item in the current page.
27
+ # May not be provided simultaneously with after_id.
28
+ # after_id: string
29
+ # Used to paginate search results to the next page. after_id should be the uuid of the last item in the current page.
30
+ # May not be provided simultaneously with before_id.
31
+ # limit: integer
32
+ # Number of rows to return. Default is 100, min is 1, max is 1000.
33
+ # deleted_at_order: string
34
+ # Direction of sorting by deleted_at property
35
+ # Available values : asc, desc
36
+ def deleted_entities(**args)
37
+ crunchbase_deleted_entities(args)
38
+ end
39
+
40
+ private
41
+
42
+ def crunchbase_deleted_entities(args)
43
+ Crunchbase::DeletedEntities::Client.new(args).deleted_entities
44
+ end
45
+ end
46
+ end
47
+ end