Method: HTTPAdapter#specialize_request

Defined in:
lib/httpadapter.rb

#specialize_request(request_ary) ⇒ Array

Converts a tuple to a specific HTTP implementation’s request format.

Parameters:

  • request_ary (Array)

    The request array to be converted. The request array must be a tuple with a length of 4. The first element must be the request method. The second element must be the URI. The URI may be relative. The third element contains the headers. It must respond to #each and iterate over the header names and values. The fourth element must be the body. It must respond to #each but may not be a String. It should emit String objects.

Returns:

  • (Array)

    The implementation-specific request object.



80
81
82
83
84
85
86
87
88
# File 'lib/httpadapter.rb', line 80

def specialize_request(request_ary)
  request = HTTPAdapter.verified_request(request_ary)
  if self.respond_to?(:convert_request_from_a)
    return self.convert_request_from_a(request)
  else
    raise TypeError,
      'Expected adapter to implement #convert_request_from_a.'
  end
end