次のページで行うことと同じことを、ruby で行いました。
Bluemix の Cloudant に python3 で画像ファイルをアップロード
to_cloudant.rb
#! /usr/bin/ruby
# -*- encoding: utf-8 -*-
#
# to_cloudant.rb
#
# Jul/28/2017
#
require 'json'
require 'restclient'
#
# ---------------------------------------------------------------------
puts "*** 開始 ***"
#
url="https://44b508dd-f312-4f91-81f2-78369c7d29d9-bluemix:9dacdfdee142c2a5c16596fc621012e08a61e7132d3b21ecaaf1f63a835fae64@efc189dc-f332-4f91-81f2-72569c7d39d9-bluemix.cloudant.com"
#
#
url_collection = url + '/jpg'
RestClient.delete url_collection
RestClient.put url_collection, '{}'
#
keys=["A0001","A0002"]
#
keys.each {|key|
puts key
file_jpg = key + '.jpg'
url_target = url_collection + '/' + key + '/' + file_jpg
puts url_target
io = open(file_jpg,"rb")
image = io.read()
RestClient.put url_target, image
}
#
puts "*** 終了 ***"
#
# --------------------------------------------------------------------------