Sha256: 799cce0ad77786df3937bf92c09fb997b3c90230f8689ebb84b53e912889c885
Contents?: true
Size: 488 Bytes
Versions: 1
Compression:
Stored size: 488 Bytes
Contents
require "dramavladimir/version" require 'nokogiri' require 'httpclient' require 'dramavladimir/repertoire' module Dramavladimir NotFound = Class.new StandardError Empty = Class.new StandardError def self.fetch(url) HTTPClient.new.get url, nil, { 'User-Agent'=>'a', 'Accept-Encoding'=>'a' } end def self.parse(url) p = fetch url raise(Empty) if p.http_body.content.size.zero? p.status == 200 ? Nokogiri::XML(p.body.encode('utf-8')) : raise(NotFound) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dramavladimir-0.1.0 | lib/dramavladimir.rb |