Class: Crunchbase::Person

Inherits:
CBEntity show all
Defined in:
lib/crunchbase/person.rb

Constant Summary collapse

RESOURCE_LIST =
'people'
RESOURCE_NAME =
'person'

Constants inherited from CBEntity

CBEntity::RELATIONSHIPS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from CBEntity

array_from_list, category_lists_by_permalink, #fetch, get, list, lists_for_permalink, lists_for_person_permalink, parsing_from_list, search, total_items_from_list

Constructor Details

#initialize(json) ⇒ Person

Returns a new instance of Person.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/crunchbase/person.rb', line 23

def initialize(json)
  @uuid           = json['uuid']
  @type_name      = json['type']
  properties      = json['properties']
  relationships   = json['relationships']

  @name           = properties['first_name'].to_s + ' ' + properties['last_name'].to_s
  @first_name     = properties['first_name']
  @last_name      = properties['last_name']
  @permalink      = properties['permalink']
  @bio            = properties['bio']
  @born_on        = properties['born_on'] && DateTime.parse(properties['born_on'])
  @died_on        = properties['died_on'] && DateTime.parse(properties['died_on'])
  @is_deceased    = properties['is_deceased']
  @homepage_url   = properties['homepage_url']
  @created_at     = Time.at(properties['created_at']).utc
  @updated_at     = Time.at(properties['updated_at']).utc

  @degrees_list               = relationships['degrees']
  @experiences_list           = relationships['experience']
  @primary_locations_list     = relationships['primary_location']
  @affiliations_list          = relationships['primary_affiliation']
  @investments_list           = relationships['investments']
  @advisor_ats_list           = relationships['advisor_at']
  @founded_companies_list     = relationships['founded_companies']
  @primary_images_list        = relationships['primary_image']
  @videos_list                = relationships['videos']
  @websites_list              = relationships['websites']
  @new_items_list             = relationships['news']
end

Instance Attribute Details

#advisor_atsObject (readonly)

Returns the value of attribute advisor_ats.



14
15
16
# File 'lib/crunchbase/person.rb', line 14

def advisor_ats
  @advisor_ats
end

#advisor_ats_total_itemsObject (readonly)

Returns the value of attribute advisor_ats_total_items.



17
18
19
# File 'lib/crunchbase/person.rb', line 17

def advisor_ats_total_items
  @advisor_ats_total_items
end

#bioObject (readonly)

Returns the value of attribute bio.



11
12
13
# File 'lib/crunchbase/person.rb', line 11

def bio
  @bio
end

#born_onObject (readonly)

Returns the value of attribute born_on.



11
12
13
# File 'lib/crunchbase/person.rb', line 11

def born_on
  @born_on
end

#created_atObject (readonly)

Returns the value of attribute created_at.



11
12
13
# File 'lib/crunchbase/person.rb', line 11

def created_at
  @created_at
end

#degreesObject (readonly)

Returns the value of attribute degrees.



14
15
16
# File 'lib/crunchbase/person.rb', line 14

def degrees
  @degrees
end

#degrees_total_itemsObject (readonly)

TODO Get all relationships total count



101
102
103
# File 'lib/crunchbase/person.rb', line 101

def degrees_total_items
  @degrees_total_items
end

#died_onObject (readonly)

Returns the value of attribute died_on.



11
12
13
# File 'lib/crunchbase/person.rb', line 11

def died_on
  @died_on
end

#experiencesObject (readonly)

Returns the value of attribute experiences.



14
15
16
# File 'lib/crunchbase/person.rb', line 14

def experiences
  @experiences
end

#experiences_total_itemsObject (readonly)

Returns the value of attribute experiences_total_items.



17
18
19
# File 'lib/crunchbase/person.rb', line 17

def experiences_total_items
  @experiences_total_items
end

#first_nameObject (readonly)

Returns the value of attribute first_name.



11
12
13
# File 'lib/crunchbase/person.rb', line 11

def first_name
  @first_name
end

#founded_companiesObject (readonly)

Returns the value of attribute founded_companies.



14
15
16
# File 'lib/crunchbase/person.rb', line 14

def founded_companies
  @founded_companies
end

#founded_companies_total_itemsObject (readonly)

Returns the value of attribute founded_companies_total_items.



17
18
19
# File 'lib/crunchbase/person.rb', line 17

def founded_companies_total_items
  @founded_companies_total_items
end

#homepage_urlObject (readonly)

Returns the value of attribute homepage_url.



11
12
13
# File 'lib/crunchbase/person.rb', line 11

def homepage_url
  @homepage_url
end

#investmentsObject (readonly)

Returns the value of attribute investments.



14
15
16
# File 'lib/crunchbase/person.rb', line 14

def investments
  @investments
end

#investments_total_itemsObject (readonly)

Returns the value of attribute investments_total_items.



17
18
19
# File 'lib/crunchbase/person.rb', line 17

def investments_total_items
  @investments_total_items
end

#is_deceasedObject (readonly)

Returns the value of attribute is_deceased.



11
12
13
# File 'lib/crunchbase/person.rb', line 11

def is_deceased
  @is_deceased
end

#last_nameObject (readonly)

Returns the value of attribute last_name.



11
12
13
# File 'lib/crunchbase/person.rb', line 11

def last_name
  @last_name
end

#nameObject (readonly)

Returns the value of attribute name.



11
12
13
# File 'lib/crunchbase/person.rb', line 11

def name
  @name
end

#new_itemsObject (readonly)

Returns the value of attribute new_items.



14
15
16
# File 'lib/crunchbase/person.rb', line 14

def new_items
  @new_items
end

#new_items_total_itemsObject (readonly)

Returns the value of attribute new_items_total_items.



17
18
19
# File 'lib/crunchbase/person.rb', line 17

def new_items_total_items
  @new_items_total_items
end

Returns the value of attribute permalink.



11
12
13
# File 'lib/crunchbase/person.rb', line 11

def permalink
  @permalink
end

#primary_affiliationsObject (readonly)

Returns the value of attribute primary_affiliations.



14
15
16
# File 'lib/crunchbase/person.rb', line 14

def primary_affiliations
  @primary_affiliations
end

#primary_affiliations_total_itemsObject (readonly)

Returns the value of attribute primary_affiliations_total_items.



17
18
19
# File 'lib/crunchbase/person.rb', line 17

def primary_affiliations_total_items
  @primary_affiliations_total_items
end

#primary_imagesObject (readonly)

Returns the value of attribute primary_images.



14
15
16
# File 'lib/crunchbase/person.rb', line 14

def primary_images
  @primary_images
end

#primary_images_total_itemsObject (readonly)

Returns the value of attribute primary_images_total_items.



17
18
19
# File 'lib/crunchbase/person.rb', line 17

def primary_images_total_items
  @primary_images_total_items
end

#primary_locationsObject (readonly)

Returns the value of attribute primary_locations.



14
15
16
# File 'lib/crunchbase/person.rb', line 14

def primary_locations
  @primary_locations
end

#primary_locations_total_itemsObject (readonly)

Returns the value of attribute primary_locations_total_items.



17
18
19
# File 'lib/crunchbase/person.rb', line 17

def primary_locations_total_items
  @primary_locations_total_items
end

#type_nameObject (readonly)

Returns the value of attribute type_name.



11
12
13
# File 'lib/crunchbase/person.rb', line 11

def type_name
  @type_name
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



11
12
13
# File 'lib/crunchbase/person.rb', line 11

def updated_at
  @updated_at
end

#uuidObject (readonly)

Returns the value of attribute uuid.



11
12
13
# File 'lib/crunchbase/person.rb', line 11

def uuid
  @uuid
end

#videosObject (readonly)

Returns the value of attribute videos.



14
15
16
# File 'lib/crunchbase/person.rb', line 14

def videos
  @videos
end

#videos_total_itemsObject (readonly)

Returns the value of attribute videos_total_items.



17
18
19
# File 'lib/crunchbase/person.rb', line 17

def videos_total_items
  @videos_total_items
end

#websitesObject (readonly)

Returns the value of attribute websites.



14
15
16
# File 'lib/crunchbase/person.rb', line 14

def websites
  @websites
end

#websites_total_itemsObject (readonly)

Returns the value of attribute websites_total_items.



17
18
19
# File 'lib/crunchbase/person.rb', line 17

def websites_total_items
  @websites_total_items
end

Instance Method Details

#advisor_ats_total_itmesObject



121
122
123
# File 'lib/crunchbase/person.rb', line 121

def advisor_ats_total_itmes
  @advisor_ats_total_itmes ||= AdvisorAt.total_items_from_list(@advisor_ats_list)
end

#investments_total_itmesObject



117
118
119
# File 'lib/crunchbase/person.rb', line 117

def investments_total_itmes
  @investments_total_itmes ||= Investment.total_items_from_list(@investments_list)
end