Class: Net::HTTP::Protocol

Inherits:
Object
  • Object
show all
Defined in:
lib/gist_store/net_http_ext.rb

Overview

Instance Method Summary collapse

Instance Method Details

#patch(path, data, initheader = nil, dest = nil, &block) ⇒ Object

Sends a PATCH request to the path and gets a response, as an HTTPResponse object.



11
12
13
# File 'lib/gist_store/net_http_ext.rb', line 11

def patch(path, data, initheader = nil, dest = nil, &block) # :yield: +body_segment+
  send_entity(path, data, initheader, dest, Patch, &block)
end

#send_entity(path, data, initheader, dest, type, &block) ⇒ Object

Executes a request which uses a representation and returns its body.



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/gist_store/net_http_ext.rb', line 17

def send_entity(path, data, initheader, dest, type, &block)
  res = nil
  request(type.new(path, initheader), data) {|r|
    r.read_body dest, &block
    res = r
  }
  unless @newimpl
    res.value
    return res, res.body
  end
  res
end