Sha256: 5d9ebed6b4d5297f994368f79f3997513470b193faabafd84d6ba486efde0ece
Contents?: true
Size: 1.04 KB
Versions: 7
Compression:
Stored size: 1.04 KB
Contents
module OpenBD class OpenbdCLI def initialize(argv) @argv = argv parse_option end def call if method_name.nil? puts @opts elsif params.empty? client = ::OpenBD::Client.new puts client.send(method_name).body.to_json else client = ::OpenBD::Client.new puts client.send(method_name, params).body.to_json end end private def method_name @argv[0] end def params @argv[1..-1] end def parse_option @opts = ::Slop.parse do |o| o.banner = <<-EOB Usage: openbd <method> [arguments] [options] Supported <method>: get Find book data by ISBN(s) bulk_get Find book data by ISBN(s) coverage Show all ISBNs in openBD schema Show the JSON Schema of openBD EOB o.on '-v', '--version', 'print the version' do puts "openbd_api #{OpenBD::VERSION}" exit end o.on '-h', '--help', 'print help' do puts o exit end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems