Class: Yajl::HttpStream

Inherits:
Object show all
Defined in:
lib/yajl/http_stream.rb

Overview

This module is for making HTTP requests to which the response bodies (and possibly requests in the near future) are streamed directly into Yajl.

Defined Under Namespace

Classes: InvalidContentType

Constant Summary collapse

ALLOWED_MIME_TYPES =

The mime-type we expect the response to be. If it’s anything else, we can’t parse it and an InvalidContentType is raised.

["application/json", "text/plain"]

Class Method Summary collapse

Class Method Details

.delete(uri, opts = {}, &block) ⇒ Object

Makes a basic HTTP DELETE request to the URI provided



34
35
36
# File 'lib/yajl/http_stream.rb', line 34

def self.delete(uri, opts = {}, &block)
  request("DELETE", uri, opts, &block)
end

.get(uri, opts = {}, &block) ⇒ Object

Makes a basic HTTP GET request to the URI provided



19
20
21
# File 'lib/yajl/http_stream.rb', line 19

def self.get(uri, opts = {}, &block)
  request("GET", uri, opts, &block)
end

.post(uri, body, opts = {}, &block) ⇒ Object

Makes a basic HTTP POST request to the URI provided



24
25
26
# File 'lib/yajl/http_stream.rb', line 24

def self.post(uri, body, opts = {}, &block)
  request("POST", uri, opts.merge({:body => body}), &block)
end

.put(uri, body, opts = {}, &block) ⇒ Object

Makes a basic HTTP PUT request to the URI provided



29
30
31
# File 'lib/yajl/http_stream.rb', line 29

def self.put(uri, body, opts = {}, &block)
  request("PUT", uri, opts.merge({:body => body}), &block)
end