Sha256: afa9ea7ae943d6e738bf7a25d26265b0526474dc324e4dfdc586094c71a1b229

Contents?: true

Size: 687 Bytes

Versions: 1

Compression:

Stored size: 687 Bytes

Contents

# encoding: utf-8

module Crunchbase::Model
  class Investor < Crunchbase::Model::Entity
    
    RESOURCE_LIST = 'investors'

    attr_reader :object

    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

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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
crunchbase-ruby-library-0.0.1 lib/crunchbase/model/investor.rb