Class: Crunchbase::Relationship

Inherits:
CBEntity
  • Object
show all
Defined in:
lib/crunchbase/relationship.rb

Direct Known Subclasses

SearchResult

Constant Summary

Constants inherited from CBEntity

CBEntity::RELATIONSHIPS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from CBEntity

array_from_list, category_lists_by_permalink, #fetch, get, list, lists_for_permalink, lists_for_person_permalink, parsing_from_list, search, total_items_from_list

Constructor Details

#initialize(hash) ⇒ Relationship

Returns a new instance of Relationship.



10
11
12
13
14
15
16
17
18
# File 'lib/crunchbase/relationship.rb', line 10

def initialize(hash)
  @type_name    = hash["type"]
  @announced_on = hash["announced_on"] && DateTime.parse(hash["announced_on"])
  @name         = hash["name"]
  @path         = hash["path"]
  @permalink    = hash["path"] && hash["path"].split("/").last
  @created_at   = hash["created_at"] && (hash["created_at"].kind_of?(String) ? DateTime.parse(hash["created_at"]) : Time.at(hash["created_at"]).utc)
  @updated_at   = hash["updated_at"] && (hash["updated_at"].kind_of?(String) ? DateTime.parse(hash["updated_at"]) : Time.at(hash["updated_at"]).utc)
end

Instance Attribute Details

#announced_onObject (readonly)

Returns the value of attribute announced_on.



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

def announced_on
  @announced_on
end

#created_atObject (readonly)

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



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

def path
  @path
end

Returns the value of attribute permalink.



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

def permalink
  @permalink
end

#type_nameObject (readonly)

Returns the value of attribute type_name.



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

def type_name
  @type_name
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



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

def updated_at
  @updated_at
end