Class: HTTP::Patch

Inherits:
Request show all
Defined in:
lib/http_client/mri/methods.rb

Instance Attribute Summary

Attributes inherited from Request

#body, #encoding

Instance Method Summary collapse

Methods inherited from Request

#add_headers, #basic_auth, #content_type=, #execute_native_request, #initialize, #make_native_request

Constructor Details

This class inherits a constructor from HTTP::Request

Instance Method Details

#create_requestObject



88
89
90
91
92
# File 'lib/http_client/mri/methods.rb', line 88

def create_request
  host, port, path, query = parse_uri
  patch = Net::HTTP::Patch.new("#{path}?#{query || to_query_string(@params)}")
  [host, port, patch]
end

#to_query_string(params_as_hash) ⇒ Object



94
95
96
# File 'lib/http_client/mri/methods.rb', line 94

def to_query_string(params_as_hash)
  params_as_hash.map { |name, value| "#{URI.encode(name.to_s)}=#{URI.encode(value.to_s)}" }.join("&")
end