Sha256: a4531d0551fee660bf89e522ffe1614600537d983e4a37521e402c150f7f2257

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

# encoding: utf-8

# http://api.crunchbase.com/v/2/person/randi-zuckerberg?user_key=key

module Crunchbase
  class Person < CBEntity
    
    RESOURCE_NAME = 'person'
    RESOURCE_LIST = 'people'
    
    attr_reader :type_name, :name, :first_name, :last_name, :permalink, :bio, :born_on, :died_on, 
                :is_deceased, :created_at, :updated_at

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

      @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']
      @created_at     = Time.at(properties['created_at']).utc
      @updated_at     = Time.at(properties['updated_at']).utc
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
crunchbase_v2-0.0.9 lib/crunchbase/person.rb
crunchbase_v2-0.0.8 lib/crunchbase/person.rb
crunchbase_v2-0.0.7 lib/crunchbase/person.rb