Sha256: 4cb78abfbe3677239836558a296a5efa4b68ac8df0504d5f0dd0a5197646776f

Contents?: true

Size: 1.58 KB

Versions: 4

Compression:

Stored size: 1.58 KB

Contents

# encoding: utf-8

# https://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

4 entries across 4 versions & 1 rubygems

Version Path
crunchbase_v2-1.1.2 lib/crunchbase/investment.rb
crunchbase_v2-1.1.1 lib/crunchbase/investment.rb
crunchbase_v2-1.1.0 lib/crunchbase/investment.rb
crunchbase_v2-1.0.0 lib/crunchbase/investment.rb