Sha256: 43d736930c21cd7ed7d94aa7e9fc08357f8773bcaebbbef9c3973bbac5215c70

Contents?: true

Size: 784 Bytes

Versions: 2

Compression:

Stored size: 784 Bytes

Contents

require 'ting_yun/http/abstract_request'
module TingYun
  module Http
    class HttpClientRequest < AbstractRequest
      attr_reader :method, :header

      def initialize(proxy, *args, &block)
        @method, @uri, @query, @body, @header = args
        @proxy = proxy
        @block = block
      end

      def type
        'HTTPClient'
      end

      def from
        "http_client%2Fhttp"
      end

      def [](key)
        @header[key]
      end

      def []=(key, value)
        @header[key] = value
      end

      def uri
        return @uri if @uri.scheme && @uri.host && @uri.port
        URI("#{@proxy.scheme.downcase}://#{@proxy.host}:#{@proxy.port}#{@uri}")
      end

      def args
        return @method, @uri, @query, @body, @header
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tingyun_rpm-1.6.1 lib/ting_yun/http/http_client_request.rb
tingyun_rpm-1.5.0 lib/ting_yun/http/http_client_request.rb