couch_delete.rb
#! /usr/bin/ruby
# -*- encoding: utf-8 -*-
#
# couch_delete.rb
#
# Jul/31/2020
#
# ---------------------------------------------------------------------
require 'faraday'
require 'json'
#
# ---------------------------------------------------------------------
STDERR.puts "***début***"
#
key_in = ARGV[0]
puts key_in
URL="http://localhost:5984/nagano/" + key_in
#
res = Faraday.get URL
puts res.status
if res.status == 200 then
json_str = res.body
data_aa=JSON.parse(json_str)
#
puts data_aa
puts data_aa["_rev"]
#
url_del = URL + "?rev=" + data_aa["_rev"]
res = Faraday.delete url_del
puts res.status
end
STDERR.puts "***Fin***"
# ---------------------------------------------------------------------
Courir
./couch_delete.rb t2026
Recommended Posts