crunchbase 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.rdoc +6 -1
- data/lib/crunchbase.rb +4 -1
- data/lib/crunchbase/api.rb +7 -0
- data/lib/crunchbase/array_from_list.rb +9 -0
- data/lib/crunchbase/cb_object.rb +7 -3
- data/lib/crunchbase/company.rb +35 -9
- data/lib/crunchbase/financial_organization.rb +27 -7
- data/lib/crunchbase/image.rb +36 -0
- data/lib/crunchbase/investment.rb +7 -5
- data/lib/crunchbase/milestone.rb +33 -0
- data/lib/crunchbase/person.rb +22 -6
- data/lib/crunchbase/product.rb +17 -4
- data/lib/crunchbase/relationship.rb +2 -2
- data/lib/crunchbase/search.rb +17 -0
- data/lib/crunchbase/service_provider.rb +6 -3
- metadata +14 -114
- data/Gemfile +0 -9
- data/Gemfile.lock +0 -30
- data/Rakefile +0 -52
- data/VERSION +0 -1
- data/crunchbase.gemspec +0 -88
- data/spec/apikey.example.yml +0 -1
- data/spec/crunchbase/api_spec.rb +0 -50
- data/spec/crunchbase/company_spec.rb +0 -37
- data/spec/crunchbase/financial_organization_spec.rb +0 -29
- data/spec/crunchbase/person_spec.rb +0 -82
- data/spec/crunchbase/product_spec.rb +0 -35
- data/spec/crunchbase/search_result_spec.rb +0 -16
- data/spec/crunchbase/search_spec.rb +0 -65
- data/spec/crunchbase/service_provider_spec.rb +0 -22
- data/spec/fixtures/brad-fitzpatrick.js +0 -70
- data/spec/fixtures/cargurus.js +0 -178
- data/spec/fixtures/steve-jobs.js +0 -83
- data/spec/spec_helper.rb +0 -9
data/lib/crunchbase/search.rb
CHANGED
@@ -104,4 +104,21 @@ module Crunchbase
|
|
104
104
|
end
|
105
105
|
|
106
106
|
end
|
107
|
+
|
108
|
+
class Location < Search
|
109
|
+
|
110
|
+
# Performs a Crunchbase geo-location search for query.
|
111
|
+
def self.geo(query)
|
112
|
+
j = API.geo(query)
|
113
|
+
s = Location.new(query, j)
|
114
|
+
end
|
115
|
+
|
116
|
+
# Retrieves the search page containing the given index
|
117
|
+
def retrieve_for_index(index)
|
118
|
+
page = (index / 10) + 1
|
119
|
+
populate_results(API.geo(@query, page))
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
|
107
124
|
end
|
@@ -7,7 +7,7 @@ module Crunchbase
|
|
7
7
|
|
8
8
|
attr_reader :name, :permalink, :crunchbase_url, :homepage_url,
|
9
9
|
:phone_number, :created_at, :updated_at, :overview, :image, :offices,
|
10
|
-
:
|
10
|
+
:external_links
|
11
11
|
|
12
12
|
def initialize(json)
|
13
13
|
@name = json["name"]
|
@@ -20,12 +20,15 @@ module Crunchbase
|
|
20
20
|
@created_at = DateTime.parse(json["created_at"])
|
21
21
|
@updated_at = DateTime.parse(json["updated_at"])
|
22
22
|
@overview = json["overview"]
|
23
|
-
@image = json["image"]
|
23
|
+
@image = Image.create(json["image"])
|
24
24
|
@offices = json["offices"]
|
25
|
-
@
|
25
|
+
@providerships_list = json["providerships"]
|
26
26
|
@external_links = json["external_links"]
|
27
27
|
end
|
28
28
|
|
29
|
+
def providerships
|
30
|
+
@providerships ||= Relationship.array_from_list(@providerships_list)
|
31
|
+
end
|
29
32
|
|
30
33
|
end
|
31
34
|
end
|
metadata
CHANGED
@@ -1,96 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crunchbase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.4.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Tyler Cunnion
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: rspec
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :development
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: bundler
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ~>
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: 1.0.0
|
38
|
-
type: :development
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 1.0.0
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: jeweler
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ~>
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 1.6.4
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 1.6.4
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: rcov
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
|
-
requirements:
|
67
|
-
- - ! '>='
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
70
|
-
type: :development
|
71
|
-
prerelease: false
|
72
|
-
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ! '>='
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '0'
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: rdoc
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ! '>='
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: '0'
|
86
|
-
type: :development
|
87
|
-
prerelease: false
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ! '>='
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '0'
|
11
|
+
date: 2013-11-30 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
94
13
|
description:
|
95
14
|
email: tyler.cunnion@gmail.com
|
96
15
|
executables: []
|
@@ -99,22 +18,17 @@ extra_rdoc_files:
|
|
99
18
|
- LICENSE.txt
|
100
19
|
- README.rdoc
|
101
20
|
files:
|
102
|
-
- Gemfile
|
103
|
-
- Gemfile.lock
|
104
|
-
- LICENSE.txt
|
105
|
-
- README.rdoc
|
106
|
-
- Rakefile
|
107
|
-
- VERSION
|
108
|
-
- crunchbase.gemspec
|
109
|
-
- lib/crunchbase.rb
|
110
21
|
- lib/crunchbase/api.rb
|
22
|
+
- lib/crunchbase/array_from_list.rb
|
111
23
|
- lib/crunchbase/cb_object.rb
|
112
24
|
- lib/crunchbase/company.rb
|
113
25
|
- lib/crunchbase/crunch_exception.rb
|
114
26
|
- lib/crunchbase/date_methods.rb
|
115
27
|
- lib/crunchbase/entity_list_item.rb
|
116
28
|
- lib/crunchbase/financial_organization.rb
|
29
|
+
- lib/crunchbase/image.rb
|
117
30
|
- lib/crunchbase/investment.rb
|
31
|
+
- lib/crunchbase/milestone.rb
|
118
32
|
- lib/crunchbase/person.rb
|
119
33
|
- lib/crunchbase/product.rb
|
120
34
|
- lib/crunchbase/relationship.rb
|
@@ -124,45 +38,31 @@ files:
|
|
124
38
|
- lib/crunchbase/search.rb
|
125
39
|
- lib/crunchbase/search_result.rb
|
126
40
|
- lib/crunchbase/service_provider.rb
|
127
|
-
-
|
128
|
-
-
|
129
|
-
-
|
130
|
-
- spec/crunchbase/financial_organization_spec.rb
|
131
|
-
- spec/crunchbase/person_spec.rb
|
132
|
-
- spec/crunchbase/product_spec.rb
|
133
|
-
- spec/crunchbase/search_result_spec.rb
|
134
|
-
- spec/crunchbase/search_spec.rb
|
135
|
-
- spec/crunchbase/service_provider_spec.rb
|
136
|
-
- spec/fixtures/brad-fitzpatrick.js
|
137
|
-
- spec/fixtures/cargurus.js
|
138
|
-
- spec/fixtures/steve-jobs.js
|
139
|
-
- spec/spec_helper.rb
|
41
|
+
- lib/crunchbase.rb
|
42
|
+
- LICENSE.txt
|
43
|
+
- README.rdoc
|
140
44
|
homepage: http://github.com/tylercunnion/crunchbase
|
141
45
|
licenses:
|
142
46
|
- MIT
|
47
|
+
metadata: {}
|
143
48
|
post_install_message:
|
144
49
|
rdoc_options: []
|
145
50
|
require_paths:
|
146
51
|
- lib
|
147
52
|
required_ruby_version: !ruby/object:Gem::Requirement
|
148
|
-
none: false
|
149
53
|
requirements:
|
150
|
-
- -
|
54
|
+
- - '>='
|
151
55
|
- !ruby/object:Gem::Version
|
152
56
|
version: '0'
|
153
|
-
segments:
|
154
|
-
- 0
|
155
|
-
hash: 1391900359395549373
|
156
57
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
|
-
none: false
|
158
58
|
requirements:
|
159
|
-
- -
|
59
|
+
- - '>='
|
160
60
|
- !ruby/object:Gem::Version
|
161
61
|
version: '0'
|
162
62
|
requirements: []
|
163
63
|
rubyforge_project:
|
164
|
-
rubygems_version:
|
64
|
+
rubygems_version: 2.0.14
|
165
65
|
signing_key:
|
166
|
-
specification_version:
|
66
|
+
specification_version: 4
|
167
67
|
summary: Ruby wrapper for CrunchBase API
|
168
68
|
test_files: []
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
diff-lcs (1.1.3)
|
5
|
-
git (1.2.5)
|
6
|
-
jeweler (1.6.4)
|
7
|
-
bundler (~> 1.0)
|
8
|
-
git (>= 1.2.5)
|
9
|
-
rake
|
10
|
-
rake (0.9.2)
|
11
|
-
rcov (0.9.10)
|
12
|
-
rdoc (3.9.4)
|
13
|
-
rspec (2.6.0)
|
14
|
-
rspec-core (~> 2.6.0)
|
15
|
-
rspec-expectations (~> 2.6.0)
|
16
|
-
rspec-mocks (~> 2.6.0)
|
17
|
-
rspec-core (2.6.4)
|
18
|
-
rspec-expectations (2.6.0)
|
19
|
-
diff-lcs (~> 1.1.2)
|
20
|
-
rspec-mocks (2.6.0)
|
21
|
-
|
22
|
-
PLATFORMS
|
23
|
-
ruby
|
24
|
-
|
25
|
-
DEPENDENCIES
|
26
|
-
bundler (~> 1.0.0)
|
27
|
-
jeweler (~> 1.6.4)
|
28
|
-
rcov
|
29
|
-
rdoc
|
30
|
-
rspec
|
data/Rakefile
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'bundler'
|
5
|
-
begin
|
6
|
-
Bundler.setup(:default, :development)
|
7
|
-
rescue Bundler::BundlerError => e
|
8
|
-
$stderr.puts e.message
|
9
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
-
exit e.status_code
|
11
|
-
end
|
12
|
-
require 'rake'
|
13
|
-
|
14
|
-
require 'jeweler'
|
15
|
-
Jeweler::Tasks.new do |gem|
|
16
|
-
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
-
gem.name = "crunchbase"
|
18
|
-
gem.homepage = "http://github.com/tylercunnion/crunchbase"
|
19
|
-
gem.license = "MIT"
|
20
|
-
gem.summary = %Q{Ruby wrapper for CrunchBase API}
|
21
|
-
gem.email = "tyler.cunnion@gmail.com"
|
22
|
-
gem.authors = ["Tyler Cunnion"]
|
23
|
-
# dependencies defined in Gemfile
|
24
|
-
end
|
25
|
-
Jeweler::RubygemsDotOrgTasks.new
|
26
|
-
|
27
|
-
require 'rake/testtask'
|
28
|
-
Rake::TestTask.new(:test) do |test|
|
29
|
-
test.libs << 'lib' << 'test'
|
30
|
-
test.pattern = 'test/**/test_*.rb'
|
31
|
-
test.verbose = true
|
32
|
-
end
|
33
|
-
|
34
|
-
require 'rcov/rcovtask'
|
35
|
-
Rcov::RcovTask.new do |test|
|
36
|
-
test.libs << 'test'
|
37
|
-
test.pattern = 'test/**/test_*.rb'
|
38
|
-
test.verbose = true
|
39
|
-
test.rcov_opts << '--exclude "gems/*"'
|
40
|
-
end
|
41
|
-
|
42
|
-
task :default => :test
|
43
|
-
|
44
|
-
require 'rake/rdoctask'
|
45
|
-
Rake::RDocTask.new do |rdoc|
|
46
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
47
|
-
|
48
|
-
rdoc.rdoc_dir = 'rdoc'
|
49
|
-
rdoc.title = "crunchbase #{version}"
|
50
|
-
rdoc.rdoc_files.include('README*')
|
51
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
52
|
-
end
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.3.0
|
data/crunchbase.gemspec
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = "crunchbase"
|
8
|
-
s.version = "0.3.0"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Tyler Cunnion"]
|
12
|
-
s.date = "2012-10-26"
|
13
|
-
s.email = "tyler.cunnion@gmail.com"
|
14
|
-
s.extra_rdoc_files = [
|
15
|
-
"LICENSE.txt",
|
16
|
-
"README.rdoc"
|
17
|
-
]
|
18
|
-
s.files = [
|
19
|
-
"Gemfile",
|
20
|
-
"Gemfile.lock",
|
21
|
-
"LICENSE.txt",
|
22
|
-
"README.rdoc",
|
23
|
-
"Rakefile",
|
24
|
-
"VERSION",
|
25
|
-
"crunchbase.gemspec",
|
26
|
-
"lib/crunchbase.rb",
|
27
|
-
"lib/crunchbase/api.rb",
|
28
|
-
"lib/crunchbase/cb_object.rb",
|
29
|
-
"lib/crunchbase/company.rb",
|
30
|
-
"lib/crunchbase/crunch_exception.rb",
|
31
|
-
"lib/crunchbase/date_methods.rb",
|
32
|
-
"lib/crunchbase/entity_list_item.rb",
|
33
|
-
"lib/crunchbase/financial_organization.rb",
|
34
|
-
"lib/crunchbase/investment.rb",
|
35
|
-
"lib/crunchbase/person.rb",
|
36
|
-
"lib/crunchbase/product.rb",
|
37
|
-
"lib/crunchbase/relationship.rb",
|
38
|
-
"lib/crunchbase/relationships/firm_relationship.rb",
|
39
|
-
"lib/crunchbase/relationships/person_relationship.rb",
|
40
|
-
"lib/crunchbase/relationships/provider_relationship.rb",
|
41
|
-
"lib/crunchbase/search.rb",
|
42
|
-
"lib/crunchbase/search_result.rb",
|
43
|
-
"lib/crunchbase/service_provider.rb",
|
44
|
-
"spec/apikey.example.yml",
|
45
|
-
"spec/crunchbase/api_spec.rb",
|
46
|
-
"spec/crunchbase/company_spec.rb",
|
47
|
-
"spec/crunchbase/financial_organization_spec.rb",
|
48
|
-
"spec/crunchbase/person_spec.rb",
|
49
|
-
"spec/crunchbase/product_spec.rb",
|
50
|
-
"spec/crunchbase/search_result_spec.rb",
|
51
|
-
"spec/crunchbase/search_spec.rb",
|
52
|
-
"spec/crunchbase/service_provider_spec.rb",
|
53
|
-
"spec/fixtures/brad-fitzpatrick.js",
|
54
|
-
"spec/fixtures/cargurus.js",
|
55
|
-
"spec/fixtures/steve-jobs.js",
|
56
|
-
"spec/spec_helper.rb"
|
57
|
-
]
|
58
|
-
s.homepage = "http://github.com/tylercunnion/crunchbase"
|
59
|
-
s.licenses = ["MIT"]
|
60
|
-
s.require_paths = ["lib"]
|
61
|
-
s.rubygems_version = "1.8.23"
|
62
|
-
s.summary = "Ruby wrapper for CrunchBase API"
|
63
|
-
|
64
|
-
if s.respond_to? :specification_version then
|
65
|
-
s.specification_version = 3
|
66
|
-
|
67
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
68
|
-
s.add_development_dependency(%q<rspec>, [">= 0"])
|
69
|
-
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
70
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
71
|
-
s.add_development_dependency(%q<rcov>, [">= 0"])
|
72
|
-
s.add_development_dependency(%q<rdoc>, [">= 0"])
|
73
|
-
else
|
74
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
75
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
76
|
-
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
77
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
78
|
-
s.add_dependency(%q<rdoc>, [">= 0"])
|
79
|
-
end
|
80
|
-
else
|
81
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
82
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
83
|
-
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
84
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
85
|
-
s.add_dependency(%q<rdoc>, [">= 0"])
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
data/spec/apikey.example.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
key: <your_key_goes_here>
|
data/spec/crunchbase/api_spec.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "..", "spec_helper.rb")
|
2
|
-
require 'net/http'
|
3
|
-
|
4
|
-
module Crunchbase
|
5
|
-
describe API do
|
6
|
-
|
7
|
-
it "should raise exception for missing API key" do
|
8
|
-
key = API.key
|
9
|
-
API.key = nil
|
10
|
-
expect { API.fetch('steve-jobs', 'person') }.to raise_error
|
11
|
-
API.key = key
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should remove control characters" do
|
15
|
-
cargurus = File.open(File.join(File.dirname(__FILE__), "..", "fixtures", "cargurus.js")).read
|
16
|
-
API.should_receive(:get_url_following_redirects).with(/^http:\/\/api.crunchbase.com\/v\/1\/company\/cargurus.js/, 2).and_return(cargurus)
|
17
|
-
lambda { API.single_entity("cargurus", "company") }.should_not raise_error
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should return a JSON hash" do
|
21
|
-
j = API.fetch('steve-jobs', 'person')
|
22
|
-
j.class.should == Hash
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should return JSON from person permalink" do
|
26
|
-
j = API.single_entity("steve-jobs", "person")
|
27
|
-
j.class.should == Hash
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should raise exception on unfound person" do
|
31
|
-
expect { API.single_entity("not-real", "person") }.to raise_error, "Sorry, we could not find the record you were looking for."
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should raise exception for incorrect entity name" do
|
35
|
-
expect { API.single_entity("whatever", "wrong") }.to raise_error, "Unsupported Entity Type"
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should follow redirects" do
|
39
|
-
c = Company.get("adobe")
|
40
|
-
c.name.should == "Adobe Systems"
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should find a permalink from a well-formed search" do
|
44
|
-
j = API.permalink({name: "Accel Partners"}, "financial-organizations")
|
45
|
-
j.class.should == Hash
|
46
|
-
j["permalink"].should == 'accel-partners'
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
end
|