crunchbase-wrapper 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/crunchbase-wrapper.gemspec +31 -0
- data/lib/crunchbase/acquisition.rb +31 -0
- data/lib/crunchbase/category.rb +34 -0
- data/lib/crunchbase/fund_raise.rb +31 -0
- data/lib/crunchbase/funding_round.rb +31 -0
- data/lib/crunchbase/i_p_o.rb +31 -0
- data/lib/crunchbase/location.rb +34 -0
- data/lib/crunchbase/organization.rb +54 -0
- data/lib/crunchbase/person.rb +53 -0
- data/lib/crunchbase/product.rb +53 -0
- data/lib/crunchbase/version.rb +3 -0
- data/lib/crunchbase.rb +27 -0
- data/test/fixtures/organizations_1.yml +4723 -0
- data/test/fixtures/twitch.yml +563 -0
- data/test/organization/organization_test.rb +51 -0
- data/test/test_helper.rb +10 -0
- metadata +182 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7223ea0e45004b00f80958bddafdcc20e820d73a
|
4
|
+
data.tar.gz: 4b2e73336ebf9019358165e647df18a55de71368
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e8657ca34936765004e666a061131c44ef38fb940e6f42736f74993b6f1b4540951a9876ad586a4f6bf70c8c2310fb0f7b7bb814409978bd6123a56ea29d5e94
|
7
|
+
data.tar.gz: d65f66ac3c969a56bf03eb969d2a90a79e937a4280dfdddda5a28534023de86ee7b7a3d5c252e3777cf5ce140545a8690096e4d284dce7624937ac84f8fe5190
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Fábio Batista
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Crunchbase::Wrapper
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'crunchbase-wrapper'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install crunchbase-wrapper
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'crunchbase/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "crunchbase-wrapper"
|
8
|
+
spec.version = Crunchbase::VERSION
|
9
|
+
spec.authors = ["Fábio Batista"]
|
10
|
+
spec.email = ["fbatista@gmail.com"]
|
11
|
+
spec.description = %q{A Ruby Wrapper for the Crunchbase v2 REST API}
|
12
|
+
spec.summary = %q{A Ruby Wrapper for the Crunchbase v2 REST API}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
|
24
|
+
spec.add_development_dependency "minitest"
|
25
|
+
spec.add_development_dependency "vcr"
|
26
|
+
spec.add_development_dependency "webmock"
|
27
|
+
|
28
|
+
spec.add_dependency "faraday"
|
29
|
+
spec.add_dependency "json"
|
30
|
+
spec.add_dependency "hashie"
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'json'
|
3
|
+
require 'hashie'
|
4
|
+
|
5
|
+
module Crunchbase
|
6
|
+
class Acquisition
|
7
|
+
|
8
|
+
attr_accessor :metadata
|
9
|
+
|
10
|
+
def initialize(data, meta)
|
11
|
+
@mash = data
|
12
|
+
self.metadata = meta
|
13
|
+
end
|
14
|
+
|
15
|
+
def method_missing(method_sym, *arguments, &block)
|
16
|
+
@mash.send(method_sym, *arguments)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.find(uuid)
|
20
|
+
response = Faraday.get("#{Crunchbase.config.host}/#{Crunchbase.config.api_version_prefix}/acquisition/#{uuid}", user_key: Crunchbase.config.user_key)
|
21
|
+
|
22
|
+
raise "Error" if response.status != 200
|
23
|
+
|
24
|
+
raw = Hashie::Mash.new(JSON.parse(response.body))
|
25
|
+
new(raw.data, raw.metadata)
|
26
|
+
rescue
|
27
|
+
nil
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'json'
|
3
|
+
require 'hashie'
|
4
|
+
|
5
|
+
module Crunchbase
|
6
|
+
class Category
|
7
|
+
|
8
|
+
attr_accessor :metadata
|
9
|
+
|
10
|
+
def initialize(data, meta)
|
11
|
+
@mash = data
|
12
|
+
self.metadata = meta
|
13
|
+
end
|
14
|
+
|
15
|
+
def method_missing(method_sym, *arguments, &block)
|
16
|
+
@mash.send(method_sym, *arguments)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.all(options = {})
|
20
|
+
opts = options.merge({user_key: Crunchbase.config.user_key})
|
21
|
+
response = Faraday.get("#{Crunchbase.config.host}/#{Crunchbase.config.api_version_prefix}/categories", opts)
|
22
|
+
|
23
|
+
raise "Error" if response.status != 200
|
24
|
+
|
25
|
+
# ignore paging
|
26
|
+
raw = Hashie::Mash.new(JSON.parse(response.body))
|
27
|
+
collection = raw.data.items
|
28
|
+
collection.map { |item| new(item, raw.metadata) }
|
29
|
+
rescue
|
30
|
+
[]
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'json'
|
3
|
+
require 'hashie'
|
4
|
+
|
5
|
+
module Crunchbase
|
6
|
+
class FundRaise
|
7
|
+
|
8
|
+
attr_accessor :metadata
|
9
|
+
|
10
|
+
def initialize(data, meta)
|
11
|
+
@mash = data
|
12
|
+
self.metadata = meta
|
13
|
+
end
|
14
|
+
|
15
|
+
def method_missing(method_sym, *arguments, &block)
|
16
|
+
@mash.send(method_sym, *arguments)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.find(uuid)
|
20
|
+
response = Faraday.get("#{Crunchbase.config.host}/#{Crunchbase.config.api_version_prefix}/fund-raise/#{uuid}", user_key: Crunchbase.config.user_key)
|
21
|
+
|
22
|
+
raise "Error" if response.status != 200
|
23
|
+
|
24
|
+
raw = Hashie::Mash.new(JSON.parse(response.body))
|
25
|
+
new(raw.data, raw.metadata)
|
26
|
+
rescue
|
27
|
+
nil
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'json'
|
3
|
+
require 'hashie'
|
4
|
+
|
5
|
+
module Crunchbase
|
6
|
+
class FundingRound
|
7
|
+
|
8
|
+
attr_accessor :metadata
|
9
|
+
|
10
|
+
def initialize(data, meta)
|
11
|
+
@mash = data
|
12
|
+
self.metadata = meta
|
13
|
+
end
|
14
|
+
|
15
|
+
def method_missing(method_sym, *arguments, &block)
|
16
|
+
@mash.send(method_sym, *arguments)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.find(uuid)
|
20
|
+
response = Faraday.get("#{Crunchbase.config.host}/#{Crunchbase.config.api_version_prefix}/funding-round/#{uuid}", user_key: Crunchbase.config.user_key)
|
21
|
+
|
22
|
+
raise "Error" if response.status != 200
|
23
|
+
|
24
|
+
raw = Hashie::Mash.new(JSON.parse(response.body))
|
25
|
+
new(raw.data, raw.metadata)
|
26
|
+
rescue
|
27
|
+
nil
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'json'
|
3
|
+
require 'hashie'
|
4
|
+
|
5
|
+
module Crunchbase
|
6
|
+
class IPO
|
7
|
+
|
8
|
+
attr_accessor :metadata
|
9
|
+
|
10
|
+
def initialize(data, meta)
|
11
|
+
@mash = data
|
12
|
+
self.metadata = meta
|
13
|
+
end
|
14
|
+
|
15
|
+
def method_missing(method_sym, *arguments, &block)
|
16
|
+
@mash.send(method_sym, *arguments)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.find(uuid)
|
20
|
+
response = Faraday.get("#{Crunchbase.config.host}/#{Crunchbase.config.api_version_prefix}/ipo/#{uuid}", user_key: Crunchbase.config.user_key)
|
21
|
+
|
22
|
+
raise "Error" if response.status != 200
|
23
|
+
|
24
|
+
raw = Hashie::Mash.new(JSON.parse(response.body))
|
25
|
+
new(raw.data, raw.metadata)
|
26
|
+
rescue
|
27
|
+
nil
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'json'
|
3
|
+
require 'hashie'
|
4
|
+
|
5
|
+
module Crunchbase
|
6
|
+
class Location
|
7
|
+
|
8
|
+
attr_accessor :metadata
|
9
|
+
|
10
|
+
def initialize(data, meta)
|
11
|
+
@mash = data
|
12
|
+
self.metadata = meta
|
13
|
+
end
|
14
|
+
|
15
|
+
def method_missing(method_sym, *arguments, &block)
|
16
|
+
@mash.send(method_sym, *arguments)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.all(options = {})
|
20
|
+
opts = options.merge({user_key: Crunchbase.config.user_key})
|
21
|
+
response = Faraday.get("#{Crunchbase.config.host}/#{Crunchbase.config.api_version_prefix}/locations", opts)
|
22
|
+
|
23
|
+
raise "Error" if response.status != 200
|
24
|
+
|
25
|
+
# ignore paging
|
26
|
+
raw = Hashie::Mash.new(JSON.parse(response.body))
|
27
|
+
collection = raw.data.items
|
28
|
+
collection.map { |item| new(item, raw.metadata) }
|
29
|
+
rescue
|
30
|
+
[]
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'json'
|
3
|
+
require 'hashie'
|
4
|
+
|
5
|
+
module Crunchbase
|
6
|
+
class Organization
|
7
|
+
|
8
|
+
attr_accessor :metadata
|
9
|
+
|
10
|
+
def initialize(data, meta)
|
11
|
+
@mash = data
|
12
|
+
self.metadata = meta
|
13
|
+
end
|
14
|
+
|
15
|
+
def method_missing(method_sym, *arguments, &block)
|
16
|
+
@mash.send(method_sym, *arguments)
|
17
|
+
end
|
18
|
+
|
19
|
+
def load_details
|
20
|
+
if properties
|
21
|
+
return self
|
22
|
+
else
|
23
|
+
Organization.find(path.sub("organization/", ''))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.all(options = {})
|
28
|
+
opts = options.merge({user_key: Crunchbase.config.user_key})
|
29
|
+
response = Faraday.get("#{Crunchbase.config.host}/#{Crunchbase.config.api_version_prefix}/organizations", opts)
|
30
|
+
|
31
|
+
raise "Error" if response.status != 200
|
32
|
+
|
33
|
+
# ignore paging
|
34
|
+
raw = Hashie::Mash.new(JSON.parse(response.body))
|
35
|
+
collection = raw.data.items
|
36
|
+
collection.map { |item| new(item, raw.metadata) }
|
37
|
+
rescue => e
|
38
|
+
[]
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.find(permalink)
|
42
|
+
response = Faraday.get("#{Crunchbase.config.host}/#{Crunchbase.config.api_version_prefix}/organization/#{permalink}", user_key: Crunchbase.config.user_key)
|
43
|
+
|
44
|
+
raise "Error" if response.status != 200
|
45
|
+
|
46
|
+
raw = Hashie::Mash.new(JSON.parse(response.body))
|
47
|
+
|
48
|
+
new(raw.data, raw.metadata)
|
49
|
+
rescue
|
50
|
+
nil
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'json'
|
3
|
+
require 'hashie'
|
4
|
+
|
5
|
+
module Crunchbase
|
6
|
+
class Person
|
7
|
+
|
8
|
+
attr_accessor :metadata
|
9
|
+
|
10
|
+
def initialize(data, meta)
|
11
|
+
@mash = data
|
12
|
+
self.metadata = meta
|
13
|
+
end
|
14
|
+
|
15
|
+
def method_missing(method_sym, *arguments, &block)
|
16
|
+
@mash.send(method_sym, *arguments)
|
17
|
+
end
|
18
|
+
|
19
|
+
def load_details
|
20
|
+
if properties
|
21
|
+
return self
|
22
|
+
else
|
23
|
+
Person.find(path.sub("person/", ''))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.all(options = {})
|
28
|
+
opts = options.merge({user_key: Crunchbase.config.user_key})
|
29
|
+
response = Faraday.get("#{Crunchbase.config.host}/#{Crunchbase.config.api_version_prefix}/people", opts)
|
30
|
+
|
31
|
+
raise "Error" if response.status != 200
|
32
|
+
|
33
|
+
# ignore paging
|
34
|
+
raw = Hashie::Mash.new(JSON.parse(response.body))
|
35
|
+
collection = raw.data.items
|
36
|
+
collection.map { |item| new(item, raw.metadata) }
|
37
|
+
rescue
|
38
|
+
[]
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.find(permalink)
|
42
|
+
response = Faraday.get("#{Crunchbase.config.host}/#{Crunchbase.config.api_version_prefix}/person/#{permalink}", user_key: Crunchbase.config.user_key)
|
43
|
+
|
44
|
+
raise "Error" if response.status != 200
|
45
|
+
|
46
|
+
raw = Hashie::Mash.new(JSON.parse(response.body))
|
47
|
+
new(raw.data, raw.metadata)
|
48
|
+
rescue
|
49
|
+
nil
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'json'
|
3
|
+
require 'hashie'
|
4
|
+
|
5
|
+
module Crunchbase
|
6
|
+
class Product
|
7
|
+
|
8
|
+
attr_accessor :metadata
|
9
|
+
|
10
|
+
def initialize(data, meta)
|
11
|
+
@mash = data
|
12
|
+
self.metadata = meta
|
13
|
+
end
|
14
|
+
|
15
|
+
def method_missing(method_sym, *arguments, &block)
|
16
|
+
@mash.send(method_sym, *arguments)
|
17
|
+
end
|
18
|
+
|
19
|
+
def load_details
|
20
|
+
if properties
|
21
|
+
return self
|
22
|
+
else
|
23
|
+
Product.find(path.sub("product/", ''))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.all(options = {})
|
28
|
+
opts = options.merge({user_key: Crunchbase.config.user_key})
|
29
|
+
response = Faraday.get("#{Crunchbase.config.host}/#{Crunchbase.config.api_version_prefix}/products", opts)
|
30
|
+
|
31
|
+
raise "Error" if response.status != 200
|
32
|
+
|
33
|
+
# ignore paging
|
34
|
+
raw = Hashie::Mash.new(JSON.parse(response.body))
|
35
|
+
collection = raw.data.items
|
36
|
+
collection.map { |item| new(item, raw.metadata) }
|
37
|
+
rescue
|
38
|
+
[]
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.find(permalink)
|
42
|
+
response = Faraday.get("#{Crunchbase.config.host}/#{Crunchbase.config.api_version_prefix}/product/#{permalink}", user_key: Crunchbase.config.user_key)
|
43
|
+
|
44
|
+
raise "Error" if response.status != 200
|
45
|
+
|
46
|
+
raw = Hashie::Mash.new(JSON.parse(response.body))
|
47
|
+
new(raw.data, raw.metadata)
|
48
|
+
rescue
|
49
|
+
nil
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
data/lib/crunchbase.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'hashie'
|
2
|
+
require 'faraday'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
require_relative "crunchbase/version"
|
6
|
+
require_relative "crunchbase/product"
|
7
|
+
require_relative "crunchbase/person"
|
8
|
+
require_relative "crunchbase/organization"
|
9
|
+
require_relative "crunchbase/location"
|
10
|
+
require_relative "crunchbase/i_p_o"
|
11
|
+
require_relative "crunchbase/funding_round"
|
12
|
+
require_relative "crunchbase/fund_raise"
|
13
|
+
require_relative "crunchbase/category"
|
14
|
+
require_relative "crunchbase/acquisition"
|
15
|
+
|
16
|
+
module Crunchbase
|
17
|
+
CONFIG = Hashie::Mash.new({
|
18
|
+
host: "http://api.crunchbase.com",
|
19
|
+
api_version_prefix: "v/2",
|
20
|
+
user_key: nil
|
21
|
+
})
|
22
|
+
|
23
|
+
def self.config
|
24
|
+
CONFIG
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|