Sha256: f7905562da1ddf81aa60118ddb3f473f48cd3c438f64b76783f38ca92abf9f21

Contents?: true

Size: 872 Bytes

Versions: 1

Compression:

Stored size: 872 Bytes

Contents

module Onering
  module CLI
    module Call
      def self.configure(global={})
        @api = Onering::CLI.connect(global)

        @opts = ::Trollop::options do
          banner <<-EOS
Call an arbitrary Onering API endpoint and return the output

Usage:
    onering call [options] [endpoint]

Examples:
    # Returns the API status page at path /api/
    $ onering call /

    # Returns details about the authenticated user
    $ onering call users/current

    # Delete the device called '0bf29c'
    $ onering call devices/0bf29c -m delete

Options:
EOS
          opt :method, "The HTTP method to use when performing the request", :default => 'get', :short => "-m", :type => :string
        end
      end

      def self.run(args)
        rv = @api.request(@opts[:method], args.first)
        return (rv.parsed_response || rv.response.body)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
onering-client-0.0.56 lib/onering/cli/call.rb