Class: Crunchbase::API

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

Constant Summary collapse

SUPPORTED_ENTITIES =
['organizations', 'organization', 'people', 'person', 'products', 'product', 'funding_rounds', 'funding-round', 'acquisition', 'ipo', 'fund-raise', 'locations', 'categories', 'offices', 'customers', 'degrees', 'experience', 'primary_affiliation', 'videos', 'founded_companies', 'primary_location', 'advisor_at']
RESOURCE_NAME =

Must be overridden in subclasses

"undefined"
RESOURCE_LIST =
"undefineds"
ORDER_CREATED_AT_ASC =
'created_at asc'
ORDER_CREATED_AT_DESC =
'created_at desc'
ORDER_UPDATED_AT_ASC =
'updated_at asc'
ORDER_UPDATED_AT_DESC =
'updated_at desc'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.base_urlObject

Returns the value of attribute base_url.



36
37
38
# File 'lib/crunchbase/api.rb', line 36

def base_url
  @base_url
end

.debugObject

Returns the value of attribute debug.



36
37
38
# File 'lib/crunchbase/api.rb', line 36

def debug
  @debug
end

.image_urlObject

Returns the value of attribute image_url.



36
37
38
# File 'lib/crunchbase/api.rb', line 36

def image_url
  @image_url
end

.keyObject

Returns the value of attribute key.



36
37
38
# File 'lib/crunchbase/api.rb', line 36

def key
  @key
end

.redirect_limitObject

Returns the value of attribute redirect_limit.



36
37
38
# File 'lib/crunchbase/api.rb', line 36

def redirect_limit
  @redirect_limit
end

.site_urlObject

Returns the value of attribute site_url.



36
37
38
# File 'lib/crunchbase/api.rb', line 36

def site_url
  @site_url
end

.timeout_limitObject

Returns the value of attribute timeout_limit.



36
37
38
# File 'lib/crunchbase/api.rb', line 36

def timeout_limit
  @timeout_limit
end

.versionObject

Returns the value of attribute version.



36
37
38
# File 'lib/crunchbase/api.rb', line 36

def version
  @version
end

Class Method Details

.all(entity) ⇒ Object



50
51
52
# File 'lib/crunchbase/api.rb', line 50

def self.all(entity)
  get_json_response( api_url + entity )
end

.api_urlObject



39
40
41
# File 'lib/crunchbase/api.rb', line 39

def api_url
  base_url.gsub(/\/$/, '') + '/v/' + version + '/'
end

.single_entity(permalink, entity_name) ⇒ Object

Raises:



44
45
46
47
48
# File 'lib/crunchbase/api.rb', line 44

def self.single_entity(permalink, entity_name)
  raise CrunchException, "Unsupported Entity Type" unless SUPPORTED_ENTITIES.include?(entity_name)

  fetch(permalink, entity_name)
end