class Crunchbase::Relation

Attributes

created_at[R]
investors[R]
money_invested[R]
money_invested_usd[R]
money_raised_currency_code[R]
name[R]
path[R]
type[R]
updated_at[R]

Public Class Methods

new(data) click to toggle source
# File lib/crunchbase-api/relation.rb, line 15
def initialize(data)
  @type = data['type']
  @name = data['name']
  @path = data['path']
  @created_at = Time.at(data['created_at'].to_i) unless data['created_at'].nil?
  @updated_at = Time.at(data['updated_at'].to_i) unless data['updated_at'].nil?
end

Public Instance Methods

fetch() click to toggle source
# File lib/crunchbase-api/relation.rb, line 23
def fetch
  supported_relations = %w[Organization Person Product FundingRound Acquisition Ipo]
  unless supported_relations.include?(@type.capitalize)
    raise CrunchbaseException, "Fetching of '#{@type}' relations is not supported at this time"
  end
  result = Crunchbase.fetch @path
  Crunchbase.const_get(@type.capitalize).new result
end