Sha256: 1124d1fe4d23ebb13abc9cca1ad228b3533382293a884aee071e84beef7d04ac
Contents?: true
Size: 1.39 KB
Versions: 3
Compression:
Stored size: 1.39 KB
Contents
require 'httparty' require 'openssl' require 'aws/core/response' ## # Monkey-patch body_stream usage into HTTParty ## module HTTParty class Request private def setup_raw_request @raw_request = http_method.new(uri.request_uri) if body if body.respond_to?(:read) @raw_request.body_stream = body else @raw_request.body = body end end @raw_request.initialize_http_header(options[:headers]) @raw_request.basic_auth(username, password) if options[:basic_auth] setup_digest_auth if options[:digest_auth] end end end module AWS ## # Custom response parser to handle the various craziness of the AWS API ## class SimpleAWSParser < HTTParty::Parser def parse if supports_format? super elsif body =~ %r{<\?xml} xml else body end end end class HTTP include HTTParty parser SimpleAWSParser end ## # Handles all communication to and from AWS itself ## class Connection ## # Send an AWS::Request to AWS proper, returning an AWS::Response. # Will raise if the request has an error ## def call(request) AWS::Response.new( HTTP.send(request.method, request.uri, :query => request.params, :headers => request.headers, :body => request.body ) ) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
simple_aws-1.0.0 | lib/aws/core/connection.rb |
simple_aws-1.0.0.pre3 | lib/aws/core/connection.rb |
simple_aws-1.0.0.pre2 | lib/aws/core/connection.rb |