Class: Crunchbase::Model::Investor

Inherits:
Entity
  • Object
show all
Defined in:
lib/crunchbase/model/investor.rb

Constant Summary collapse

RESOURCE_LIST =
'investors'

Instance Attribute Summary collapse

Attributes inherited from Entity

#type_name, #uuid

Instance Method Summary collapse

Methods inherited from Entity

array_from_list, #fetch, get, list, organization_lists, parsing_from_list, person_lists, total_items_from_list

Constructor Details

#initialize(json) ⇒ Investor

Returns a new instance of Investor.



10
11
12
13
# File 'lib/crunchbase/model/investor.rb', line 10

def initialize(json)
  set_relationship_object('object', Crunchbase::Model::Person, json) if json['type'] == 'Person'
  set_relationship_object('object', Crunchbase::Model::Organization, json) if json['type'] == 'Organization'
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



8
9
10
# File 'lib/crunchbase/model/investor.rb', line 8

def object
  @object
end

Instance Method Details

#organization?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/crunchbase/model/investor.rb', line 23

def organization?
  (object.type_name == "Organization")
end

#person?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/crunchbase/model/investor.rb', line 19

def person?
  (object.type_name == "Person")
end

#set_relationship_object(key, object_name, json) ⇒ Object



15
16
17
# File 'lib/crunchbase/model/investor.rb', line 15

def set_relationship_object(key, object_name, json)
  instance_variable_set "@#{key}", ( object_name.new(json) || nil )
end