Sha256: 114294c18b618a94503dfb48261a036acf7e94128f369c793f2ec17c905b51b3

Contents?: true

Size: 654 Bytes

Versions: 2

Compression:

Stored size: 654 Bytes

Contents

require 'typhoeus'
require 'uri'

module PRSS
  class Feed
    PERSONAL_FEED_URL = "https://hdbits.org/rss/my"

    attr_reader :uri

    def initialize(passkey)
      #@passkey = passkey
      @uri = URI(PERSONAL_FEED_URL)
      @uri.query = "passkey=#{passkey}"
    end

    def response
      Typhoeus::Request.get(@uri.to_s).tap do |response|
        puts "Fetched #{@uri} in #{response.total_time}s"
      end
    end

    def output
      response.body
    end

    def links
      Links.new(output)
    end

    def download_to(output)
      downloader.download_to(output)
    end

    def downloader
      Downloader.new(links)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
prss-0.1.1 lib/prss/feed.rb
prss-0.1.0 lib/prss/feed.rb