crunchbase4 0.1.6 → 0.1.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cdb7c5623a3de943904cfb33279384f6af90794bd04422502300a1f3a6734fd4
4
- data.tar.gz: dcdb6527385ea1cf7bfdf9e59b5919ccbba6239673b596b015117eae40e0ee29
3
+ metadata.gz: f3b4fc39257c331e78bdf3f05dd4e08c96c67b34c8e0627c2c7bc5a583f5a7f6
4
+ data.tar.gz: 22f753ee2a2b785247c8311fd126ef826853028c542bbae010e55a391aa59e6e
5
5
  SHA512:
6
- metadata.gz: 73f00d14346138c7631c09338800ceecd2e67106351401a5c2bd7956ed53bd66d26cbfc95e52409e4e97800112cfabe4ddff3c139cbe48c4021bba0aee8760b2
7
- data.tar.gz: dd131ff9d6f0ebcf6cf18df11b06d170db839117084bd6a6e995bbdeadffe15dda5a9a0e4b95a89c232a5efbe003c8ba0b748ac5d4e730f7522751024e44c2e1
6
+ metadata.gz: 13c65190a96019e452efe17a6f0173c4cc3f1cbf28ca067fc56da2c394377f5b3f48176d3c34383e242bfa25ead36a9a70156ba0c243e23381ab7c39ba9bbcfd
7
+ data.tar.gz: c13e836e817f2509dac847db8c8f733eb680d0eb69e81961cab23288d9bf3190479481bd5fe9b67a1402d0f164195ba3097601a9c3a7bade0bfb78561380e2e3
@@ -1,5 +1,12 @@
1
1
  # Change Log
2
2
 
3
+ ## [0.1.7] - 2020-12-02
4
+
5
+ ### Improve press_reference API response for activity_entities
6
+ - Returns relationship data for activity_entities
7
+ * Before returns all names for activity_entities
8
+ * After returns related organzation or person object
9
+
3
10
  ## [0.1.5] - 2020-06-26
4
11
 
5
12
  ### Refactoring
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- crunchbase4 (0.1.5)
4
+ crunchbase4 (0.1.7)
5
5
  faraday
6
6
  faraday_curl
7
7
  faraday_middleware
data/README.md CHANGED
@@ -252,12 +252,87 @@ pry(main)> response.acquiree_funding_total
252
252
 
253
253
  ```ruby
254
254
  pry(main)> response = client.press_reference('0171b30e-9cf8-4ad5-8288-2993e4308e0f')
255
- => #<Crunchbase::Models::PressReference:0x00007fce2d33dbc0
256
- @activity_entities=["Facebook", "General Atlantic", "KKR", "Reliance Industries", "Vista Equity Partners"],
255
+ => #<Crunchbase::Models::PressReference:0x00007fd6faf97800
256
+ @activity_entities=
257
+ [#<Crunchbase::Models::Organization:0x00007fd6fb41d9d8
258
+ @aliases=nil,
259
+ @description=nil,
260
+ @identifier=[],
261
+ @legal_name=nil,
262
+ @linkedin=nil,
263
+ @name="Facebook",
264
+ @permalink="facebook",
265
+ @permalink_aliases=nil,
266
+ @rank_org=nil,
267
+ @rank_org_company=nil,
268
+ @short_description=nil,
269
+ @twitter=nil,
270
+ @uuid="df662812-7f97-0b43-9d3e-12f64f504fbb",
271
+ @website=nil>,
272
+ #<Crunchbase::Models::Organization:0x00007fd6fb42f2c8
273
+ @aliases=nil,
274
+ @description=nil,
275
+ @identifier=[],
276
+ @legal_name=nil,
277
+ @linkedin=nil,
278
+ @name="General Atlantic",
279
+ @permalink="general-atlantic",
280
+ @permalink_aliases=nil,
281
+ @rank_org=nil,
282
+ @rank_org_company=nil,
283
+ @short_description=nil,
284
+ @twitter=nil,
285
+ @uuid="8b8d96f8-9dfe-b27a-8f57-7d266a051dc9",
286
+ @website=nil>,
287
+ #<Crunchbase::Models::Organization:0x00007fd6fb42da18
288
+ @aliases=nil,
289
+ @description=nil,
290
+ @identifier=[],
291
+ @legal_name=nil,
292
+ @linkedin=nil,
293
+ @name="Kohlberg Kravis Roberts",
294
+ @permalink="kkr",
295
+ @permalink_aliases=nil,
296
+ @rank_org=nil,
297
+ @rank_org_company=nil,
298
+ @short_description=nil,
299
+ @twitter=nil,
300
+ @uuid="6c93ebd7-3558-5603-daaf-074652d0e1bb",
301
+ @website=nil>,
302
+ #<Crunchbase::Models::Organization:0x00007fd6fb42c168
303
+ @aliases=nil,
304
+ @description=nil,
305
+ @identifier=[],
306
+ @legal_name=nil,
307
+ @linkedin=nil,
308
+ @name="Reliance Industries",
309
+ @permalink="reliance-industries-84fd",
310
+ @permalink_aliases=nil,
311
+ @rank_org=nil,
312
+ @rank_org_company=nil,
313
+ @short_description=nil,
314
+ @twitter=nil,
315
+ @uuid="7ba47aa0-0e01-4101-a74d-67a8205584fd",
316
+ @website=nil>,
317
+ #<Crunchbase::Models::Organization:0x00007fd6fb43e868
318
+ @aliases=nil,
319
+ @description=nil,
320
+ @identifier=[],
321
+ @legal_name=nil,
322
+ @linkedin=nil,
323
+ @name="Vista Equity Partners",
324
+ @permalink="vista-equity-partners",
325
+ @permalink_aliases=nil,
326
+ @rank_org=nil,
327
+ @rank_org_company=nil,
328
+ @short_description=nil,
329
+ @twitter=nil,
330
+ @uuid="4d096273-ae5d-d4c3-a411-20a42514d2ce",
331
+ @website=nil>],
257
332
  @author=nil,
258
333
  @created_at="2020-06-05T17:41:10Z",
259
334
  @entity_def_id="press_reference",
260
- @identifier="Jio Platforms to receive $1.2b from Abu Dhabi’s sovereign investment firm",
335
+ @identifier=["0171b30e-9cf8-4ad5-8288-2993e4308e0f", "Jio Platforms to receive $1.2b from Abu Dhabi’s sovereign investment firm"],
261
336
  @posted_on="2020-06-05",
262
337
  @publisher="Tech in Asia",
263
338
  @thumbnail_url="https://cdn.techinasia.com/wp-content/uploads/2016/07/Flickr_-_World_Economic_Forum_-_Ambani.jpg",
@@ -45,6 +45,7 @@ module Crunchbase
45
45
  end
46
46
 
47
47
  private
48
+
48
49
  def custom_fields
49
50
  []
50
51
  end
@@ -140,6 +140,7 @@ module Crunchbase
140
140
  end
141
141
 
142
142
  private
143
+
143
144
  def custom_fields
144
145
  %w[employees_range]
145
146
  end
@@ -56,11 +56,30 @@ module Crunchbase
56
56
  value = data.dig(name)
57
57
 
58
58
  return value if value.nil? || value.is_a?(String)
59
- return value.collect { |e| e.dig('value') } if value.is_a?(Array) && value[0].is_a?(Hash) && value[0].keys.include?('value')
59
+ return parse_items(value, name) if value.is_a?(Array) && value[0].is_a?(Hash) && value[0].keys.include?('value')
60
60
  return value.dig('value') if value.is_a?(Hash) && value.keys.include?('value')
61
61
 
62
62
  value
63
63
  end
64
+
65
+ def parse_items(items, field_name)
66
+ return items.collect { |e| e.dig('value') } unless field_name == 'activity_entities'
67
+
68
+ # Sepcial case for activity_entities
69
+ items.each_with_object([]) do |item, objects|
70
+ card_model = case item['entity_def_id']
71
+ when 'person' then ::Crunchbase::Models::Person
72
+ when 'organization' then ::Crunchbase::Models::Organization
73
+ end
74
+ # Alias: value is name
75
+ item['name'] ||= item['value']
76
+
77
+ next if card_model.nil?
78
+
79
+ new_card_instance = card_model.new
80
+ objects << dynamic_attributes(new_card_instance, new_card_instance.basis_fields, item)
81
+ end
82
+ end
64
83
  end
65
84
  end
66
85
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Crunchbase
4
- VERSION = '0.1.6'
4
+ VERSION = '0.1.7'
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.6
4
+ version: 0.1.7
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-11-01 00:00:00.000000000 Z
11
+ date: 2020-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday