crunchbase 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -7,4 +7,5 @@ group :development do
7
7
  gem "bundler", "~> 1.0.0"
8
8
  gem "jeweler", "~> 1.6.4"
9
9
  gem "rcov", ">= 0"
10
+ gem "rdoc"
10
11
  end
data/Gemfile.lock CHANGED
@@ -10,6 +10,7 @@ GEM
10
10
  json (1.5.4)
11
11
  rake (0.9.2)
12
12
  rcov (0.9.10)
13
+ rdoc (3.9.4)
13
14
  rspec (2.6.0)
14
15
  rspec-core (~> 2.6.0)
15
16
  rspec-expectations (~> 2.6.0)
@@ -27,4 +28,5 @@ DEPENDENCIES
27
28
  jeweler (~> 1.6.4)
28
29
  json
29
30
  rcov
31
+ rdoc
30
32
  rspec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
data/crunchbase.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{crunchbase}
8
- s.version = "0.0.3"
8
+ s.version = "0.0.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Tyler Cunnion}]
12
- s.date = %q{2011-09-18}
12
+ s.date = %q{2011-11-06}
13
13
  s.email = %q{tyler.cunnion@gmail.com}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE.txt",
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
28
28
  "lib/crunchbase/cb_object.rb",
29
29
  "lib/crunchbase/company.rb",
30
30
  "lib/crunchbase/crunch_exception.rb",
31
+ "lib/crunchbase/financial_organization.rb",
31
32
  "lib/crunchbase/investment.rb",
32
33
  "lib/crunchbase/person.rb",
33
34
  "lib/crunchbase/relationship.rb",
@@ -35,6 +36,7 @@ Gem::Specification.new do |s|
35
36
  "lib/crunchbase/relationships/person_relationship.rb",
36
37
  "spec/crunchbase/api_spec.rb",
37
38
  "spec/crunchbase/company_spec.rb",
39
+ "spec/crunchbase/financial_organization_spec.rb",
38
40
  "spec/crunchbase/person_spec.rb",
39
41
  "spec/fixtures/brad-fitzpatrick.js",
40
42
  "spec/fixtures/steve-jobs.js",
@@ -55,12 +57,14 @@ Gem::Specification.new do |s|
55
57
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
56
58
  s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
57
59
  s.add_development_dependency(%q<rcov>, [">= 0"])
60
+ s.add_development_dependency(%q<rdoc>, [">= 0"])
58
61
  else
59
62
  s.add_dependency(%q<json>, [">= 0"])
60
63
  s.add_dependency(%q<rspec>, [">= 0"])
61
64
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
62
65
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
63
66
  s.add_dependency(%q<rcov>, [">= 0"])
67
+ s.add_dependency(%q<rdoc>, [">= 0"])
64
68
  end
65
69
  else
66
70
  s.add_dependency(%q<json>, [">= 0"])
@@ -68,6 +72,7 @@ Gem::Specification.new do |s|
68
72
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
69
73
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
70
74
  s.add_dependency(%q<rcov>, [">= 0"])
75
+ s.add_dependency(%q<rdoc>, [">= 0"])
71
76
  end
72
77
  end
73
78
 
data/lib/crunchbase.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'crunchbase/api'
2
2
  require 'crunchbase/cb_object'
3
3
  require 'crunchbase/company'
4
+ require 'crunchbase/financial_organization'
4
5
  require 'crunchbase/investment'
5
6
  require 'crunchbase/person'
6
7
  require 'crunchbase/relationship'
@@ -9,5 +10,5 @@ require 'crunchbase/relationships/person_relationship'
9
10
  require 'crunchbase/crunch_exception'
10
11
 
11
12
  module Crunchbase
12
- VERSION = "0.0.1"
13
+ VERSION = "0.0.4"
13
14
  end
@@ -3,6 +3,11 @@ require 'json'
3
3
  require 'timeout'
4
4
 
5
5
  module Crunchbase
6
+
7
+ # Handles the actual calls to the Crunchbase API through a series of class
8
+ # methods, each referring to a CB entity type. Each method returns the raw
9
+ # JSON returned from the API. You should probably be using the factory
10
+ # methods provided on each entity class instead of calling these directly.
6
11
  class API
7
12
  CB_URL = 'http://api.crunchbase.com/v/1/'
8
13
 
@@ -26,6 +31,8 @@ module Crunchbase
26
31
  fetch(permalink, 'service-provider')
27
32
  end
28
33
 
34
+ private
35
+
29
36
  # Fetches URI and parses JSON. Raises Timeout::Error if fetching times out.
30
37
  # Raises CrunchException if the returned JSON indicates an error.
31
38
  def self.fetch(permalink, object_name)
@@ -50,7 +50,7 @@ module Crunchbase
50
50
  @providerships = json["providerships"]
51
51
  @total_money_raised = json["total_money_raised"]
52
52
  @funding_rounds = json["funding_rounds"]
53
- @investments = json["investments"]
53
+ @investments = Investment.array_from_investment_list(json['investments']) if json['investments']
54
54
  @acquisition = json["acquisition"]
55
55
  @acquisitions = json["acquisitions"]
56
56
  @offices = json["offices"]
@@ -61,6 +61,7 @@ module Crunchbase
61
61
  @external_links = json["external_links"]
62
62
  end
63
63
 
64
+ # Returns the date the company was founded, or nil if not provided.
64
65
  def founded
65
66
  begin
66
67
  founded = Date.new(@founded_year, @founded_month, @founded_day)
@@ -70,6 +71,7 @@ module Crunchbase
70
71
  return founded
71
72
  end
72
73
 
74
+ # Returns the date the company was deadpooled, or nil if not provided.
73
75
  def deadpooled
74
76
  begin
75
77
  dp = Date.new(@deadpooled_year, @deadpooled_month, @deadpooled_day)
@@ -0,0 +1,59 @@
1
+ require 'date'
2
+ module Crunchbase
3
+ class FinancialOrganization < CB_Object
4
+
5
+ attr_reader :name, :permalink, :crunchbase_url, :homepage_url, :blog_url,
6
+ :blog_feed_url, :twitter_username, :phone_number, :description,
7
+ :email_address, :number_of_employees, :founded_year, :founded_month,
8
+ :founded_day, :tag_list, :alias_list, :created_at, :updated_at,
9
+ :overview, :image, :offices, :relationships, :investments, :milestones,
10
+ :providerships, :funds, :video_embeds, :external_links
11
+
12
+ def self.get(permalink)
13
+ j = API.financial_organization(permalink)
14
+ f = FinancialOrganization.new(j)
15
+ return f
16
+ end
17
+
18
+ def initialize(json)
19
+ @name = json['name']
20
+ @permalink = json['permalink']
21
+ @crunchbase_url = json['crunchbase_url']
22
+ @homepage_url = json['homepage_url']
23
+ @blog_url = json['blog_url']
24
+ @blog_feed_url = json['blog_feed_url']
25
+ @twitter_username = json['twitter_username']
26
+ @phone_number = json['phone_number']
27
+ @description = json['description']
28
+ @email_address = json['email_address']
29
+ @number_of_employees = json['number_of_employees']
30
+ @founded_year = json['founded_year']
31
+ @founded_month = json['founded_month']
32
+ @founded_day = json['founded_day']
33
+ @tag_list = json['tag_list']
34
+ @alias_list = json['alias_list']
35
+ @created_at = DateTime.parse(json["created_at"])
36
+ @updated_at = DateTime.parse(json["updated_at"])
37
+ @overview = json['overview']
38
+ @image = json['image']
39
+ @offices = json['offices']
40
+ @relationships = Relationship.array_from_relationship_list(json["relationships"]) if json["relationships"]
41
+ @investments = Investment.array_from_investment_list(json['investments']) if json['investments']
42
+ @milestones = json['milestones']
43
+ @providerships = json['providerships']
44
+ @funds = json['funds']
45
+ @video_embeds = json['video_embeds']
46
+ @external_links = json['external_links']
47
+ end
48
+
49
+ # Returns the date the financial org was founded, or nil if not provided.
50
+ def founded
51
+ begin
52
+ founded = Date.new(@founded_year, @founded_month, @founded_day)
53
+ rescue
54
+ founded = nil
55
+ end
56
+ return founded
57
+ end
58
+ end
59
+ end
@@ -3,7 +3,7 @@ module Crunchbase
3
3
 
4
4
  attr_reader :firm_name, :firm_permalink, :firm_type
5
5
 
6
- def self.array_from_relationship_list
6
+ def self.array_from_relationship_list #:nodoc:
7
7
  raise CrunchException, "Method must be called from superclass Relationship"
8
8
  end
9
9
 
@@ -22,7 +22,7 @@ module Crunchbase
22
22
  when "company"
23
23
  Company.get(@firm_permalink)
24
24
  when "financial_org"
25
- raise CrunchException, "Not implemented"
25
+ FinancialOrganization.get(@firm_permalink)
26
26
  else
27
27
  raise CrunchException, "Not implemented"
28
28
  end
@@ -3,7 +3,7 @@ module Crunchbase
3
3
 
4
4
  attr_reader :person_first_name, :person_last_name, :person_permalink
5
5
 
6
- def self.array_from_relationship_list
6
+ def self.array_from_relationship_list #:nodoc:
7
7
  raise CrunchException, "Method must be called from superclass Relationship"
8
8
  end
9
9
 
@@ -0,0 +1,19 @@
1
+ require File.join(File.dirname(__FILE__), "..", "spec_helper.rb")
2
+
3
+ module Crunchbase
4
+ describe FinancialOrganization do
5
+
6
+ it "should pull from web api" do
7
+ finorg = FinancialOrganization.get("robin-hood-ventures")
8
+ finorg.name.should == "Robin Hood Ventures"
9
+ end
10
+
11
+ it "should return date for founded" do
12
+ finorg = FinancialOrganization.new({"founded_year" => 2004, "founded_month" => 2,
13
+ "founded_day" => 1, "created_at" => "Sat Dec 22 08:42:28 UTC 2007",
14
+ "updated_at" => "Sat Dec 22 08:42:28 UTC 2007"})
15
+ finorg.founded.should === Date.new(2004, 2, 1)
16
+ end
17
+
18
+ end
19
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crunchbase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-18 00:00:00.000000000Z
12
+ date: 2011-11-06 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &70340165019820 !ruby/object:Gem::Requirement
16
+ requirement: &70148116196560 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70340165019820
24
+ version_requirements: *70148116196560
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70340165403900 !ruby/object:Gem::Requirement
27
+ requirement: &70148116195260 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70340165403900
35
+ version_requirements: *70148116195260
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &70340165568620 !ruby/object:Gem::Requirement
38
+ requirement: &70148116194160 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70340165568620
46
+ version_requirements: *70148116194160
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jeweler
49
- requirement: &70340165737320 !ruby/object:Gem::Requirement
49
+ requirement: &70148116193080 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.6.4
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70340165737320
57
+ version_requirements: *70148116193080
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rcov
60
- requirement: &70340165735940 !ruby/object:Gem::Requirement
60
+ requirement: &70148116191740 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,18 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70340165735940
68
+ version_requirements: *70148116191740
69
+ - !ruby/object:Gem::Dependency
70
+ name: rdoc
71
+ requirement: &70148116190380 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *70148116190380
69
80
  description:
70
81
  email: tyler.cunnion@gmail.com
71
82
  executables: []
@@ -86,6 +97,7 @@ files:
86
97
  - lib/crunchbase/cb_object.rb
87
98
  - lib/crunchbase/company.rb
88
99
  - lib/crunchbase/crunch_exception.rb
100
+ - lib/crunchbase/financial_organization.rb
89
101
  - lib/crunchbase/investment.rb
90
102
  - lib/crunchbase/person.rb
91
103
  - lib/crunchbase/relationship.rb
@@ -93,6 +105,7 @@ files:
93
105
  - lib/crunchbase/relationships/person_relationship.rb
94
106
  - spec/crunchbase/api_spec.rb
95
107
  - spec/crunchbase/company_spec.rb
108
+ - spec/crunchbase/financial_organization_spec.rb
96
109
  - spec/crunchbase/person_spec.rb
97
110
  - spec/fixtures/brad-fitzpatrick.js
98
111
  - spec/fixtures/steve-jobs.js
@@ -112,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
125
  version: '0'
113
126
  segments:
114
127
  - 0
115
- hash: -784236536464122673
128
+ hash: 344321795598271852
116
129
  required_rubygems_version: !ruby/object:Gem::Requirement
117
130
  none: false
118
131
  requirements: