crunchbase-api 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/crunchbase-api/entity.rb +2 -2
- data/lib/crunchbase-api/organization.rb +30 -1
- data/lib/crunchbase-api/relation.rb +2 -2
- data/lib/crunchbase-api/version.rb +1 -1
- data/test/crunchbase-api/ipo_test.rb +0 -1
- data/test/crunchbase-api/organization_test.rb +22 -1
- data/test/crunchbase-api/product_test.rb +0 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c2ac0fa42f645c3bb02ef986561ce5e7c492b27
|
4
|
+
data.tar.gz: b75493f9cd774d2d6d6f6abcac7ffaf23b8dbae2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac19af8c511f8c632fc7999b405d42f1eb412743e564d7d586b4836a81b5406663b10a8605f368cb81970a1fe7b4247a6943bd15f8d5f95a52af3778e57c9a1d
|
7
|
+
data.tar.gz: 83acc5090188aabda059a60f69586d8a4be9f540a28de0f00532f9dfad92446aff204fc291fa504369c60cc3df356958624e44a3a67718117ae346f23966eebe
|
@@ -16,8 +16,8 @@ module Crunchbase
|
|
16
16
|
self.new Crunchbase::fetch("#{self::RESOURCE_FIND}/#{permalink}")
|
17
17
|
end
|
18
18
|
|
19
|
-
def self.fetch_list(page = 1, order = ORDER_CREATED_AT_DESC)
|
20
|
-
r = Crunchbase::fetch(self::RESOURCE_LIST,
|
19
|
+
def self.fetch_list(page = 1, order = ORDER_CREATED_AT_DESC, params = {})
|
20
|
+
r = Crunchbase::fetch(self::RESOURCE_LIST, params.merge(page: page, order: order))['items']
|
21
21
|
r.map { |i| Relation.new i }
|
22
22
|
end
|
23
23
|
|
@@ -22,12 +22,29 @@ module Crunchbase
|
|
22
22
|
attr_reader :created_at
|
23
23
|
attr_reader :updated_at
|
24
24
|
|
25
|
+
|
25
26
|
attr_reader :competitors
|
26
27
|
attr_reader :funding_rounds
|
27
28
|
attr_reader :founders
|
28
29
|
attr_reader :products
|
29
30
|
attr_reader :acquisitions
|
30
31
|
attr_reader :ipo
|
32
|
+
attr_reader :headquarters
|
33
|
+
attr_reader :board_members_and_advisors
|
34
|
+
attr_reader :categories
|
35
|
+
attr_reader :current_team
|
36
|
+
attr_reader :customers
|
37
|
+
attr_reader :images
|
38
|
+
attr_reader :investments
|
39
|
+
attr_reader :members
|
40
|
+
attr_reader :news
|
41
|
+
attr_reader :offices
|
42
|
+
attr_reader :past_team
|
43
|
+
attr_reader :primary_image
|
44
|
+
attr_reader :sub_organizations
|
45
|
+
attr_reader :websites
|
46
|
+
|
47
|
+
|
31
48
|
|
32
49
|
def self.get(permalink)
|
33
50
|
self.fetch_one permalink
|
@@ -37,6 +54,18 @@ module Crunchbase
|
|
37
54
|
self.fetch_list page, order
|
38
55
|
end
|
39
56
|
|
57
|
+
def self.find_all_by_domain_name(q, page = 1)
|
58
|
+
self.fetch_list(page, ORDER_CREATED_AT_DESC, { domain_name:q })
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.find_all_by_query(q, page = 1)
|
62
|
+
self.fetch_list(page, ORDER_CREATED_AT_DESC, { query:q })
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.find_all_by_name(q, page = 1)
|
66
|
+
self.fetch_list(page, ORDER_CREATED_AT_DESC, { name:q })
|
67
|
+
end
|
68
|
+
|
40
69
|
private
|
41
70
|
|
42
71
|
def property_keys
|
@@ -52,7 +81,7 @@ module Crunchbase
|
|
52
81
|
|
53
82
|
def relationships
|
54
83
|
%w[
|
55
|
-
competitors funding_rounds founders products acquisitions ipo
|
84
|
+
competitors funding_rounds founders products acquisitions ipo headquarters board_members_and_advisors categories current_team customers images investments members news offices past_team primary_image sub_organizations websites
|
56
85
|
]
|
57
86
|
end
|
58
87
|
|
@@ -12,8 +12,8 @@ module Crunchbase
|
|
12
12
|
@type = data['type']
|
13
13
|
@name = data['name']
|
14
14
|
@path = data['path']
|
15
|
-
@created_at = Time.at(data['created_at'])
|
16
|
-
@updated_at = Time.at(data['updated_at'])
|
15
|
+
@created_at = Time.at(data['created_at']) unless data['created_at'].nil?
|
16
|
+
@updated_at = Time.at(data['updated_at']) unless data['updated_at'].nil?
|
17
17
|
end
|
18
18
|
|
19
19
|
def fetch
|
@@ -6,7 +6,6 @@ describe 'IPO', :vcr do
|
|
6
6
|
c.opening_share_price.must_equal '38.0'
|
7
7
|
c.opening_share_price_currency_code.must_equal 'USD'
|
8
8
|
c.stock_symbol.must_equal 'FB'
|
9
|
-
c.stock_exchange_symbol.must_equal 'NASDAQ'
|
10
9
|
c.went_public_on.must_equal Date.new(2012, 5, 18)
|
11
10
|
c.canonical_currency_code.must_equal 'USD'
|
12
11
|
c.money_raised.must_equal 18400000000
|
@@ -2,6 +2,27 @@ require 'helper'
|
|
2
2
|
|
3
3
|
describe 'Organization', :vcr do
|
4
4
|
|
5
|
+
it 'should retrieve organization by domain' do
|
6
|
+
relation = Crunchbase::Organization.find_all_by_domain_name('facebook.com').first
|
7
|
+
c = relation.fetch
|
8
|
+
c.must_be_instance_of Crunchbase::Organization
|
9
|
+
c.name.must_equal 'Facebook'
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should retrieve organization by name' do
|
13
|
+
relation = Crunchbase::Organization.find_all_by_name('Facebook').first
|
14
|
+
c = relation.fetch
|
15
|
+
c.must_be_instance_of Crunchbase::Organization
|
16
|
+
c.name.must_equal 'Facebook'
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should retrieve organization by query' do
|
20
|
+
relation = Crunchbase::Organization.find_all_by_query('Faceboo').first
|
21
|
+
c = relation.fetch
|
22
|
+
c.must_be_instance_of Crunchbase::Organization
|
23
|
+
c.name.must_equal 'Facebook'
|
24
|
+
end
|
25
|
+
|
5
26
|
it 'should retrieve organization by permalink' do
|
6
27
|
c = Crunchbase::Organization.get 'facebook'
|
7
28
|
c.name.must_equal 'Facebook'
|
@@ -9,7 +30,7 @@ describe 'Organization', :vcr do
|
|
9
30
|
c.description.wont_be_empty
|
10
31
|
c.short_description.wont_be_empty
|
11
32
|
c.homepage_url.must_include 'facebook.com'
|
12
|
-
c.founded_on.must_equal Date.new(2004, 02,
|
33
|
+
c.founded_on.must_equal Date.new(2004, 02, 04)
|
13
34
|
c.total_funding_usd.must_be_instance_of Fixnum
|
14
35
|
c.number_of_investments.must_be_instance_of Fixnum
|
15
36
|
c.number_of_employees.must_be_instance_of Fixnum
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crunchbase-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sandis Klakovskis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|