App-Adenosine

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

Description

    Adenosine is a tiny script wrapper for curl <http://curl.haxx.se/>. It
    provides a simple, concise shell interface for interacting with REST
    <http://en.wikipedia.org/wiki/Representational_State_Transfer>
    services. Since it is just a command you run in your shell and not in
    its own separate command environment you have access to all the
    powerful shell tools, such as perl, awk, grep, sed, etc. You can use
    adenosine in pipelines to process data from REST services, and PUT or
    POST the data right back. You can even pipe the data in and then edit
    it interactively in your text editor prior to PUT or POST.

    Cookies are supported automatically and stored in a file locally. Most
    of the arguments are remembered from one call to the next to save
    typing. It has pretty good defaults for most purposes. Additionally,
    adenosine allows you to easily provide your own options to be passed
    directly to curl, so even the most complex requests can be accomplished
    with the minimum amount of command line pain.

    Here is a nice screencast showing adenosine (née resty) in action
    <http://jpmens.net/2010/04/26/resty/> (by Jan-Piet Mens).

Quick Start

 From git

    Grab the files from github:

          $ git clone http://github.com/frioux/app-adenosine-prefab

    Source the exports before using it. (You can put this line in your
    ~/.bashrc file if you want.)

          $ . app-adenosine-prefab/adenosine-exports

 From CPAN

    If you are a Perl user you can install adenosine from CPAN as follows:

          $ cpanm App::Adenosine

    And then source the function wrappers as follows:

          $ eval $(adenosine exports)

    Set the REST host to which you will be making your requests (you can do
    this whenever you want to change hosts, anytime).

          $ adenosine http://127.0.0.1:8080/data
          http://127.0.0.1:8080/data*

    Make some HTTP requests.

          $ GET /blogs.json
          [ {"id" : 1, "title" : "first post", "body" : "This is the first post"}, ... ]
    
          $ PUT /blogs/2.json '{"id" : 2, "title" : "updated post", "body" : "This is the new."}'
          {"id" : 2, "title" : "updated post", "body" : "This is the new."}
    
          $ DELETE /blogs/2
    
          $ POST /blogs.json '{"title" : "new post", "body" : "This is the new new."}'
          {"id" : 204, "title" : "new post", "body" : "This is the new new."}

What's Next?

    Check out some of the plugins available for adenosine! Right now
    there's just two, Rainbow and Stopwatch. To use them, edit the
    bin/adenosine file and uncomment the plugin lines.

Hacking!

    Want to add some features? Fork the frioux/app-adenosine repository and
    send pull requests!

A Work In Progress

    Adenosine was ported to Perl from resty
    <https://github.com/micha/resty> due to a number of issues
    <https://github.com/micha/resty/issues>. Because adenosine is not a
    simple shell function it does not use env vars as much, and so is less
    "persistent" than resty when it comes to various settings. I'm
    completely willing to fix this by wrapping adenosine with a small shell
    function that sets various environment variables, but I'd rather get it
    released with a few exciting features resty does not have. With that in
    mind, patches are always welcome. Please get in touch if you'd like one
    of the currently unsupported resty features to be fixed and I'll
    certainly do what I can to get it working. Any part of the doc marked
    with !!! is a place to look out for an imcompatibility.

Usage

          source adenosine-exports [-W] [remote] # load functions into shell         !!!
          adenosine [-v]                         # prints current request URI base   !!!
          adenosine <remote> [OPTIONS]           # sets the base request URI         !!!
    
          HEAD [path] [OPTIONS]                   # HEAD request
          OPTIONS [path] [OPTIONS]                # OPTIONS request
          GET [path] [OPTIONS]                    # GET request
          DELETE [path] [OPTIONS]                 # DELETE request
          PUT [path] [data] [OPTIONS]             # PUT request
          POST [path] [data] [OPTIONS]            # POST request
          TRACE [path] [OPTIONS]                  # TRACE request
          PATCH [path] [OPTIONS]                  # PATCH request
    
          Options:
    
          -Q            Don't URL encode the path.
          -q <query>    Send query string with the path. A '?' is prepended to
                        <query> and concatenated onto the <path>.
          -W            Don't write to history file (only when sourcing script).    !!!
          -V            Edit the input data interactively in 'vi'. (PUT and POST
                        requests only, with data piped to stdin.)
          -v            Verbose output. When used with the adenosine command itself
                        this prints the saved curl options along with the current
                        URI base. Otherwise this is passed to curl for verbose
                        curl output.
          <curl opt>    Any curl options will be passed down to curl.



( run in 2.531 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )