Method: Zold::Http#put

Defined in:
lib/zold/http.rb

#put(file) ⇒ Object



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/zold/http.rb', line 142

def put(file)
  HttpResponse.new(
    Typhoeus::Request.put(
      @uri,
      accept_encoding: 'gzip',
      body: IO.read(file),
      headers: headers.merge(
        'Content-Type': 'text/plain'
      ),
      connecttimeout: CONNECT_TIMEOUT,
      timeout: 2 + File.size(file) * 0.01 / 1024
    )
  )
rescue StandardError => e
  HttpError.new(e)
end