Class: Crunchbase::Model::FundingRound

Inherits:
Entity
  • Object
show all
Defined in:
lib/crunchbase/model/funding_round.rb

Constant Summary collapse

RESOURCE_LIST =
'funding_rounds'.freeze
RESOURCE_NAME =
'funding-rounds'.freeze

Instance Attribute Summary collapse

Attributes inherited from Entity

#type_name, #uuid

Instance Method Summary collapse

Methods inherited from Entity

#convert_date!, #fetch, #instance_multi_relationship_objects, #instance_relationships_object, #instance_timestamps, #one_to_many, #one_to_one, #parse_hash_items, #set_relationships_object, #set_variables, #setup_relationships_data!, #special_relationship, #verify_item?

Methods included from Request::Client

#api, #array_from_list, #funding_rounds_lists, #get, #kclass_name, #list, #organization_lists, #parsing_from_list, #person_lists, #total_items_from_list

Constructor Details

#initialize(json) ⇒ FundingRound

Returns a new instance of FundingRound.



19
20
21
22
23
24
25
26
# File 'lib/crunchbase/model/funding_round.rb', line 19

def initialize(json)
  super(json)

  relationships = json['relationships']
  return if relationships.nil?

  relationship_with_funded(relationships['funded_organization'])
end

Instance Attribute Details

#announced_onObject (readonly)

Returns the value of attribute announced_on.



8
9
10
# File 'lib/crunchbase/model/funding_round.rb', line 8

def announced_on
  @announced_on
end

#announced_on_trust_codeObject (readonly)

Returns the value of attribute announced_on_trust_code.



8
9
10
# File 'lib/crunchbase/model/funding_round.rb', line 8

def announced_on_trust_code
  @announced_on_trust_code
end

#api_pathObject (readonly)

Returns the value of attribute api_path.



8
9
10
# File 'lib/crunchbase/model/funding_round.rb', line 8

def api_path
  @api_path
end

#closed_onObject (readonly)

Returns the value of attribute closed_on.



8
9
10
# File 'lib/crunchbase/model/funding_round.rb', line 8

def closed_on
  @closed_on
end

#closed_on_trust_codeObject (readonly)

Returns the value of attribute closed_on_trust_code.



8
9
10
# File 'lib/crunchbase/model/funding_round.rb', line 8

def closed_on_trust_code
  @closed_on_trust_code
end

#created_atObject (readonly)

Returns the value of attribute created_at.



8
9
10
# File 'lib/crunchbase/model/funding_round.rb', line 8

def created_at
  @created_at
end

#funded_organizationObject (readonly)

Returns the value of attribute funded_organization.



14
15
16
# File 'lib/crunchbase/model/funding_round.rb', line 14

def funded_organization
  @funded_organization
end

#funded_organization_total_itemsObject (readonly)

Returns the value of attribute funded_organization_total_items.



16
17
18
# File 'lib/crunchbase/model/funding_round.rb', line 16

def funded_organization_total_items
  @funded_organization_total_items
end

#funding_typeObject (readonly)

Returns the value of attribute funding_type.



8
9
10
# File 'lib/crunchbase/model/funding_round.rb', line 8

def funding_type
  @funding_type
end

#imagesObject (readonly)

Returns the value of attribute images.



14
15
16
# File 'lib/crunchbase/model/funding_round.rb', line 14

def images
  @images
end

#images_total_itemsObject (readonly)

Returns the value of attribute images_total_items.



16
17
18
# File 'lib/crunchbase/model/funding_round.rb', line 16

def images_total_items
  @images_total_items
end

#investmentsObject (readonly)

Returns the value of attribute investments.



14
15
16
# File 'lib/crunchbase/model/funding_round.rb', line 14

def investments
  @investments
end

#investments_total_itemsObject (readonly)

Returns the value of attribute investments_total_items.



16
17
18
# File 'lib/crunchbase/model/funding_round.rb', line 16

def investments_total_items
  @investments_total_items
end

#investorsObject (readonly)

Returns the value of attribute investors.



14
15
16
# File 'lib/crunchbase/model/funding_round.rb', line 14

def investors
  @investors
end

#investors_total_itemsObject (readonly)

Returns the value of attribute investors_total_items.



16
17
18
# File 'lib/crunchbase/model/funding_round.rb', line 16

def investors_total_items
  @investors_total_items
end

#money_raisedObject (readonly)

Returns the value of attribute money_raised.



8
9
10
# File 'lib/crunchbase/model/funding_round.rb', line 8

def money_raised
  @money_raised
end

#money_raised_currency_codeObject (readonly)

Returns the value of attribute money_raised_currency_code.



8
9
10
# File 'lib/crunchbase/model/funding_round.rb', line 8

def money_raised_currency_code
  @money_raised_currency_code
end

#money_raised_usdObject (readonly)

Returns the value of attribute money_raised_usd.



8
9
10
# File 'lib/crunchbase/model/funding_round.rb', line 8

def money_raised_usd
  @money_raised_usd
end

#newsObject (readonly)

Returns the value of attribute news.



14
15
16
# File 'lib/crunchbase/model/funding_round.rb', line 14

def news
  @news
end

#news_total_itemsObject (readonly)

Returns the value of attribute news_total_items.



16
17
18
# File 'lib/crunchbase/model/funding_round.rb', line 16

def news_total_items
  @news_total_items
end

Returns the value of attribute permalink.



8
9
10
# File 'lib/crunchbase/model/funding_round.rb', line 8

def permalink
  @permalink
end

#seriesObject (readonly)

Returns the value of attribute series.



8
9
10
# File 'lib/crunchbase/model/funding_round.rb', line 8

def series
  @series
end

#series_qualifierObject (readonly)

Returns the value of attribute series_qualifier.



8
9
10
# File 'lib/crunchbase/model/funding_round.rb', line 8

def series_qualifier
  @series_qualifier
end

#target_money_raisedObject (readonly)

Returns the value of attribute target_money_raised.



8
9
10
# File 'lib/crunchbase/model/funding_round.rb', line 8

def target_money_raised
  @target_money_raised
end

#target_money_raised_currency_codeObject (readonly)

Returns the value of attribute target_money_raised_currency_code.



8
9
10
# File 'lib/crunchbase/model/funding_round.rb', line 8

def target_money_raised_currency_code
  @target_money_raised_currency_code
end

#target_money_raised_usdObject (readonly)

Returns the value of attribute target_money_raised_usd.



8
9
10
# File 'lib/crunchbase/model/funding_round.rb', line 8

def target_money_raised_usd
  @target_money_raised_usd
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



8
9
10
# File 'lib/crunchbase/model/funding_round.rb', line 8

def updated_at
  @updated_at
end

#videosObject (readonly)

Returns the value of attribute videos.



14
15
16
# File 'lib/crunchbase/model/funding_round.rb', line 14

def videos
  @videos
end

#videos_total_itemsObject (readonly)

Returns the value of attribute videos_total_items.



16
17
18
# File 'lib/crunchbase/model/funding_round.rb', line 16

def videos_total_items
  @videos_total_items
end

#web_pathObject (readonly)

Returns the value of attribute web_path.



8
9
10
# File 'lib/crunchbase/model/funding_round.rb', line 8

def web_path
  @web_path
end

Instance Method Details

#date_keysObject



61
62
63
# File 'lib/crunchbase/model/funding_round.rb', line 61

def date_keys
  %w(announced_on closed_on)
end

#property_keysObject



51
52
53
54
55
56
57
58
59
# File 'lib/crunchbase/model/funding_round.rb', line 51

def property_keys
  %w(
    permalink api_path web_path funding_type series series_qualifier
    announced_on announced_on_trust_code closed_on closed_on_trust_code
    money_raised money_raised_currency_code money_raised_usd
    target_money_raised target_money_raised_currency_code target_money_raised_usd
    created_at updated_at
  )
end

#relationship_listsObject



41
42
43
44
45
46
47
48
49
# File 'lib/crunchbase/model/funding_round.rb', line 41

def relationship_lists
  {
    'investments' => Investment,
    'images' => Image,
    'videos' => Video,
    'news' => New,
    'investors' => Investor
  }
end

#relationship_with_funded(funded_organization) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/crunchbase/model/funding_round.rb', line 28

def relationship_with_funded(funded_organization)
  return if funded_organization.nil?

  if funded_organization['item'].nil?
    # Get organization's  (investments - funding - organization)
    instance_relationships_object(Organization, 'funded_organization', funded_organization)
  else
    # Get funding-rounds (funded_organization - item)

    set_relationships_object(Organization, 'funded_organization', funded_organization)
  end
end