Class: Crunchbase::Investment

Inherits:
Object
  • Object
show all
Includes:
DateMethods
Defined in:
lib/crunchbase/investment.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from DateMethods

#date_from_components

Constructor Details

#initialize(hash) ⇒ Investment

Returns a new instance of Investment.



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/crunchbase/investment.rb', line 14

def initialize(hash)
  hash = hash["funding_round"]
  @funding_round_code = hash["round_code"]
  @funding_source_url = hash["source_url"]
  @funding_source_description = hash["source_description"]
  @raised_amount = hash["raised_amount"]
  @raised_currency_code = hash["raised_currency_code"]
  @funded_year = hash["funded_year"]
  @funded_month = hash["funded_month"]
  @funded_day = hash["funded_day"]
  @company_name = hash["company"]["name"]
  @company_permalink = hash["company"]["permalink"]
end

Instance Attribute Details

#company_nameObject (readonly)

Returns the value of attribute company_name.



6
7
8
# File 'lib/crunchbase/investment.rb', line 6

def company_name
  @company_name
end

Returns the value of attribute company_permalink.



6
7
8
# File 'lib/crunchbase/investment.rb', line 6

def company_permalink
  @company_permalink
end

#funding_round_codeObject (readonly)

Returns the value of attribute funding_round_code.



6
7
8
# File 'lib/crunchbase/investment.rb', line 6

def funding_round_code
  @funding_round_code
end

#funding_source_descriptionObject (readonly)

Returns the value of attribute funding_source_description.



6
7
8
# File 'lib/crunchbase/investment.rb', line 6

def funding_source_description
  @funding_source_description
end

#funding_source_urlObject (readonly)

Returns the value of attribute funding_source_url.



6
7
8
# File 'lib/crunchbase/investment.rb', line 6

def funding_source_url
  @funding_source_url
end

#raised_amountObject (readonly)

Returns the value of attribute raised_amount.



6
7
8
# File 'lib/crunchbase/investment.rb', line 6

def raised_amount
  @raised_amount
end

#raised_currency_codeObject (readonly)

Returns the value of attribute raised_currency_code.



6
7
8
# File 'lib/crunchbase/investment.rb', line 6

def raised_currency_code
  @raised_currency_code
end

Class Method Details

.array_from_investment_list(list) ⇒ Object



10
11
12
# File 'lib/crunchbase/investment.rb', line 10

def self.array_from_investment_list(list)
  list.map{|l| self.new(l)}
end

Instance Method Details

#company(force_reload = false) ⇒ Object

Retrieves associated Company object, storing it for future use. If force_reload is set to true, it will bypass the stored version.



30
31
32
33
34
# File 'lib/crunchbase/investment.rb', line 30

def company(force_reload=false)
  return @company unless @company.nil? || force_reload
  @company = Company.get(@company_permalink)
  return @company
end

#funded_dateObject



36
37
38
# File 'lib/crunchbase/investment.rb', line 36

def funded_date
  @funded_date ||= date_from_components(@funded_year, @funded_month, @funded_day)
end