Sha256: ece0414778bf29db91b34fc6de1e563981b171dfc844fd85a360811118185fac

Contents?: true

Size: 618 Bytes

Versions: 1

Compression:

Stored size: 618 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'rubygems'

class MKItClient

  VERBS = %w{GET POST PUT DELETE}
  def usage
    puts 
    puts  "usage: mkitc <verb> <path>"
    puts  "  where <verb> is one of GET | POST | PUT | DELETE"
    puts  "e.g."
    puts  "  mkitc GET applications"
    puts 
  end

  def run
    if ARGV.size < 2 || VERBS.index(ARGV[0]).nil?
      usage
      exit 1
    end

    response = %x{curl -sL -X #{ARGV[0]} http://localhost:4567/#{ARGV[1]} #{ARGV[2]} #{ARGV[3]} #{ARGV[4]} #{ARGV[5]} #{ARGV[6]} #{ARGV[7]}}
    puts response
  end
end

client = MKItClient.new
client.run

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mkit-0.2.0 bin/mkitc