Help us understand the problem. What is going on with this article?

Ruby: CouchDB のデータを削除 (Delete)

couch_delete.rb
#! /usr/bin/ruby
# -*- encoding: utf-8 -*-
#
#   couch_delete.rb
#
#                   Jul/31/2020
#
# ---------------------------------------------------------------------
require 'faraday'
require 'json'
#
# ---------------------------------------------------------------------
STDERR.puts "*** 開始 ***"
#
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 "*** 終了 ***"
# ---------------------------------------------------------------------

実行

./couch_delete.rb t2026
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away