Class: Pastie::Request
- Inherits:
-
Object
- Object
- Pastie::Request
- Defined in:
- lib/pastie-api/request.rb
Class Method Summary collapse
-
.fetch(link) ⇒ Object
Returns response body of specified link.
Class Method Details
.fetch(link) ⇒ Object
Returns response body of specified link
4 5 6 7 8 9 10 |
# File 'lib/pastie-api/request.rb', line 4 def self.fetch(link) url = URI.parse(link) resp = Net::HTTP.start(url.host, url.port) do |http| http.get(url.path + "?" + url.query.to_s) end return resp.body if resp.kind_of?(Net::HTTPOK) end |