Sha256: 1130b02a3482a115da013973ca6a86c1a26f9d9ec49d34d8b91703276a4b769e

Contents?: true

Size: 850 Bytes

Versions: 4

Compression:

Stored size: 850 Bytes

Contents

# encoding: utf-8

# https://api.crunchbase.com/v/2/organization/#{permalink}/news

module Crunchbase
  class NewItem < CBEntity

    RESOURCE_LIST = 'news'

    attr_reader :type_name, :url, :author, :posted_on, :type, :title, :created_at, 
                :updated_at
                
    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
    
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
crunchbase_v2-1.1.6 lib/crunchbase/new_item.rb
crunchbase_v2-1.1.5 lib/crunchbase/new_item.rb
crunchbase_v2-1.1.4 lib/crunchbase/new_item.rb
crunchbase_v2-1.1.3 lib/crunchbase/new_item.rb