Sha256: 38fb3dfd8cd2ffbd95266a6b64de26dbd7b88a8560dbc7638ee3348eb51b86ef

Contents?: true

Size: 1.58 KB

Versions: 3

Compression:

Stored size: 1.58 KB

Contents

# encoding: utf-8

# http://api.crunchbase.com/v/2/organization/facebook/investments

module Crunchbase
  class Investment < CBEntity
    
    RESOURCE_LIST = 'investments'

    attr_reader :type_name, :money_invested, :money_invested_currency_code, 
                :money_invested_usd, :funding_round_path, :invested_in_type,
                :invested_in_name, :invested_in_path

    def initialize(json)
      @type_name      = json['type']
      @money_invested = json['money_invested']
      @money_invested_currency_code  = json['money_invested_currency_code']
      @money_invested_usd   = json['money_invested_usd']
      @funding_round_path   = json['funding_round'] && json['funding_round']['path']

      if json['invested_in_type']
        @invested_in_type   = json['invested_in_type'] && json['invested_in_type']['type']
        @invested_in_name   = json['invested_in_type'] && json['invested_in_type']['name']
        @invested_in_path   = json['invested_in_type'] && json['invested_in_type']['path']
      elsif json['invested_in']
        # From one's organization investments
        @invested_in_type   = json['invested_in'] && json['invested_in']['type']
        @invested_in_name   = json['invested_in'] && json['invested_in']['name']
        @invested_in_path   = json['invested_in'] && json['invested_in']['path']
      elsif json['investor']
        @invested_in_type   = json['investor'] && json['investor']['type']
        @invested_in_name   = json['investor'] && json['investor']['name']
        @invested_in_path   = json['investor'] && json['investor']['path']
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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