Class: Crunchbase::NewItem
- Defined in:
- lib/crunchbase/new_item.rb
Constant Summary collapse
- RESOURCE_LIST =
'news'
Constants inherited from CBEntity
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#posted_on ⇒ Object
readonly
Returns the value of attribute posted_on.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#type_name ⇒ Object
readonly
Returns the value of attribute type_name.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(json) ⇒ NewItem
constructor
A new instance of NewItem.
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) ⇒ NewItem
Returns a new instance of NewItem.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/crunchbase/new_item.rb', line 13 def initialize(json) @type_name = json['type'] @url = json['url'] @author = json['author'] @posted_on = json['posted_on'] && DateTime.parse(json['posted_on']) @title = json['title'] @created_at = Time.at(json['created_at']).utc unless json['updated_at'].blank? json['updated_at'] = (json['updated_at'].to_s + "-01-01").to_datetime.to_i if json['updated_at'].to_s.length == 4 @updated_at = Time.at(json['updated_at']).utc end end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
10 11 12 |
# File 'lib/crunchbase/new_item.rb', line 10 def @author end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
10 11 12 |
# File 'lib/crunchbase/new_item.rb', line 10 def created_at @created_at end |
#posted_on ⇒ Object (readonly)
Returns the value of attribute posted_on.
10 11 12 |
# File 'lib/crunchbase/new_item.rb', line 10 def posted_on @posted_on end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
10 11 12 |
# File 'lib/crunchbase/new_item.rb', line 10 def title @title end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
10 11 12 |
# File 'lib/crunchbase/new_item.rb', line 10 def type @type end |
#type_name ⇒ Object (readonly)
Returns the value of attribute type_name.
10 11 12 |
# File 'lib/crunchbase/new_item.rb', line 10 def type_name @type_name end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
10 11 12 |
# File 'lib/crunchbase/new_item.rb', line 10 def updated_at @updated_at end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
10 11 12 |
# File 'lib/crunchbase/new_item.rb', line 10 def url @url end |