Class: Crunchbase::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/crunchbase/client.rb

Instance Method Summary collapse

Instance Method Details

#batch_search(requests) ⇒ Object

Runs a batch search and returns matched results Params:

requests

An array of hashes with following attributes: { ‘type’: String, ‘uuid’: String, ‘relationships’: String[] }



47
48
49
50
51
# File 'lib/crunchbase/client.rb', line 47

def batch_search(requests)
  return [] if requests.nil?

  kclass('BatchSearch').batch_search(requests)
end

#get(permalink, kclass_name, relationship_name = nil) ⇒ Object

Get information by permalink with optional one relationship



6
7
8
9
10
11
12
13
# File 'lib/crunchbase/client.rb', line 6

def get(permalink, kclass_name, relationship_name = nil)
  case kclass_name
  when 'Person'
    person(permalink, relationship_name)
  when 'Organization'
    organization(permalink, relationship_name)
  end
end

#list(kclass_name, options = {}) ⇒ Object



25
26
27
28
29
# File 'lib/crunchbase/client.rb', line 25

def list(kclass_name, options = {})
  page = options[:page] || 1

  kclass(kclass_name).list(page)
end

#organization(permalink, kclass_name = nil) ⇒ Object

Get organization information by the permalink



16
17
18
# File 'lib/crunchbase/client.rb', line 16

def organization(permalink, kclass_name = nil)
  request_perform('Organization', permalink, kclass_name)
end

#person(permalink, kclass_name = nil) ⇒ Object

Get person information by the permalink



21
22
23
# File 'lib/crunchbase/client.rb', line 21

def person(permalink, kclass_name = nil)
  request_perform('Person', permalink, kclass_name)
end

#request_perform(stand_kclass, permalink, kclass_name) ⇒ Object



38
39
40
41
42
# File 'lib/crunchbase/client.rb', line 38

def request_perform(stand_kclass, permalink, kclass_name)
  return kclass(stand_kclass).get(permalink) if kclass_name.nil?

  kclass(kclass_name).organization_lists(permalink)
end

#search(options, kclass_name) ⇒ Object

options -> { query: “Ekohe” } || { name: “Ekohe” } || { domain_name: “ekohe.com” }



32
33
34
35
36
# File 'lib/crunchbase/client.rb', line 32

def search(options, kclass_name)
  return [] if kclass_name.nil?

  kclass('Search').search(options, kclass_name)
end