class Async::REST::Wrapper::URLEncoded

Constants

APPLICATION_FORM_URLENCODED

Attributes

content_type[R]

Public Class Methods

new(content_type = APPLICATION_FORM_URLENCODED) click to toggle source
# File lib/async/rest/wrapper/url_encoded.rb, line 36
def initialize(content_type = APPLICATION_FORM_URLENCODED)
        @content_type = content_type
end

Public Instance Methods

parser_for(response) click to toggle source
# File lib/async/rest/wrapper/url_encoded.rb, line 64
def parser_for(response)
        if content_type = response.headers['content-type']
                if content_type.start_with? @content_type
                        return Parser
                end
        end
        
        return super
end
prepare_request(payload, headers) click to toggle source
# File lib/async/rest/wrapper/url_encoded.rb, line 46
def prepare_request(payload, headers)
        headers['accept'] ||= @content_type
        
        if payload
                headers['content-type'] = @content_type
                
                ::Protocol::HTTP::Body::Buffered.new([
                        ::Protocol::HTTP::URL.encode(payload)
                ])
        end
end
split(*arguments) click to toggle source
# File lib/async/rest/wrapper/url_encoded.rb, line 42
def split(*arguments)
        @content_type.split
end