crunchbase_v2 1.1.2 → 1.1.3

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.
data/lib/crunchbase.rb CHANGED
@@ -34,6 +34,7 @@ require "crunchbase/primary_affiliation"
34
34
  require "crunchbase/advisor_at"
35
35
  require "crunchbase/founded_company"
36
36
  require "crunchbase/primary_location"
37
+ require "crunchbase/organization_investor"
37
38
  require "crunchbase/video"
38
39
  require "crunchbase/version"
39
40
 
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # https://api.crunchbase.com/v/2/organization/facebook/acquisitions
3
+ # https://api.crunchbase.com/v/2/organization/#{permalink}/acquisitions
4
4
 
5
5
  module Crunchbase
6
6
  class Acquisition < CBEntity
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # https://api.crunchbase.com/v/2/organization/facebook/board_members_and_advisors
3
+ # https://api.crunchbase.com/v/2/organization/#{permalink}/board_members_and_advisors
4
4
 
5
5
  module Crunchbase
6
6
  class BoardMembersAndAdvisor < CBEntity
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # https://api.crunchbase.com/v/2/organization/facebook/categories
3
+ # https://api.crunchbase.com/v/2/organization/#{permalink}/categories
4
4
 
5
5
  module Crunchbase
6
6
  class Category < CBEntity
@@ -3,7 +3,7 @@
3
3
  module Crunchbase
4
4
  class CBEntity
5
5
 
6
- RELATIONSHIPS = %w[ Crunchbase::Ipo Crunchbase::Product Crunchbase::SubOrganization Crunchbase::FundingRound Crunchbase::Founder Crunchbase::Customer Crunchbase::Competitor Crunchbase::Acquisition Crunchbase::Degree Crunchbase::PrimaryAffiliation Crunchbase::Experience, Crunchbase::FoundedCompany Crunchbase::Video Crunchbase::PrimaryLocation Crunchbase::AdvisorAt ]
6
+ RELATIONSHIPS = %w[ Crunchbase::Ipo Crunchbase::Product Crunchbase::SubOrganization Crunchbase::FundingRound Crunchbase::Founder Crunchbase::Customer Crunchbase::Competitor Crunchbase::Acquisition Crunchbase::Degree Crunchbase::PrimaryAffiliation Crunchbase::Experience, Crunchbase::FoundedCompany Crunchbase::Video Crunchbase::PrimaryLocation Crunchbase::AdvisorAt Crunchbase::OrganizationInvestor ]
7
7
 
8
8
  # Factory method to return an instance from a permalink
9
9
  def self.get(permalink)
@@ -57,6 +57,14 @@ module Crunchbase
57
57
  end
58
58
  end
59
59
 
60
+ def self.parsing_from_list(list)
61
+ return [] if list.nil?
62
+
63
+ list.map do |l|
64
+ self.new l
65
+ end
66
+ end
67
+
60
68
  def self.total_items_from_list(list)
61
69
  return 0 if list.nil?
62
70
 
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # https://api.crunchbase.com/v/2/organization/facebook/competitors
3
+ # https://api.crunchbase.com/v/2/organization/#{permalink}/competitors
4
4
 
5
5
  module Crunchbase
6
6
  class Competitor < CBEntity
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # https://api.crunchbase.com/v/2/organization/facebook/current_team
3
+ # https://api.crunchbase.com/v/2/organization/#{permalink}/current_team
4
4
 
5
5
  module Crunchbase
6
6
  class CurrentTeam < CBEntity
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # https://api.crunchbase.com/v/2/organization/facebook/customers
3
+ # https://api.crunchbase.com/v/2/organization/#{permalink}/customers
4
4
 
5
5
  module Crunchbase
6
6
  class Customer < CBEntity
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # https://api.crunchbase.com/v/2/organization/facebook/founders?user_key=key
3
+ # https://api.crunchbase.com/v/2/organization/#{permalink}/founders?user_key=key
4
4
 
5
5
  module Crunchbase
6
6
  class Founder < CBEntity
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # https://api.crunchbase.com/v/2/organization/facebook/funding_rounds
3
+ # https://api.crunchbase.com/v/2/organization/#{permalink}/funding_rounds
4
4
 
5
5
  module Crunchbase
6
6
  class FundingRound < CBEntity
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # https://api.crunchbase.com/v/2/organization/facebook/headquarters
3
+ # https://api.crunchbase.com/v/2/organization/#{permalink}/headquarters
4
4
 
5
5
  module Crunchbase
6
6
  class Headquarter < CBEntity
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # https://api.crunchbase.com/v/2/organization/facebook/images
3
+ # https://api.crunchbase.com/v/2/organization/#{permalink}/images
4
4
 
5
5
  module Crunchbase
6
6
  class Image < CBEntity
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # https://api.crunchbase.com/v/2/organization/facebook/investments
3
+ # https://api.crunchbase.com/v/2/organization/#{permalink}/investments
4
4
 
5
5
  module Crunchbase
6
6
  class Investment < CBEntity
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # https://api.crunchbase.com/v/2/organization/facebook/news
3
+ # https://api.crunchbase.com/v/2/organization/#{permalink}/news
4
4
 
5
5
  module Crunchbase
6
6
  class NewItem < CBEntity
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # https://api.crunchbase.com/v/2/organization/facebook/offices
3
+ # https://api.crunchbase.com/v/2/organization/#{permalink}/offices
4
4
 
5
5
  module Crunchbase
6
6
  class Office < CBEntity
@@ -19,7 +19,7 @@ module Crunchbase
19
19
  attr_reader :past_teams, :sub_organizations, :current_teams, :acquisitions, :competitors,
20
20
  :offices, :headquarters, :funding_rounds, :categories, :customers, :investments,
21
21
  :founders, :ipos, :products, :primary_images, :images, :websites, :new_items,
22
- :board_members_and_advisors
22
+ :board_members_and_advisors, :acquired_bies, :investors
23
23
 
24
24
  attr_reader :past_teams_total_items, :sub_organizations_total_items, :current_teams_total_items,
25
25
  :acquisitions_total_items, :competitors_total_items, :offices_total_items,
@@ -27,7 +27,8 @@ module Crunchbase
27
27
  :customers_total_items, :investments_total_items, :founders_total_items,
28
28
  :ipos_total_items, :products_total_items, :primary_images_total_items,
29
29
  :images_total_items, :websites_total_items, :new_items_total_items,
30
- :board_members_and_advisors_total_items
30
+ :board_members_and_advisors_total_items, :acquired_bies_total_items,
31
+ :investors_total_items
31
32
 
32
33
 
33
34
  def initialize(json)
@@ -62,6 +63,7 @@ module Crunchbase
62
63
  @number_of_employees = properties['number_of_employees']
63
64
  @stock_symbol = properties['stock_symbol']
64
65
  @stock_exchange = properties['stock_exchange']
66
+ @investors_list = properties['investors']
65
67
  @created_at = Time.at(properties['created_at']).utc
66
68
  @updated_at = Time.at(properties['updated_at']).utc
67
69
 
@@ -84,6 +86,7 @@ module Crunchbase
84
86
  @websites_list = relationships['websites']
85
87
  @new_items_list = relationships['news']
86
88
  @board_members_and_advisors_list = relationships['board_members_and_advisors']
89
+ @acquired_bies_list = relationships['acquired_by']
87
90
  end
88
91
 
89
92
  # ================================================================
@@ -180,6 +183,14 @@ module Crunchbase
180
183
  @board_members_and_advisors ||= BoardMembersAndAdvisor.array_from_list(@board_members_and_advisors_list)
181
184
  end
182
185
 
186
+ def acquired_bies
187
+ @acquired_bies ||= Relationship.array_from_list(@acquired_bies_list)
188
+ end
189
+
190
+ def investors
191
+ @investors ||= OrganizationInvestor.parsing_from_list(@investors_list)
192
+ end
193
+
183
194
  # Get all relationship total_items_count
184
195
  def past_teams_total_items
185
196
  @past_teams_total_items ||= PastTeam.total_items_from_list(@past_teams_list)
@@ -257,5 +268,13 @@ module Crunchbase
257
268
  @board_members_and_advisors_total_items ||= BoardMembersAndAdvisor.total_items_from_list(@board_members_and_advisors_list)
258
269
  end
259
270
 
271
+ def acquired_bies_total_items
272
+ @acquired_bies_total_items ||= Acquisition.total_items_from_list(@acquired_bies_list)
273
+ end
274
+
275
+ def investors_total_items
276
+ @investors_total_items ||= @investors_list.count
277
+ end
278
+
260
279
  end
261
280
  end
@@ -0,0 +1,24 @@
1
+ # encoding: utf-8
2
+
3
+ module Crunchbase
4
+ class OrganizationInvestor < CBEntity
5
+
6
+ attr_reader :name, :type_name, :path, :permalink, :first_name, :last_name, :type
7
+
8
+ def initialize(hash)
9
+ @type_name = hash["type"]
10
+ if hash["type"] == 'Organization'
11
+ @type = Organization
12
+ @name = hash["name"]
13
+ else
14
+ @type = Person
15
+ @name = [hash["first_name"], hash["last_name"]].compact.join(' ')
16
+ @first_name = hash["first_name"]
17
+ @last_name = hash["last_name"]
18
+ end
19
+ @path = hash["path"]
20
+ @permalink = hash["path"] && hash["path"].split('/').last
21
+ end
22
+
23
+ end
24
+ end
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # https://api.crunchbase.com/v/2/organization/facebook/past_team
3
+ # https://api.crunchbase.com/v/2/organization/#{permalink}/past_team
4
4
 
5
5
  require 'date'
6
6
 
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # https://api.crunchbase.com/v/2/person/#{permalink}?user_key=key
3
+ # https://api.crunchbase.com/v/2/person/#{permalink}?user_key=#{user_key}
4
4
 
5
5
  module Crunchbase
6
6
  class Person < CBEntity
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # https://api.crunchbase.com/v/2/person/#{permalink}/primary_affiliation?user_key=key
3
+ # https://api.crunchbase.com/v/2/person/#{permalink}/primary_affiliation?user_key=#{user_key}
4
4
 
5
5
  module Crunchbase
6
6
  class PrimaryAffiliation < CBEntity
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # https://api.crunchbase.com/v/2/organization/facebook/primary_image
3
+ # https://api.crunchbase.com/v/2/organization/#{permalink}/primary_image
4
4
 
5
5
  module Crunchbase
6
6
  class PrimaryImage < CBEntity
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # https://api.crunchbase.com/v/2/person/reed-hastings/primary_location
3
+ # https://api.crunchbase.com/v/2/person/#{permalink}/primary_location
4
4
 
5
5
  module Crunchbase
6
6
  class PrimaryLocation < CBEntity
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # https://api.crunchbase.com/v/2/organization/facebook/products
3
+ # https://api.crunchbase.com/v/2/organization/#{permalink}/products
4
4
 
5
5
  require 'date'
6
6
 
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # https://api.crunchbase.com/v/2/organization/facebook/sub_organizations
3
+ # https://api.crunchbase.com/v/2/organization/#{permalink}/sub_organizations
4
4
 
5
5
  module Crunchbase
6
6
  class SubOrganization < CBEntity
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Crunchbase
4
- VERSION = "1.1.2"
4
+ VERSION = "1.1.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crunchbase_v2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Encore Shao
@@ -10,93 +11,105 @@ authors:
10
11
  autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []
13
- date: 2015-04-05 00:00:00.000000000 Z
14
+ date: 2015-04-13 00:00:00.000000000 Z
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: bundler
17
18
  requirement: !ruby/object:Gem::Requirement
19
+ none: false
18
20
  requirements:
19
- - - "~>"
21
+ - - ~>
20
22
  - !ruby/object:Gem::Version
21
23
  version: '1.6'
22
24
  type: :development
23
25
  prerelease: false
24
26
  version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
25
28
  requirements:
26
- - - "~>"
29
+ - - ~>
27
30
  - !ruby/object:Gem::Version
28
31
  version: '1.6'
29
32
  - !ruby/object:Gem::Dependency
30
33
  name: rake
31
34
  requirement: !ruby/object:Gem::Requirement
35
+ none: false
32
36
  requirements:
33
- - - ">="
37
+ - - ! '>='
34
38
  - !ruby/object:Gem::Version
35
39
  version: '0'
36
40
  type: :development
37
41
  prerelease: false
38
42
  version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
39
44
  requirements:
40
- - - ">="
45
+ - - ! '>='
41
46
  - !ruby/object:Gem::Version
42
47
  version: '0'
43
48
  - !ruby/object:Gem::Dependency
44
49
  name: rspec
45
50
  requirement: !ruby/object:Gem::Requirement
51
+ none: false
46
52
  requirements:
47
- - - "~>"
53
+ - - ~>
48
54
  - !ruby/object:Gem::Version
49
55
  version: '3.0'
50
56
  type: :development
51
57
  prerelease: false
52
58
  version_requirements: !ruby/object:Gem::Requirement
59
+ none: false
53
60
  requirements:
54
- - - "~>"
61
+ - - ~>
55
62
  - !ruby/object:Gem::Version
56
63
  version: '3.0'
57
64
  - !ruby/object:Gem::Dependency
58
65
  name: rspec-its
59
66
  requirement: !ruby/object:Gem::Requirement
67
+ none: false
60
68
  requirements:
61
- - - ">="
69
+ - - ! '>='
62
70
  - !ruby/object:Gem::Version
63
71
  version: '0'
64
72
  type: :development
65
73
  prerelease: false
66
74
  version_requirements: !ruby/object:Gem::Requirement
75
+ none: false
67
76
  requirements:
68
- - - ">="
77
+ - - ! '>='
69
78
  - !ruby/object:Gem::Version
70
79
  version: '0'
71
80
  - !ruby/object:Gem::Dependency
72
81
  name: webmock
73
82
  requirement: !ruby/object:Gem::Requirement
83
+ none: false
74
84
  requirements:
75
- - - ">="
85
+ - - ! '>='
76
86
  - !ruby/object:Gem::Version
77
87
  version: '0'
78
88
  type: :development
79
89
  prerelease: false
80
90
  version_requirements: !ruby/object:Gem::Requirement
91
+ none: false
81
92
  requirements:
82
- - - ">="
93
+ - - ! '>='
83
94
  - !ruby/object:Gem::Version
84
95
  version: '0'
85
96
  - !ruby/object:Gem::Dependency
86
97
  name: vcr
87
98
  requirement: !ruby/object:Gem::Requirement
99
+ none: false
88
100
  requirements:
89
- - - ">="
101
+ - - ! '>='
90
102
  - !ruby/object:Gem::Version
91
103
  version: '0'
92
104
  type: :development
93
105
  prerelease: false
94
106
  version_requirements: !ruby/object:Gem::Requirement
107
+ none: false
95
108
  requirements:
96
- - - ">="
109
+ - - ! '>='
97
110
  - !ruby/object:Gem::Version
98
111
  version: '0'
99
- description: " Ruby wrapper for Crunchbase API version 2 "
112
+ description: ! ' Ruby wrapper for Crunchbase API version 2 '
100
113
  email:
101
114
  - encore.shao@gmail.com
102
115
  - ladislav.martincik@gmail.com
@@ -104,7 +117,7 @@ executables: []
104
117
  extensions: []
105
118
  extra_rdoc_files: []
106
119
  files:
107
- - ".gitignore"
120
+ - .gitignore
108
121
  - Gemfile
109
122
  - LICENSE.txt
110
123
  - README.rdoc
@@ -134,6 +147,7 @@ files:
134
147
  - lib/crunchbase/new_item.rb
135
148
  - lib/crunchbase/office.rb
136
149
  - lib/crunchbase/organization.rb
150
+ - lib/crunchbase/organization_investor.rb
137
151
  - lib/crunchbase/past_team.rb
138
152
  - lib/crunchbase/person.rb
139
153
  - lib/crunchbase/primary_affiliation.rb
@@ -182,26 +196,33 @@ files:
182
196
  homepage: https://github.com/encoreshao/crunchbase_v2
183
197
  licenses:
184
198
  - MIT
185
- metadata: {}
186
199
  post_install_message:
187
200
  rdoc_options: []
188
201
  require_paths:
189
202
  - lib
190
203
  required_ruby_version: !ruby/object:Gem::Requirement
204
+ none: false
191
205
  requirements:
192
- - - ">="
206
+ - - ! '>='
193
207
  - !ruby/object:Gem::Version
194
208
  version: '0'
209
+ segments:
210
+ - 0
211
+ hash: 3545074420670242910
195
212
  required_rubygems_version: !ruby/object:Gem::Requirement
213
+ none: false
196
214
  requirements:
197
- - - ">="
215
+ - - ! '>='
198
216
  - !ruby/object:Gem::Version
199
217
  version: '0'
218
+ segments:
219
+ - 0
220
+ hash: 3545074420670242910
200
221
  requirements: []
201
222
  rubyforge_project:
202
- rubygems_version: 2.4.5
223
+ rubygems_version: 1.8.23.2
203
224
  signing_key:
204
- specification_version: 4
225
+ specification_version: 3
205
226
  summary: Ruby wrapper for Crunchbase API version 2
206
227
  test_files:
207
228
  - spec/apikey.example.yml
@@ -236,4 +257,3 @@ test_files:
236
257
  - spec/fixtures/person-randi-zuckerberg.js
237
258
  - spec/spec_helper.rb
238
259
  - spec/support/shared_examples.rb
239
- has_rdoc:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 5b3539da5df418331ba6aee61567a4ba53d1f9df
4
- data.tar.gz: ae2c416d8456e4a43caf10e0ae89ea58a7e448c9
5
- SHA512:
6
- metadata.gz: 5661c53f931f4c2db09e6ee1a15c63a6fc646c2831fd6526204540ff3c04bb01eefce23b5b9e0694926fce9a59b9556864fb405479ea602d7fa090e7654ffb3b
7
- data.tar.gz: b68978076fd4f4426447fcc1c6c9f74a52e42b99c4230e62636a83c9e83a060fdd13d00dae3f179753983d1401fba200034ac5398ed82ae28a429aa4fbb6a0e3