Sha256: ab8887d0cc7ed81819bb2e0ec675a0ed64ccd7f2e38220c416eca55ac908b06a

Contents?: true

Size: 1.07 KB

Versions: 4

Compression:

Stored size: 1.07 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'] + ' ' + properties['last_name']
      @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

4 entries across 4 versions & 1 rubygems

Version Path
crunchbase_v2-0.0.4 lib/crunchbase/person.rb
crunchbase_v2-0.0.3 lib/crunchbase/person.rb
crunchbase_v2-0.0.2 lib/crunchbase/person.rb
crunchbase_v2-0.0.1 lib/crunchbase/person.rb