treenode.rb
# HTTP Request builder for Crashplan API
HTTP Request builder for Crashplan API
HTTP Request builder for Crashplan API
def http_request(req, headers={})
  if headers.has_key?("username") && headers.has_key?("password")
    req.basic_auth(headers.delete("username"), headers.delete("password"))
  end
  req['Content-Type'] = "application/json; charset=UTF-8"
  headers.each{|k,v| req[k] = v}
  return Net::HTTP.start(req.uri.hostname, req.uri.port,:use_ssl => req.uri.scheme == 'https') {|http|
    http.request(req)
  }
end
def http_request ( req , headers = { } ) if headers . has_key? ( "username" ) && headers . has_key? ( "password" ) req . basic_auth ( headers . delete ( "username" ) , headers . delete ( "password" ) ) end req [ 'Content-Type' ] = "application/json; charset=UTF-8" headers . each { | k , v | req [ k ] = v } return Net :: HTTP . start ( req . uri . hostname , req . uri . port , :use_ssl => req . uri . scheme == 'https' ) { | http | http . request ( req ) } end
HTTP Request builder for Crashplan API
HTTP Request builder for Crashplan API
req
<not_specific>
headers
<not_specific>