crunchbase-ruby-library 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,9 +18,7 @@ module Crunchbase
18
18
  autoload :Founder, "crunchbase/model/founder"
19
19
  autoload :Fund, "crunchbase/model/fund"
20
20
  autoload :FundRaise, "crunchbase/model/fund_raise"
21
- autoload :FundedOrganization, "crunchbase/model/funded_organization"
22
21
  autoload :FundingRound, "crunchbase/model/funding_round"
23
- autoload :FundingRoundOrganization, "crunchbase/model/funding_round_organization"
24
22
  autoload :Headquarter, "crunchbase/model/headquarter"
25
23
  autoload :Image, "crunchbase/model/image"
26
24
  autoload :Investment, "crunchbase/model/investment"
@@ -27,11 +27,11 @@ module Crunchbase::Model
27
27
  if relationships['funded_organization']['item'].nil?
28
28
 
29
29
  # Get organization's (investments - funding - organization)
30
- instance_relationships_object(Crunchbase::Model::FundingRoundOrganization, 'funded_organization', relationships['funded_organization'])
30
+ instance_relationships_object(Crunchbase::Model::Organization, 'funded_organization', relationships['funded_organization'])
31
31
  else
32
32
  # Get funding-rounds (funded_organization - item)
33
33
 
34
- set_relationships_object(Crunchbase::Model::FundedOrganization, 'funded_organization', relationships['funded_organization'])
34
+ set_relationships_object(Crunchbase::Model::Organization, 'funded_organization', relationships['funded_organization'])
35
35
  end
36
36
  end
37
37
 
@@ -7,13 +7,19 @@ module Crunchbase::Model
7
7
 
8
8
  attr_reader :money_invested, :money_invested_currency_code, :money_invested_usd, :created_at, :updated_at
9
9
 
10
- attr_reader :funding_round, :invested_in
10
+ attr_reader :funding_round, :invested_in, :investors
11
11
 
12
12
  def initialize(json)
13
13
  super
14
14
 
15
15
  unless (relationships = json['relationships']).nil?
16
16
  instance_relationships_object(Crunchbase::Model::FundingRound, 'funding_round', relationships['funding_round'])
17
+
18
+ if relationships['investors'].kind_of?(Array)
19
+ instance_multi_relationships_object(Crunchbase::Model::Investor, 'investors', relationships['investors'])
20
+ else
21
+ instance_relationships_object(Crunchbase::Model::Investor, 'investors', relationships['investors'])
22
+ end unless relationships['investors'].nil?
17
23
  end
18
24
  end
19
25
 
@@ -23,5 +29,16 @@ module Crunchbase::Model
23
29
  ]
24
30
  end
25
31
 
32
+ private
33
+ def instance_multi_relationships_object(object_name, key, items)
34
+ multi_items = []
35
+
36
+ items.each do |item|
37
+ multi_items << object_name.new(item || nil)
38
+ end
39
+
40
+ instance_variable_set "@#{key}", multi_items
41
+ end
42
+
26
43
  end
27
44
  end
@@ -37,6 +37,8 @@ module Crunchbase::Model
37
37
  set_relationships_object(Crunchbase::Model::PrimaryImage, 'primary_image', relationships['primary_image'])
38
38
  set_relationships_object(Crunchbase::Model::Founder, 'founders', relationships['founders'])
39
39
  set_relationships_object(Crunchbase::Model::CurrentTeam, 'current_team', relationships['current_team'])
40
+ set_relationships_object(Crunchbase::Model::PastTeam, 'past_team', relationships['past_team'])
41
+ set_relationships_object(Crunchbase::Model::BoardMembersAndAdvisor, 'board_members_and_advisors', relationships['board_members_and_advisors'])
40
42
  set_relationships_object(Crunchbase::Model::Investor, 'investors', relationships['investors'])
41
43
  set_relationships_object(Crunchbase::Model::OwnedBy, 'owned_by', relationships['owned_by'])
42
44
  set_relationships_object(Crunchbase::Model::SubOrganization, 'sub_organizations', relationships['sub_organizations'])
@@ -1,3 +1,3 @@
1
1
  module Crunchbase
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -5,8 +5,14 @@ module Crunchbase
5
5
 
6
6
  describe FundingRound, "#get" do
7
7
  round = FundingRound.get('c31e2cc41e8f30c6da0aaf6b395469e5')
8
-
8
+
9
9
  puts round.inspect
10
+
11
+ round.investments.map {|e|
12
+ e.investors.each do |investor|
13
+ puts investor.object.inspect
14
+ end unless e.investors.nil?
15
+ } unless round.investments.nil?
10
16
  end
11
17
 
12
18
  describe FundingRound, "#organization_lists" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crunchbase-ruby-library
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-06-01 00:00:00.000000000 Z
12
+ date: 2015-06-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -109,9 +109,7 @@ files:
109
109
  - lib/crunchbase/model/founder.rb
110
110
  - lib/crunchbase/model/fund.rb
111
111
  - lib/crunchbase/model/fund_raise.rb
112
- - lib/crunchbase/model/funded_organization.rb
113
112
  - lib/crunchbase/model/funding_round.rb
114
- - lib/crunchbase/model/funding_round_organization.rb
115
113
  - lib/crunchbase/model/headquarter.rb
116
114
  - lib/crunchbase/model/image.rb
117
115
  - lib/crunchbase/model/investment.rb
@@ -169,7 +167,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
169
167
  version: '0'
170
168
  segments:
171
169
  - 0
172
- hash: 3754659475277172758
170
+ hash: 2310677653189889271
173
171
  required_rubygems_version: !ruby/object:Gem::Requirement
174
172
  none: false
175
173
  requirements:
@@ -178,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
178
176
  version: '0'
179
177
  segments:
180
178
  - 0
181
- hash: 3754659475277172758
179
+ hash: 2310677653189889271
182
180
  requirements: []
183
181
  rubyforge_project:
184
182
  rubygems_version: 1.8.23.2
@@ -1,25 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Crunchbase::Model
4
- class FundedOrganization < Crunchbase::Model::Entity
5
-
6
- attr_reader :type, :name, :path, :created_at, :updated_at
7
-
8
- def initialize(json)
9
- property_keys.each { |v|
10
- instance_variable_set("@#{v}", json[v] || nil)
11
- }
12
-
13
- %w[created_at updated_at].each { |v|
14
- instance_variable_set("@#{v}", Time.at(json[v]))
15
- }
16
- end
17
-
18
- def property_keys
19
- %w[
20
- type name path created_at updated_at
21
- ]
22
- end
23
-
24
- end
25
- end
@@ -1,7 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Crunchbase::Model
4
- class FundingRoundOrganization < Crunchbase::Model::Organization
5
-
6
- end
7
- end