Sha256: f0a4604ced3e1f540c64cc5c083bfe5561be1f61cb75b70ab3c78a7e6d511341
Contents?: true
Size: 926 Bytes
Versions: 1
Compression:
Stored size: 926 Bytes
Contents
require 'rss' require 'openssl' require 'open-uri' module Gns class GithubAtom def initialize(url, start_time = Time.now) @url = url @last_updated = start_time end def recent_items get_atom_items.find_all {|item| item.updated > @last_updated }.tap {|items| @last_updated = items.first.updated if items.first } end def get_atom_items RSS::Parser.parse(open(@url, ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE)).items.map {|item| GithubItem.new(item) } end end class GithubItem attr_reader :updated, :title, :url, :body, :repo def initialize(atom_item) @updated = atom_item.updated.content @title = atom_item.title.content @url = atom_item.link.href atom_item.content.content =~ /<p>(.*)<\/p>/ @body = $1 atom_item.content.content =~ /<a.*>(.*)<\/a>/ @repo = $1 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gns-0.0.1 | lib/gns/github_atom.rb |