Class: Crunchbase::FirmRelationship

Inherits:
Relationship show all
Defined in:
lib/crunchbase/relationships/firm_relationship.rb

Instance Attribute Summary collapse

Attributes inherited from Relationship

#title

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Relationship

#current?, #is_past?

Constructor Details

#initialize(hash) ⇒ FirmRelationship

Returns a new instance of FirmRelationship.



10
11
12
13
14
15
# File 'lib/crunchbase/relationships/firm_relationship.rb', line 10

def initialize(hash)
  super(hash)
  @firm_name = hash["firm"]["name"]
  @firm_permalink = hash["firm"]["permalink"]
  @firm_type = hash["firm"]["type_of_entity"]
end

Instance Attribute Details

#firm_nameObject (readonly)

Returns the value of attribute firm_name.



4
5
6
# File 'lib/crunchbase/relationships/firm_relationship.rb', line 4

def firm_name
  @firm_name
end

Returns the value of attribute firm_permalink.



4
5
6
# File 'lib/crunchbase/relationships/firm_relationship.rb', line 4

def firm_permalink
  @firm_permalink
end

#firm_typeObject (readonly)

Returns the value of attribute firm_type.



4
5
6
# File 'lib/crunchbase/relationships/firm_relationship.rb', line 4

def firm_type
  @firm_type
end

Class Method Details

.array_from_relationship_listObject

:nodoc:

Raises:



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

def self.array_from_relationship_list #:nodoc:
  raise CrunchException, "Method must be called from superclass Relationship"
end

Instance Method Details

#firm(force_reload = false) ⇒ Object

Returns a representation of the associated firm, loading from memory if previously fetched, unless force_reload is set to true.



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/crunchbase/relationships/firm_relationship.rb', line 19

def firm(force_reload=false)
  return @firm unless @firm.nil? || force_reload
  @firm = case @firm_type
  when "company"
    Company.get(@firm_permalink)
  when "financial_org"
    FinancialOrganization.get(@firm_permalink)
  else
    raise CrunchException, "Not implemented"
  end
  return @firm
end