GithubHelp home page GithubHelp logo

isabella232 / faraday-middleware-template Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lostisland/faraday-middleware-template

0.0 0.0 0.0 28 KB

Template for creating new Faraday Middleware. This uses gem_generator, and is a gem_generator template.

Ruby 51.16% Shell 2.91% HTML 45.93%

faraday-middleware-template's Introduction

Faraday Middleware Template

This repo is a template for building Faraday middleware. Faraday is an HTTP client library that provides a common interface for making requests. This interface allows classes to be loaded into the request/response lifecycle to provide common functionality such as authentication, parsing, encoding, and much more. These classes are called middleware. Use this repository to create your own middleware gem.

Getting Started

Preparing

This is a gem_generator template, so firstly you have to install it:

gem install gem_generator

Usage

The next step is for you to generate a new Faraday middleware via gem_generator call.

First of all, you should decide on the name of your middleware. The current convention (which is by no means mandatory) is to call middleware gems as faraday-<something>. Here are some examples:

Then, you should call the generation command, like this:

gem_generator faraday-my_middleware lostisland/faraday-middleware-template --git

More usage info and options you can get by gem_generator --help or in the gem_generator README.

There are placeholders in this repository with template for your chosen middleware name. So once you decide on the final name you want to use and ran the generation command โ€” you will see all occurrences of MyMiddleware and my_middleware in all files with and their names with the name you chose.

Also please notice: your name and email will be mentioned in *.gemspec file and LICENSE.md. By default, they're taken from git config, but you can also specify them in a gem_generator config file (in the home directory, for example).

Basic implementation

The bulk of the implementation is in the Faraday::MyMiddleware::Middleware class. We've added lots of comments in there to guide you through it, but if you have any doubt/question please don't hesitate to get in touch!

faraday-middleware-template's People

Contributors

alexwayfer avatar olleolleolle avatar sue445 avatar imactia avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.