crunchbase4 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 305bc09f8a83e2c4413f2e1dd7081b371b118e6e40727c9770e9c816f50d7e5b
4
- data.tar.gz: e8c2c700770b5e08be5a69e613c6381877b9d1a5b551fe96114185eae2b8ce26
3
+ metadata.gz: 41773106ffa4379736f02219d7c5cc751f2115494b987d81b71757db0ffb2d7c
4
+ data.tar.gz: 83a8d8f993df099b353f55296f5e86b1d0f75274f300835a6de17fa7a48b5ef5
5
5
  SHA512:
6
- metadata.gz: f6423c5de66af723a227aac874dafb6815921cd7e3ee4efe1015adaf551b46ff55eac7335b496caae71909e0507e210139579507f516d2f2090fdd8cc4d0fb1d
7
- data.tar.gz: 7601a5f4c815c59c12c855694d7a7e497456eed498c1a1c15d396fec9197bf7c6c3fc0d276d3dbcf7d8acb2a2f0cf85cb63874c0c68cdedc8c49b6b07d0e1c5b
6
+ metadata.gz: bf41a960cf7a3d2b0e1b36173d9f64c3de0e3753a8a4ce13a9061d6862390489b007aa9c94339dc7cda178b0f86928f47e1b18a5780147c6dbb6c88ca07fa91f
7
+ data.tar.gz: 2ec1c99e9813b9da04af5dea643caf660c51e9b95ca703af0a8f09c136ea4d48d572888f6aca599f43d45d38853681be5e08971b43440814dd9f3f4bfc7a2cf1
@@ -1,6 +1,15 @@
1
1
  # Change Log
2
2
 
3
- All notable changes to this project will be documented in this file.
3
+ ## [0.1.4] - 2020-06-12
4
+
5
+ ### Added
6
+ - Implemented a API to get the fund data of Entity (`client.fund(entity_id)`)
7
+ - Implemented a API to get the ownership data of Entity (`client.ownership(entity_id)`)
8
+ - Implemented a API to get the founders data of Entity (`client.founders(entity_id)`)
9
+ - Implemented a API to get the event_appearances data of Entity (`client.event_appearances(entity_id)`)
10
+ - Implemented a API to get the investors data of Entity (`client.investors(entity_id)`)
11
+ - Implemented a API to get the jobs data of Entity (`client.jobs(entity_id)`)
12
+ - Implemented a API to get the headquarters_address data of Entity (`client.headquarters_address(entity_id)`)
4
13
 
5
14
  ## [0.1.3] - 2020-06-09
6
15
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- crunchbase4 (0.1.3)
4
+ crunchbase4 (0.1.4)
5
5
  faraday
6
6
  faraday_curl
7
7
  faraday_middleware
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Crunchbase is a ruby wrapper based on Crunchbase V4 API. it provides easy to get the API data by each endpoint. [CB v4 DOC](https://app.swaggerhub.com/apis/Crunchbase/crunchbase-enterprise_api/1.0.1)
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/crunchbase4.svg)](https://badge.fury.io/rb/crunchbase4)
6
- [![Build Status](https://travis-ci.org/encoreshao/crunchbase4.svg?branch=master)](https://travis-ci.org/encoreshao/crunchbase4)
6
+ [![Build Status](https://travis-ci.org/ekohe/crunchbase4.svg?branch=master)](https://travis-ci.org/ekohe/crunchbase4)
7
7
 
8
8
  ## Installation
9
9
 
@@ -30,6 +30,7 @@ require 'crunchbase4'
30
30
 
31
31
  CB_CONFIG = YAML.load(File.read('crunchbase.yml'))
32
32
  Crunchbase.config.user_key = CB_CONFIG['user_key']
33
+ Crunchbase.config.user_key = false # If you want to know the request information, can set the debug = true
33
34
  ```
34
35
 
35
36
  ## Usage
@@ -43,9 +44,13 @@ pry(main)> client = Crunchbase::Client.new
43
44
  #### API request for endpoint we completed
44
45
 
45
46
  - [Entity](https://github.com/ekohe/crunchbase4#entity)
46
- - organizations
47
- - people
48
- - funding_rounds
47
+ - Organization
48
+ - fields
49
+ - cards: [raised_investments, participated_funds, child_organizations, participated_investments, investors, parent_organization, raised_funding_rounds, ipos, event_appearances, raised_funds, acquiree_acquisitions, acquirer_acquisitions, parent_ownership, jobs, founders, child_ownerships, participated_funding_rounds, press_references, headquarters_address]
50
+ - Person
51
+ - fields
52
+ - FundingRound
53
+ - fields
49
54
  - [Searches](https://github.com/ekohe/crunchbase4#search)
50
55
  - [Autocompletes](https://github.com/ekohe/crunchbase4#autocompletes)
51
56
  - [Deleted Entities](https://github.com/ekohe/crunchbase4#deleted-entities)
@@ -59,6 +64,12 @@ response = client.person('mark-zuckerberg', 'participated_investments')
59
64
  response = client.funding_round('371c20af8aa94bcba8da0694d138f247')
60
65
  response = client.funding_round('371c20af8aa94bcba8da0694d138f247', 'investments')
61
66
  response = client.acquisition('7638eae9-07b7-4fc6-ad20-5d99de3ff928')
67
+ response = client.fund('aeaac12b-df56-7039-40f9-f1992f88e20e')
68
+ response = client.ownership('4506d9ce-85d3-4a8f-89cd-07a225359d55')
69
+
70
+ <!-- Get the JSON response of Entity -->
71
+
72
+ response.as_json
62
73
 
63
74
  <!-- Search -->
64
75
  client.search_organizations(query_data)
@@ -155,7 +166,6 @@ pry(main)> response.permalink
155
166
  ##### Get the funding round data
156
167
 
157
168
  ```ruby
158
- => #<Crunchbase::Client:0x00007f8806824c28>
159
169
  pry(main)> response = client.funding_round('371c20af-8aa9-4bcb-a8da-0694d138f247')
160
170
  => #<Crunchbase::Models::FundingRound:0x00007f8806b55ca8
161
171
  @announced_on="2013-06-30",
@@ -175,6 +185,30 @@ pry(main)> response.name
175
185
  pry(main)> response.uuid
176
186
  => "371c20af-8aa9-4bcb-a8da-0694d138f247"
177
187
  ```
188
+ ##### Get the fund data
189
+
190
+ ```ruby
191
+ pry(main)> response = client.fund('aeaac12b-df56-7039-40f9-f1992f88e20e')
192
+ => #<Crunchbase::Models::Fund:0x00007ffa6a5a4080
193
+ @announced_on="2017-04-03",
194
+ @created_at="2017-04-04T04:40:49Z",
195
+ @entity_def_id="fund",
196
+ @image_id="v1491280776/azwvvy68ap2o29ffcnn7.png",
197
+ @investor_identifiers=["Betaworks", "Craig Newmark Philanthropies", "Democracy Fund", "Facebook", "Ford Foundation", "Knight Foundation", "Mozilla", "Tow Foundation"],
198
+ @money_raised=14000000,
199
+ @name="The News Integrity Initiative Fund I",
200
+ @num_investors=8,
201
+ @owner_identifier="The News Integrity Initiative",
202
+ @permalink="the-news-integrity-initiative-raised-the-news-integrity-initiative-fund-i--aeaac12b",
203
+ @short_description="The News Integrity Initiative raises new The News Integrity Initiative Fund I on 2017-04-03",
204
+ @started_on=nil,
205
+ @updated_at="2018-02-12T22:18:54Z",
206
+ @uuid="aeaac12b-df56-7039-40f9-f1992f88e20e">
207
+ pry(main)> response.name
208
+ => "The News Integrity Initiative Fund I"
209
+ pry(main)> response.uuid
210
+ => "aeaac12b-df56-7039-40f9-f1992f88e20e"
211
+ ```
178
212
 
179
213
  ##### Get the acquisition data
180
214
 
@@ -236,6 +270,27 @@ pry(main)> response = client.investment('1368da0c-07b0-46ef-9a86-b518367e60d6')
236
270
  @uuid="1368da0c-07b0-46ef-9a86-b518367e60d6">
237
271
  ```
238
272
 
273
+ ##### Get the ownership data
274
+
275
+ ```ruby
276
+ pry(main)> response = client.ownership('4506d9ce-85d3-4a8f-89cd-07a225359d55')
277
+ => #<Crunchbase::Models::Ownership:0x00007fbf2fdb78b0
278
+ @created_at="2015-03-04T20:04:23Z",
279
+ @entity_def_id="ownership",
280
+ @identifier=["4506d9ce-85d3-4a8f-89cd-07a225359d55", "Facebook owns Instagram", "facebook-owns-instagram--4506d9ce"],
281
+ @name="Facebook owns Instagram",
282
+ @ownee_identifier="Instagram",
283
+ @owner_identifier="Facebook",
284
+ @ownership_type="subsidiary",
285
+ @permalink="facebook-owns-instagram--4506d9ce",
286
+ @updated_at="2018-02-13T01:18:10Z",
287
+ @uuid="4506d9ce-85d3-4a8f-89cd-07a225359d55">
288
+ pry(main)> response.name
289
+ => "Facebook owns Instagram"
290
+ pry(main)> response.uuid
291
+ => "4506d9ce-85d3-4a8f-89cd-07a225359d55"
292
+ ```
293
+
239
294
  ### Search
240
295
 
241
296
  * Search query parameters for each endpoint
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
 
20
20
  spec.metadata['homepage_uri'] = spec.homepage
21
21
  spec.metadata['source_code_uri'] = 'https://github.com/ekohe/crunchbase4'
22
- spec.metadata['changelog_uri'] = 'https://github.com/ekohe/crunchbase4/CHANGELOG.md'
22
+ spec.metadata['changelog_uri'] = 'https://github.com/ekohe/crunchbase4/blob/master/CHANGELOG.md'
23
23
 
24
24
  # Specify which files should be added to the gem when it is released.
25
25
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -41,7 +41,7 @@ module Crunchbase
41
41
  cbobject.parse_response(entity(
42
42
  root_uri(name: __method__, id: card_id),
43
43
  field_ids: cbobject.basis_fields.join(','),
44
- card_field_ids: cbobject.card_model_mappings[card_id].new.field_ids.join(',')
44
+ card_field_ids: cbobject.model_mappings[card_id].new.field_ids.join(',')
45
45
  ), cbobject.basis_fields, [card_id])
46
46
  end
47
47
 
@@ -3,7 +3,7 @@
3
3
  module Crunchbase
4
4
  # Models
5
5
  module Models
6
- autoload :Entity, 'crunchbase/models/entity'
6
+ autoload :Entity, 'crunchbase/models/concerns/entity'
7
7
  autoload :AutocompleteEntity, 'crunchbase/models/autocomplete_entity'
8
8
  autoload :DeletedEntity, 'crunchbase/models/deleted_entity'
9
9
  autoload :Organization, 'crunchbase/models/organization'
@@ -15,5 +15,11 @@ module Crunchbase
15
15
  autoload :CategoryGroup, 'crunchbase/models/category_group'
16
16
  autoload :Category, 'crunchbase/models/category'
17
17
  autoload :Ipo, 'crunchbase/models/ipo'
18
+ autoload :Fund, 'crunchbase/models/fund'
19
+ autoload :Ownership, 'crunchbase/models/ownership'
20
+ autoload :EventAppearance, 'crunchbase/models/event_appearance'
21
+ autoload :Principal, 'crunchbase/models/principal'
22
+ autoload :Job, 'crunchbase/models/job'
23
+ autoload :Address, 'crunchbase/models/address'
18
24
  end
19
25
  end
@@ -0,0 +1,36 @@
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 Address < Entity
8
+ RESOURCE_LIST = 'addresses'
9
+
10
+ def field_ids
11
+ %w[
12
+ created_at
13
+ entity_def_id
14
+ updated_at
15
+ ] + basis_fields
16
+ end
17
+
18
+ def basis_fields
19
+ %w[
20
+ uuid
21
+ name
22
+ postal_code
23
+ street_1
24
+ street_2
25
+ identifier
26
+ location_identifiers
27
+ ]
28
+ end
29
+
30
+ def full_cards
31
+ %w[
32
+ ]
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../utilities/response'
4
+ require_relative './mappings'
5
+
6
+ module Crunchbase
7
+ # Get the Organization data from API
8
+ module Models
9
+ # Root
10
+ class Entity
11
+ include ::Crunchbase::Utilities::Response
12
+ include Mappings
13
+
14
+ def fields
15
+ field_ids.map(&:to_sym)
16
+ end
17
+
18
+ def parse_response(response, request_field_ids = [], cards = [])
19
+ extract_fields = (request_field_ids.empty? ? field_ids : request_field_ids)
20
+
21
+ dynamic_attributes(self, extract_fields, response.dig('properties'))
22
+ setup_relationships(self, cards, response.dig('cards'))
23
+ self
24
+ end
25
+
26
+ def setup_relationships(object, request_card_ids, response_cards)
27
+ request_card_ids.each do |card_id|
28
+ card_data = response_cards.dig(card_id)
29
+ card_model = model_mappings[card_id]
30
+ card_objects = if card_data.is_a?(Array)
31
+ card_data.each_with_object([]) do |data, objects|
32
+ new_card_instance = card_model.new
33
+ objects << dynamic_attributes(new_card_instance, new_card_instance.basis_fields, data)
34
+ end
35
+ else
36
+ card_data.nil? ? nil : dynamic_attributes(card_model.new, extract_fields, data)
37
+ end
38
+
39
+ dynamic_define_method(object, card_id, card_objects)
40
+ end
41
+ end
42
+
43
+ def as_json
44
+ fields.each_with_object({}) { |item, hash| hash[item] = send(item) }
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Crunchbase
4
+ # Get the Organization data from API
5
+ module Models
6
+ # Build card mappings
7
+ module Mappings
8
+ def model_mappings
9
+ {
10
+ 'investments' => Investment,
11
+ 'raised_investments' => Investment,
12
+ 'participated_investments' => Investment,
13
+ 'participated_funds' => Fund,
14
+ 'raised_funds' => Fund,
15
+ 'child_organizations' => Organization,
16
+ 'parent_organization' => Organization,
17
+ 'investors' => Principal,
18
+ 'raised_funding_rounds' => FundingRound,
19
+ 'participated_funding_rounds' => FundingRound,
20
+ 'ipos' => Ipo,
21
+ 'event_appearances' => EventAppearance,
22
+ 'acquiree_acquisitions' => Acquisition,
23
+ 'parent_ownership' => Ownership,
24
+ 'child_ownerships' => Ownership,
25
+ 'jobs' => Job,
26
+ 'founders' => Person,
27
+ 'press_references' => PressReference,
28
+ 'headquarters_address' => Address
29
+ }
30
+ end
31
+ end
32
+ end
33
+ 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,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
@@ -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
@@ -84,6 +84,26 @@ module Crunchbase
84
84
  entities('ipo', entity_id).fetch_cards(cards)
85
85
  end
86
86
 
87
+ # Lookup an fund or Single card
88
+ def fund(entity_id, card_id: nil)
89
+ lookup_for('fund', entity_id, card_id)
90
+ end
91
+
92
+ # Lookup fund's all card
93
+ def fund_cards(entity_id, cards: [])
94
+ entities('fund', entity_id).fetch_cards(cards)
95
+ end
96
+
97
+ # Lookup an fund or Single card
98
+ def ownership(entity_id, card_id: nil)
99
+ lookup_for('ownership', entity_id, card_id)
100
+ end
101
+
102
+ # Lookup fund's all card
103
+ def ownership_cards(entity_id, cards: [])
104
+ entities('ownership', entity_id).fetch_cards(cards)
105
+ end
106
+
87
107
  private
88
108
 
89
109
  def entities(entity_type, entity_id)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Crunchbase
4
- VERSION = '0.1.3'
4
+ VERSION = '0.1.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crunchbase4
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Encore Shao
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-09 00:00:00.000000000 Z
11
+ date: 2020-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -141,17 +141,24 @@ files:
141
141
  - lib/crunchbase/errors.rb
142
142
  - lib/crunchbase/models.rb
143
143
  - lib/crunchbase/models/acquisition.rb
144
+ - lib/crunchbase/models/address.rb
144
145
  - lib/crunchbase/models/autocomplete_entity.rb
145
146
  - lib/crunchbase/models/category.rb
146
147
  - lib/crunchbase/models/category_group.rb
148
+ - lib/crunchbase/models/concerns/entity.rb
149
+ - lib/crunchbase/models/concerns/mappings.rb
147
150
  - lib/crunchbase/models/deleted_entity.rb
148
- - lib/crunchbase/models/entity.rb
151
+ - lib/crunchbase/models/event_appearance.rb
152
+ - lib/crunchbase/models/fund.rb
149
153
  - lib/crunchbase/models/funding_round.rb
150
154
  - lib/crunchbase/models/investment.rb
151
155
  - lib/crunchbase/models/ipo.rb
156
+ - lib/crunchbase/models/job.rb
152
157
  - lib/crunchbase/models/organization.rb
158
+ - lib/crunchbase/models/ownership.rb
153
159
  - lib/crunchbase/models/person.rb
154
160
  - lib/crunchbase/models/press_reference.rb
161
+ - lib/crunchbase/models/principal.rb
155
162
  - lib/crunchbase/searches.rb
156
163
  - lib/crunchbase/searches/client.rb
157
164
  - lib/crunchbase/utilities.rb
@@ -172,7 +179,7 @@ metadata:
172
179
  allowed_push_host: https://rubygems.org
173
180
  homepage_uri: https://github.com/ekohe/crunchbase4
174
181
  source_code_uri: https://github.com/ekohe/crunchbase4
175
- changelog_uri: https://github.com/ekohe/crunchbase4/CHANGELOG.md
182
+ changelog_uri: https://github.com/ekohe/crunchbase4/blob/master/CHANGELOG.md
176
183
  post_install_message: Thanks for installing!
177
184
  rdoc_options: []
178
185
  require_paths:
@@ -1,72 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../utilities/response'
4
-
5
- module Crunchbase
6
- # Get the Organization data from API
7
- module Models
8
- # Root
9
- class Entity
10
- include ::Crunchbase::Utilities::Response
11
-
12
- def fields
13
- field_ids.map(&:to_sym)
14
- end
15
-
16
- def parse_response(response, request_field_ids = [], cards = [])
17
- extract_fields = (request_field_ids.empty? ? field_ids : request_field_ids)
18
-
19
- dynamic_attributes(self, extract_fields, response.dig('properties'))
20
- setup_relationships(self, cards, response.dig('cards'))
21
- self
22
- end
23
-
24
- def setup_relationships(object, request_card_ids, response_cards)
25
- request_card_ids.each do |card_id|
26
- card_data = response_cards.dig(card_id)
27
- next if card_data.nil? || card_data.empty?
28
-
29
- card_model = card_model_mappings[card_id]
30
- card_objects = if card_data.is_a?(Array)
31
- card_data.each_with_object([]) do |data, objects|
32
- new_card_instance = card_model.new
33
- objects << dynamic_attributes(new_card_instance, new_card_instance.basis_fields, data)
34
- end
35
- else
36
- dynamic_attributes(card_model.new, extract_fields, data)
37
- end
38
-
39
- dynamic_define_method(object, card_id, card_objects)
40
- end
41
- end
42
-
43
- def as_json
44
- fields.each_with_object({}) { |item, hash| hash[item] = send(item) }
45
- end
46
-
47
- def card_model_mappings
48
- {
49
- 'investments' => Crunchbase::Models::Investment,
50
- 'raised_investments' => Crunchbase::Models::Investment,
51
- # 'participated_funds' => Crunchbase::Models::Fund,
52
- 'child_organizations' => Crunchbase::Models::Organization,
53
- 'participated_investments' => Crunchbase::Models::Investment,
54
- # 'investors' => Crunchbase::Models::Investor,
55
- 'parent_organization' => Crunchbase::Models::Organization,
56
- 'raised_funding_rounds' => Crunchbase::Models::FundingRound,
57
- 'ipos' => Crunchbase::Models::Ipo,
58
- # 'event_appearances' => Crunchbase::Models::EventAppearance,
59
- # 'raised_funds' => Crunchbase::Models::Fund,
60
- 'acquiree_acquisitions' => Crunchbase::Models::Acquisition,
61
- # 'parent_ownership' => Crunchbase::Models::Ownership,
62
- # 'jobs' => Crunchbase::Models::Job,
63
- # 'founders' => Crunchbase::Models::Founder,
64
- # 'child_ownerships' => Crunchbase::Models::Ownership,
65
- 'participated_funding_rounds' => Crunchbase::Models::FundingRound,
66
- 'press_references' => Crunchbase::Models::PressReference
67
- # 'headquarters_address' => Crunchbase::Models::Address,
68
- }
69
- end
70
- end
71
- end
72
- end