crunchbase-ruby-library 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +24 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +102 -0
- data/Rakefile +2 -0
- data/crunchbase-ruby-library.gemspec +25 -0
- data/lib/crunchbase.rb +12 -0
- data/lib/crunchbase/api.rb +160 -0
- data/lib/crunchbase/exception.rb +18 -0
- data/lib/crunchbase/model.rb +49 -0
- data/lib/crunchbase/model/acquired_by.rb +7 -0
- data/lib/crunchbase/model/acquisition.rb +36 -0
- data/lib/crunchbase/model/address.rb +20 -0
- data/lib/crunchbase/model/advisory_role.rb +10 -0
- data/lib/crunchbase/model/board_members_and_advisor.rb +25 -0
- data/lib/crunchbase/model/category.rb +17 -0
- data/lib/crunchbase/model/competitor.rb +7 -0
- data/lib/crunchbase/model/current_team.rb +25 -0
- data/lib/crunchbase/model/customer.rb +7 -0
- data/lib/crunchbase/model/degree.rb +31 -0
- data/lib/crunchbase/model/entity.rb +134 -0
- data/lib/crunchbase/model/error.rb +14 -0
- data/lib/crunchbase/model/founded_company.rb +27 -0
- data/lib/crunchbase/model/founder.rb +9 -0
- data/lib/crunchbase/model/fund.rb +26 -0
- data/lib/crunchbase/model/funding_round.rb +58 -0
- data/lib/crunchbase/model/headquarter.rb +6 -0
- data/lib/crunchbase/model/image.rb +17 -0
- data/lib/crunchbase/model/investment.rb +27 -0
- data/lib/crunchbase/model/investor.rb +28 -0
- data/lib/crunchbase/model/ipo.rb +35 -0
- data/lib/crunchbase/model/job.rb +39 -0
- data/lib/crunchbase/model/location.rb +29 -0
- data/lib/crunchbase/model/member.rb +7 -0
- data/lib/crunchbase/model/membership.rb +28 -0
- data/lib/crunchbase/model/new.rb +21 -0
- data/lib/crunchbase/model/office.rb +9 -0
- data/lib/crunchbase/model/organization.rb +88 -0
- data/lib/crunchbase/model/organization_summary.rb +19 -0
- data/lib/crunchbase/model/owned_by.rb +27 -0
- data/lib/crunchbase/model/parent_location.rb +7 -0
- data/lib/crunchbase/model/past_team.rb +25 -0
- data/lib/crunchbase/model/person.rb +55 -0
- data/lib/crunchbase/model/person_summary.rb +23 -0
- data/lib/crunchbase/model/primary_affiliation.rb +22 -0
- data/lib/crunchbase/model/primary_image.rb +7 -0
- data/lib/crunchbase/model/primary_location.rb +17 -0
- data/lib/crunchbase/model/product.rb +47 -0
- data/lib/crunchbase/model/school.rb +6 -0
- data/lib/crunchbase/model/search.rb +50 -0
- data/lib/crunchbase/model/search_result.rb +10 -0
- data/lib/crunchbase/model/sub_organization.rb +9 -0
- data/lib/crunchbase/model/video.rb +17 -0
- data/lib/crunchbase/model/website.rb +17 -0
- data/lib/crunchbase/version.rb +3 -0
- data/spec/crunchbase.yml.example +2 -0
- data/spec/crunchbase/model/board_members_and_advisor_spec.rb +20 -0
- data/spec/crunchbase/model/office_spec.rb +17 -0
- data/spec/crunchbase/model/organization_spec.rb +60 -0
- data/spec/crunchbase/model/past_team_spec.rb +26 -0
- data/spec/crunchbase/model/person_spec.rb +28 -0
- data/spec/crunchbase/model/product_spec.rb +33 -0
- data/spec/crunchbase/model/search_spec.rb +50 -0
- data/spec/crunchbase/model/website_spec.rb +18 -0
- data/spec/spec_helper.rb +20 -0
- metadata +192 -0
data/.gitignore
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
23
|
+
|
24
|
+
spec/crunchbase.yml
|
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Encore Shao
|
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,102 @@
|
|
1
|
+
# Crunchbase
|
2
|
+
|
3
|
+
Crunchbase API Version 3 - Ruby Library [CrunchBase Data Hub](http://data.crunchbase.com/v3).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'crunchbase-ruby-library'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install crunchbase-ruby-library
|
18
|
+
|
19
|
+
## Usage Examples
|
20
|
+
|
21
|
+
Config your user_key, debug somewhere like development.rb, Recommended directory config/initializers/crunchbase.rb
|
22
|
+
|
23
|
+
require 'crunchbase'
|
24
|
+
|
25
|
+
Crunchbase::API.key = 'user_key'
|
26
|
+
Crunchbase::API.debug = false
|
27
|
+
|
28
|
+
## Search Organization OR Person
|
29
|
+
|
30
|
+
Retrieve the way, Please use Search Class. The Search Will Return a list consisting of objects of the OrganizationSummary | PersonSummary type. Example:
|
31
|
+
|
32
|
+
Query Orgnization
|
33
|
+
|
34
|
+
Method 1
|
35
|
+
response = Crunchbase::Model::Search.search({query: "Google"}, 'organizations')
|
36
|
+
|
37
|
+
Method 2
|
38
|
+
response = Crunchbase::Model::Search.search({name: "Google"}, 'organizations')
|
39
|
+
|
40
|
+
Method 3
|
41
|
+
response = Crunchbase::Model::Search.search({domain_name: "google.com"}, 'organizations')
|
42
|
+
|
43
|
+
response.total_items || response.per_page || response.pages || response.current_page
|
44
|
+
response.results.each { |r| puts r.name }
|
45
|
+
|
46
|
+
|
47
|
+
Query Person
|
48
|
+
|
49
|
+
response = Crunchbase::Model::Search.search({query: "encore"}, 'people')
|
50
|
+
|
51
|
+
response.results.each { |i| [i.first_name, i.last_name] }
|
52
|
+
|
53
|
+
## Get Organization && RelationShips
|
54
|
+
|
55
|
+
Get information by the permalink, Example:
|
56
|
+
|
57
|
+
response = Crunchbase::Model::Organization.get("facebook")
|
58
|
+
|
59
|
+
Relationship objects [ primary_image founders current_team investors owned_by sub_organizations headquarters offices products categories customers competitors members memberships funding_rounds investments acquisitions acquired_by ipo funds websites images videos news ]
|
60
|
+
|
61
|
+
response.founders
|
62
|
+
response.competitors_total_items
|
63
|
+
response.websites
|
64
|
+
|
65
|
+
NOTE: If you want all `past_team` `board_members_and_advisors` items, Please do:
|
66
|
+
|
67
|
+
# Methods
|
68
|
+
|
69
|
+
past_team = Crunchbase::Model::PastTeam.organization_lists("facebook")
|
70
|
+
past_team.results.collect { |p| [p.title, p.person.first_name] }
|
71
|
+
|
72
|
+
....
|
73
|
+
|
74
|
+
## Person
|
75
|
+
|
76
|
+
Get information by the permalink, Example:
|
77
|
+
|
78
|
+
person = Crunchbase::Model::Person.get( permalink )
|
79
|
+
|
80
|
+
#<Crunchbase::Model::Person:0x007fc185215f68 @type_name="Person", @uuid="a578dcf9859ec8b52182e3aa3c383b13", ...>
|
81
|
+
|
82
|
+
people = Crunchbase::Model::Person.list( page )
|
83
|
+
|
84
|
+
people.results
|
85
|
+
|
86
|
+
[ #<Crunchbase::Model::PersonSummary:...>,
|
87
|
+
#<Crunchbase::Model::PersonSummary: ...>,
|
88
|
+
#<Crunchbase::Model::PersonSummary: ...>,
|
89
|
+
#<Crunchbase::Model::PersonSummary: ...>
|
90
|
+
...... ]
|
91
|
+
|
92
|
+
## Contributing
|
93
|
+
|
94
|
+
1. Fork it ( https://github.com/encoreshao/crunchbase-ruby-library/fork )
|
95
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
96
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
97
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
98
|
+
5. Create a new Pull Request
|
99
|
+
|
100
|
+
## Copyright
|
101
|
+
|
102
|
+
Copyright © 2015-05 Encore Shao. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
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-ruby-library"
|
8
|
+
spec.version = Crunchbase::VERSION
|
9
|
+
spec.authors = ["Encore Shao"]
|
10
|
+
spec.email = ["encore.shao@gmail.com"]
|
11
|
+
spec.summary = %q{ Ruby wrapper for Crunchbase API version 3 }
|
12
|
+
spec.description = %q{ Ruby wrapper for Crunchbase API version 3 }
|
13
|
+
spec.homepage = "https://github.com/encoreshao/crunchbase-ruby-library"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
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.6"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
24
|
+
spec.add_development_dependency "rspec-its"
|
25
|
+
end
|
data/lib/crunchbase.rb
ADDED
@@ -0,0 +1,160 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'net/http'
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'yajl'
|
7
|
+
rescue LoadError
|
8
|
+
require 'json'
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'timeout'
|
12
|
+
|
13
|
+
module Crunchbase
|
14
|
+
class API
|
15
|
+
|
16
|
+
SUPPORTED_ENTITIES = ['organizations', 'people', 'products', 'funding_rounds', 'acquisitions', 'ipos', 'locations', 'categories', 'offices', 'customers', 'degrees', 'experience', 'primary_affiliation', 'videos', 'founded_companies', 'primary_location', 'advisor_at']
|
17
|
+
|
18
|
+
@timeout_limit = 60
|
19
|
+
@redirect_limit = 2
|
20
|
+
@version = '3'
|
21
|
+
@base_url = 'https://api.crunchbase.com'
|
22
|
+
@site_url = "https://www.crunchbase.com"
|
23
|
+
@image_url = "https://res.cloudinary.com/crunchbase-production/"
|
24
|
+
@debug = false
|
25
|
+
|
26
|
+
# Must be overridden in subclasses
|
27
|
+
RESOURCE_NAME = "undefined"
|
28
|
+
RESOURCE_LIST = "undefineds"
|
29
|
+
|
30
|
+
ORDER_CREATED_AT_ASC = 'created_at asc'
|
31
|
+
ORDER_CREATED_AT_DESC = 'created_at desc'
|
32
|
+
ORDER_UPDATED_AT_ASC = 'updated_at asc'
|
33
|
+
ORDER_UPDATED_AT_DESC = 'updated_at desc'
|
34
|
+
|
35
|
+
class << self
|
36
|
+
attr_accessor :timeout_limit, :redirect_limit, :key, :base_url, :version, :debug, :image_url, :site_url
|
37
|
+
|
38
|
+
def api_url
|
39
|
+
base_url.gsub(/\/$/, '') + '/v/' + version + '/'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.single_entity(permalink, entity_name)
|
44
|
+
raise CrunchException, "Unsupported Entity Type" unless SUPPORTED_ENTITIES.include?(entity_name)
|
45
|
+
|
46
|
+
fetch(permalink, entity_name)
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
# Returns the JSON parser, whether that's an instance of Yajl or JSON
|
52
|
+
def self.parser
|
53
|
+
if defined?(Yajl)
|
54
|
+
Yajl::Parser
|
55
|
+
else
|
56
|
+
JSON
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# Fetches URI for the permalink interface.
|
61
|
+
def self.fetch(permalink, object_name)
|
62
|
+
get_json_response( api_url + "#{object_name}/#{permalink}" )
|
63
|
+
end
|
64
|
+
|
65
|
+
# Fetches URI for the search interface.
|
66
|
+
def self.search(options, resource_list)
|
67
|
+
options[:page] = 1 if options[:page].nil?
|
68
|
+
options[:order] = ORDER_CREATED_AT_ASC if options[:order].nil?
|
69
|
+
|
70
|
+
uri = api_url + "#{resource_list}?" + collect_parameters(options)
|
71
|
+
|
72
|
+
get_json_response(uri)
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
# Fetches URI for the search interface.
|
77
|
+
def self.list(options, resource_list)
|
78
|
+
options[:page] = 1 if options[:page].nil?
|
79
|
+
model_name = options.delete(:model_name)
|
80
|
+
|
81
|
+
uri = api_url + "#{resource_list}?" + collect_parameters(options)
|
82
|
+
|
83
|
+
Crunchbase::Model::Search.new options, get_json_response(uri), model_name
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.collect_parameters(options)
|
87
|
+
require "cgi"
|
88
|
+
|
89
|
+
options.map{|k,v| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}"}.join('&')
|
90
|
+
end
|
91
|
+
|
92
|
+
def self.organization_lists(permalink, category, options)
|
93
|
+
lists_for_category('organizations', permalink, category, options)
|
94
|
+
end
|
95
|
+
|
96
|
+
# Demo: https://api.crunchbase.com/v/#{version}/person/#{person-permalink}/offices?user_key=key
|
97
|
+
def self.person_lists(permalink, category, options)
|
98
|
+
lists_for_category('people', permalink, category, options)
|
99
|
+
end
|
100
|
+
|
101
|
+
def self.lists_for_category(classify_name, permalink, category, options)
|
102
|
+
options[:page] = 1 if options[:page].nil?
|
103
|
+
options[:order] = ORDER_CREATED_AT_ASC if options[:order].nil?
|
104
|
+
model_name = options.delete(:model_name)
|
105
|
+
|
106
|
+
uri = api_url + "#{classify_name}/#{permalink}/#{category}?#{collect_parameters(options)}"
|
107
|
+
|
108
|
+
Crunchbase::Model::Search.new options, get_json_response(uri), model_name
|
109
|
+
end
|
110
|
+
|
111
|
+
# Gets specified URI, then parses the returned JSON. Raises Timeout error
|
112
|
+
# if request time exceeds set limit. Raises Crunchbase::Exception if returned
|
113
|
+
# JSON contains an error.
|
114
|
+
def self.get_json_response(uri)
|
115
|
+
raise Crunchbase::Exception, "User key required, visit http://data.crunchbase.com" unless @key
|
116
|
+
uri = uri + "#{uri.match('\?') ? "&" : "?"}user_key=#{@key}"
|
117
|
+
|
118
|
+
resp = Timeout::timeout(@timeout_limit) {
|
119
|
+
get_url_following_redirects(uri, @redirect_limit)
|
120
|
+
}
|
121
|
+
response = parser.parse(resp)["data"]
|
122
|
+
|
123
|
+
raise Crunchbase::Exception, response["error"] if response.class == Hash && response["error"] && response["error"]["code"] != 500
|
124
|
+
|
125
|
+
response
|
126
|
+
end
|
127
|
+
|
128
|
+
# Performs actual HTTP requests, recursively if a redirect response is
|
129
|
+
# encountered. Will raise HTTP error if response is not 200, 404, or 3xx.
|
130
|
+
def self.get_url_following_redirects(uri_str, limit = 10)
|
131
|
+
raise Crunchbase::Exception, 'HTTP redirect too deep' if limit == 0
|
132
|
+
|
133
|
+
uri = URI.parse(uri_str)
|
134
|
+
|
135
|
+
debug_log!(uri) if debug
|
136
|
+
|
137
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
138
|
+
http.use_ssl = true if uri.scheme == 'https'
|
139
|
+
response = http.start do |h|
|
140
|
+
h.request Net::HTTP::Get.new(uri.request_uri)
|
141
|
+
end
|
142
|
+
|
143
|
+
case response
|
144
|
+
when Net::HTTPSuccess, Net::HTTPNotFound, Net::HTTPInternalServerError
|
145
|
+
response.body
|
146
|
+
when Net::HTTPRedirection
|
147
|
+
get_url_following_redirects(response['location'], limit - 1)
|
148
|
+
else
|
149
|
+
response.error!
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
def self.debug_log!(uri)
|
154
|
+
puts "*"*120
|
155
|
+
puts "*** #{uri} ***"
|
156
|
+
puts "*"*120
|
157
|
+
end
|
158
|
+
|
159
|
+
end
|
160
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Crunchbase
|
4
|
+
class Exception < ::Exception
|
5
|
+
end
|
6
|
+
|
7
|
+
class ConfigurationException < Exception
|
8
|
+
end
|
9
|
+
|
10
|
+
class MissingParamsException < Exception
|
11
|
+
end
|
12
|
+
|
13
|
+
class InvalidRequestException < Exception
|
14
|
+
end
|
15
|
+
|
16
|
+
class ResponseTypeException < Exception
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Crunchbase
|
4
|
+
module Model
|
5
|
+
autoload :AcquiredBy, "crunchbase/model/acquired_by"
|
6
|
+
autoload :Acquisition, "crunchbase/model/acquisition"
|
7
|
+
autoload :Address, "crunchbase/model/address"
|
8
|
+
autoload :AdvisoryRole, "crunchbase/model/advisory_role"
|
9
|
+
autoload :BoardMembersAndAdvisor, "crunchbase/model/board_members_and_advisor"
|
10
|
+
autoload :Category, "crunchbase/model/category"
|
11
|
+
autoload :Competitor, "crunchbase/model/competitor"
|
12
|
+
autoload :CurrentTeam, "crunchbase/model/current_team"
|
13
|
+
autoload :Customer, "crunchbase/model/customer"
|
14
|
+
autoload :Degree, "crunchbase/model/degree"
|
15
|
+
autoload :Error, "crunchbase/model/error"
|
16
|
+
autoload :Entity, "crunchbase/model/entity"
|
17
|
+
autoload :FoundedCompany, "crunchbase/model/founded_company"
|
18
|
+
autoload :Founder, "crunchbase/model/founder"
|
19
|
+
autoload :Fund, "crunchbase/model/fund"
|
20
|
+
autoload :FundingRound, "crunchbase/model/funding_round"
|
21
|
+
autoload :Headquarter, "crunchbase/model/headquarter"
|
22
|
+
autoload :Image, "crunchbase/model/image"
|
23
|
+
autoload :Investment, "crunchbase/model/investment"
|
24
|
+
autoload :Investor, "crunchbase/model/investor"
|
25
|
+
autoload :Ipo, "crunchbase/model/ipo"
|
26
|
+
autoload :Job, "crunchbase/model/job"
|
27
|
+
autoload :Location, "crunchbase/model/location"
|
28
|
+
autoload :Member, "crunchbase/model/member"
|
29
|
+
autoload :Membership, "crunchbase/model/membership"
|
30
|
+
autoload :New, "crunchbase/model/new"
|
31
|
+
autoload :Office, "crunchbase/model/office"
|
32
|
+
autoload :Organization, "crunchbase/model/organization"
|
33
|
+
autoload :OrganizationSummary, "crunchbase/model/organization_summary"
|
34
|
+
autoload :OwnedBy, "crunchbase/model/owned_by"
|
35
|
+
autoload :PastTeam, "crunchbase/model/past_team"
|
36
|
+
autoload :Person, "crunchbase/model/person"
|
37
|
+
autoload :PersonSummary, "crunchbase/model/person_summary"
|
38
|
+
autoload :PrimaryAffiliation, "crunchbase/model/primary_affiliation"
|
39
|
+
autoload :PrimaryImage, "crunchbase/model/primary_image"
|
40
|
+
autoload :PrimaryLocation, "crunchbase/model/primary_location"
|
41
|
+
autoload :Product, "crunchbase/model/product"
|
42
|
+
autoload :School, "crunchbase/model/school"
|
43
|
+
autoload :Search, "crunchbase/model/search"
|
44
|
+
autoload :SearchResult, "crunchbase/model/search_result"
|
45
|
+
autoload :SubOrganization, "crunchbase/model/sub_organization"
|
46
|
+
autoload :Video, "crunchbase/model/video"
|
47
|
+
autoload :Website, "crunchbase/model/website"
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Crunchbase::Model
|
4
|
+
class Acquisition < Crunchbase::Model::Entity
|
5
|
+
|
6
|
+
RESOURCE_LIST = 'acquisitions'
|
7
|
+
|
8
|
+
attr_reader :api_path, :web_path, :price, :price_currency_code, :price_usd,
|
9
|
+
:payment_type, :acquisition_type, :acquisition_status, :disposition_of_acquired,
|
10
|
+
:announced_on, :announced_on_trust_code, :completed_on, :completed_on_trust_code,
|
11
|
+
:created_at, :updated_at
|
12
|
+
|
13
|
+
|
14
|
+
attr_reader :acquirer, :acquiree
|
15
|
+
|
16
|
+
attr_reader :acquirer_total_items, :acquiree_total_items
|
17
|
+
|
18
|
+
def initialize(json)
|
19
|
+
super
|
20
|
+
|
21
|
+
unless (relationships = json['relationships']).nil?
|
22
|
+
instance_relationships_object(Crunchbase::Model::Organization, 'acquiree', relationships['acquiree'])
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def property_keys
|
27
|
+
%w[
|
28
|
+
api_path web_path price price_currency_code price_usd
|
29
|
+
payment_type acquisition_type acquisition_status disposition_of_acquired
|
30
|
+
announced_on announced_on_trust_code completed_on completed_on_trust_code
|
31
|
+
created_at updated_at
|
32
|
+
]
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|