Class: Crunchbase::Product

Inherits:
CBEntity show all
Defined in:
lib/crunchbase/product.rb

Constant Summary collapse

RESOURCE_NAME =
'product'
RESOURCE_LIST =
'products'

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(json) ⇒ Product

Returns a new instance of Product.



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

def initialize(json)
  @type_name          = json['type']
  properties          = json['properties']
  relationships       = json['relationships']
  
  @name               = properties['name']
  @lifecycle_stage    = properties['lifecycle_stage']
  @owner_id           = properties['owner_id'] # Maybe removed
  @owner_name         = properties['owner_name']
  @owner_path         = properties['owner_path']
  @short_description  = properties['short_description']
  @permalink          = properties['permalink']
  @homepage_url       = properties['homepage_url']
  @description        = properties['description']
  @launched_on        = properties['launched_on'] && DateTime.parse(properties['launched_on'])
  @created_at         = Time.at(properties['created_at']).utc
  @updated_at         = Time.at(properties['updated_at']).utc
  @launched_on_trust_code = properties['launched_on_trust_code']


  @primary_images_list  = relationships['primary_image']
  @images_list          = relationships['images']
  @websites_list        = relationships['websites']
  @new_items_list       = relationships['news']
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



13
14
15
# File 'lib/crunchbase/product.rb', line 13

def created_at
  @created_at
end

#descriptionObject (readonly)

Returns the value of attribute description.



13
14
15
# File 'lib/crunchbase/product.rb', line 13

def description
  @description
end

#homepage_urlObject (readonly)

Returns the value of attribute homepage_url.



13
14
15
# File 'lib/crunchbase/product.rb', line 13

def homepage_url
  @homepage_url
end

#imagesObject (readonly)

Returns the value of attribute images.



17
18
19
# File 'lib/crunchbase/product.rb', line 17

def images
  @images
end

#images_total_itemsObject (readonly)

Returns the value of attribute images_total_items.



18
19
20
# File 'lib/crunchbase/product.rb', line 18

def images_total_items
  @images_total_items
end

#launched_onObject (readonly)

Returns the value of attribute launched_on.



13
14
15
# File 'lib/crunchbase/product.rb', line 13

def launched_on
  @launched_on
end

#launched_on_trust_codeObject (readonly)

Returns the value of attribute launched_on_trust_code.



13
14
15
# File 'lib/crunchbase/product.rb', line 13

def launched_on_trust_code
  @launched_on_trust_code
end

#lifecycle_stageObject (readonly)

Returns the value of attribute lifecycle_stage.



13
14
15
# File 'lib/crunchbase/product.rb', line 13

def lifecycle_stage
  @lifecycle_stage
end

#nameObject (readonly)

Returns the value of attribute name.



13
14
15
# File 'lib/crunchbase/product.rb', line 13

def name
  @name
end

#new_itemsObject (readonly)

Returns the value of attribute new_items.



17
18
19
# File 'lib/crunchbase/product.rb', line 17

def new_items
  @new_items
end

#new_items_total_itemsObject (readonly)

Returns the value of attribute new_items_total_items.



18
19
20
# File 'lib/crunchbase/product.rb', line 18

def new_items_total_items
  @new_items_total_items
end

#owner_idObject (readonly)

Returns the value of attribute owner_id.



13
14
15
# File 'lib/crunchbase/product.rb', line 13

def owner_id
  @owner_id
end

#owner_nameObject (readonly)

Returns the value of attribute owner_name.



13
14
15
# File 'lib/crunchbase/product.rb', line 13

def owner_name
  @owner_name
end

#owner_pathObject (readonly)

Returns the value of attribute owner_path.



13
14
15
# File 'lib/crunchbase/product.rb', line 13

def owner_path
  @owner_path
end

Returns the value of attribute permalink.



13
14
15
# File 'lib/crunchbase/product.rb', line 13

def permalink
  @permalink
end

#primary_imagesObject (readonly)

Returns the value of attribute primary_images.



17
18
19
# File 'lib/crunchbase/product.rb', line 17

def primary_images
  @primary_images
end

#primary_images_total_itemsObject (readonly)

Returns the value of attribute primary_images_total_items.



18
19
20
# File 'lib/crunchbase/product.rb', line 18

def primary_images_total_items
  @primary_images_total_items
end

#short_descriptionObject (readonly)

Returns the value of attribute short_description.



13
14
15
# File 'lib/crunchbase/product.rb', line 13

def short_description
  @short_description
end

#type_nameObject (readonly)

Returns the value of attribute type_name.



13
14
15
# File 'lib/crunchbase/product.rb', line 13

def type_name
  @type_name
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



13
14
15
# File 'lib/crunchbase/product.rb', line 13

def updated_at
  @updated_at
end

#websitesObject (readonly)

Returns the value of attribute websites.



17
18
19
# File 'lib/crunchbase/product.rb', line 17

def websites
  @websites
end

#websites_total_itemsObject (readonly)

Returns the value of attribute websites_total_items.



18
19
20
# File 'lib/crunchbase/product.rb', line 18

def websites_total_items
  @websites_total_items
end