Module: Crunchbase::Utilities::CbModel

Included in:
Autocompletes::Client, DeletedEntities::Client, Entities::Client, Searches::Client
Defined in:
lib/crunchbase/utilities/cb_model.rb

Overview

API Request

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#entity_typeObject

Returns the value of attribute entity_type.



8
9
10
# File 'lib/crunchbase/utilities/cb_model.rb', line 8

def entity_type
  @entity_type
end

Class Method Details

.cbobjectObject



12
13
14
# File 'lib/crunchbase/utilities/cb_model.rb', line 12

def cbobject
  kclass_name.new
end

.exact_kclass_objectObject



20
21
22
23
24
25
26
27
28
29
# File 'lib/crunchbase/utilities/cb_model.rb', line 20

def exact_kclass_object
  return entity_type if entity_type.is_a?(Class)

  cb_type = [
    'Crunchbase',
    'Models',
    entity_type.split('_').map(&:capitalize).join
  ].join('::')
  Kernel.const_get("::#{cb_type}")
end

.kclass_nameObject



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

def kclass_name
  @kclass_name ||= exact_kclass_object
end