0.0
No commit activity in last 3 years
No release in over 3 years
Console line interface for faraday gem client so you can use your favorite middleware based ruby http client on the terminal!
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.10
>= 0
>= 0

Runtime

>= 0
 Project Readme

Faraday::Cli

Console line interface for faraday gem client so you can use your favorite middleware based ruby http client on the terminal!

Installation

Add this line to your application's Gemfile:

gem 'faraday-cli'

And then execute:

$ bundle

Or install it yourself as:

$ gem install faraday-cli

Usage

CLI options

Usage: faraday-cli [options] <url>
    -V, --version                    Show version number and quit
    -X, --request COMMAND            Specify http request command to use
    -H, --header HEADER:VALUE        Pass custom header LINE to server (H)
    -q, --query key=value            Pass Query key values to use in the request
    -d, --data PAYLOAD_STRING        HTTP POST data (H)
        --upload_file KEY=FILE_PATH[:CONTENT_TYPE]
                                     Pass File upload io in the request pointing to the given file
    -A, --user-agent STRING          Send User-Agent STRING to server (H)
    -o, --output FILE_PATH           Write to FILE instead of stdout
    -v, --verbose                    Make the operation more talkative
        --super-verbose              Make the operation even more talkative
    -s, --silent                     Silent mode (don't output anything)
    -K, --config FILE_PATH           File path to the .faraday.rb if you want use other than default
    -M, --middlewares                Show current middleware stack
    -W, --without_middlewares        Make request without consuming middleware file(s)

faraday-cli http://www.google.com -q q=foo
faraday-cli http://example.org -d "payload string"

Middleware use

You can use middlewares with ".faraday.rb" file. Put any middleware related configuration into the file, and use the 'use' method to include into the faraday connection.

you can use any faraday middlewares as how you pleased.

class MyAwesomeMiddleware < Faraday::Middleware

  def call(request_env)

    # before main request

    @app.call(request_env).on_complete do |response_env|

      # after main request
  
    end

  end 

end

use MyAwesomeMiddleware

By default it will look for the current runtime directory for this file. If you are in a project, than it will look for the project folder (Ruby project). If still nothing than for the last place to look it will check for Home folder to find a default middleware file.

With that you can use all kind of stuff out of the box with your faraday-cli, such as Amazon v3 authentication, or anything that is on the internet :D

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/faraday-cli. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.