Class: Crunchbase::Product

Inherits:
CB_Object show all
Includes:
DateMethods
Defined in:
lib/crunchbase/product.rb

Constant Summary collapse

ENT_NAME =
"product"
ENT_PLURAL =
"products"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DateMethods

#date_from_components

Methods inherited from CB_Object

#===, #aliases, all, find, get, #tags

Constructor Details

#initialize(json) ⇒ Product

Returns a new instance of Product.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/crunchbase/product.rb', line 16

def initialize(json)
  @name = json['name']
  @permalink = json['permalink']
  @crunchbase_url = json['crunchbase_url']
  @homepage_url = json['homepage_url']
  @blog_url = json['blog_url']
  @blog_feed_url = json['blog_feed_url']
  @twitter_username = json['twitter_username']
  @stage_code = json['stage_code']
  @deadpooled_url = json['deadpooled_url']
  @invite_share_url = json['invite_share_url']
  @tag_list = json['tag_list']
  @alias_list = json['alias_list']
  @deadpooled_year = json['deadpooled_year']
  @deadpooled_month = json['deadpooled_month']
  @deadpooled_day = json['deadpooled_day']
  @launched_year = json['launched_year']
  @launched_month = json['launched_month']
  @launched_day = json['launched_day']
  @created_at = DateTime.parse(json['created_at'])
  @updated_at = DateTime.parse(json['updated_at'])
  @overview = json['overview']
  @image = json['image']
  @company_permalink = json['company']['permalink']
  @company_name = json['company']['name']
  @milestones = json['milestones']
  @video_embeds = json['video_embeds']
  @external_links = json['external_links']
end

Instance Attribute Details

#blog_feed_urlObject (readonly)

Returns the value of attribute blog_feed_url.



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

def blog_feed_url
  @blog_feed_url
end

#blog_urlObject (readonly)

Returns the value of attribute blog_url.



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

def blog_url
  @blog_url
end

#company_nameObject (readonly)

Returns the value of attribute company_name.



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

def company_name
  @company_name
end

Returns the value of attribute company_permalink.



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

def company_permalink
  @company_permalink
end

#created_atObject (readonly)

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#crunchbase_urlObject (readonly)

Returns the value of attribute crunchbase_url.



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

def crunchbase_url
  @crunchbase_url
end

#deadpooled_urlObject (readonly)

Returns the value of attribute deadpooled_url.



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

def deadpooled_url
  @deadpooled_url
end

Returns the value of attribute external_links.



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

def external_links
  @external_links
end

#homepage_urlObject (readonly)

Returns the value of attribute homepage_url.



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

def homepage_url
  @homepage_url
end

#imageObject (readonly)

Returns the value of attribute image.



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

def image
  @image
end

#invite_share_urlObject (readonly)

Returns the value of attribute invite_share_url.



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

def invite_share_url
  @invite_share_url
end

#milestonesObject (readonly)

Returns the value of attribute milestones.



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

def milestones
  @milestones
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#overviewObject (readonly)

Returns the value of attribute overview.



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

def overview
  @overview
end

Returns the value of attribute permalink.



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

def permalink
  @permalink
end

#stage_codeObject (readonly)

Returns the value of attribute stage_code.



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

def stage_code
  @stage_code
end

#twitter_usernameObject (readonly)

Returns the value of attribute twitter_username.



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

def twitter_username
  @twitter_username
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



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

def updated_at
  @updated_at
end

#video_embedsObject (readonly)

Returns the value of attribute video_embeds.



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

def video_embeds
  @video_embeds
end

Instance Method Details

#company(force_reload = false) ⇒ Object

Lazy-loads the associated Company entity and caches it. Pass true to force reload.



58
59
60
61
62
# File 'lib/crunchbase/product.rb', line 58

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

#deadpooledObject

Returns the date the product was deadpooled, or nil if not provided.



47
48
49
# File 'lib/crunchbase/product.rb', line 47

def deadpooled
  @deadpooled ||= date_from_components(@deadpooled_year, @deadpooled_month, @deadpooled_day)
end

#launchedObject

Returns the date the product was launched, or nil if not provided.



52
53
54
# File 'lib/crunchbase/product.rb', line 52

def launched
  @launched ||= date_from_components(@launched_year, @launched_month, @launched_day)
end