<commit_before>Faraday Middleware
==================

A collection of some useful [Faraday](http://github.com/technoweenie/faraday) middleware

Installation
------------
    gem install faraday_middleware

Examples
--------
Let's decode the response body with [MultiJson](http://github.com/intridea/multi_json)!

    connection = Faraday.new(:url => 'http://api.twitter.com/1') do |builder|
      builder.use Faraday::Response::ParseJson
      builder.adapter Faraday.default_adapter
    end

    response = connection.get do |request|
      request.url '/users/show.json', :screen_name => 'pengwynn'
    end

    u = response.body
    u['name']
    # => "<NAME>"

Want to ditch the brackets and use dot notation? [Mashify](http://github.com/intridea/hashie) it!

    connection = Faraday.new(:url => 'http://api.twitter.com/1') do |builder|
      builder.use Faraday::Response::Mashify
      builder.use Faraday::Response::ParseJson
      builder.adapter Faraday.default_adapter
    end

    response = connection.get do |request|
      request.url '/users/show.json', :screen_name => 'pengwynn'
    end

    u = response.body
    u.name
    # => "<NAME>"<commit_msg>Convert all GitHub links to HTTPS<commit_after>Faraday Middleware
==================

A collection of some useful [Faraday](https://github.com/technoweenie/faraday) middleware

Installation
------------
    gem install faraday_middleware

Examples
--------
Let's decode the response body with [MultiJson](https://github.com/intridea/multi_json)!

    connection = Faraday.new(:url => 'http://api.twitter.com/1') do |builder|
      builder.use Faraday::Response::ParseJson
      builder.adapter Faraday.default_adapter
    end

    response = connection.get do |request|
      request.url '/users/show.json', :screen_name => 'pengwynn'
    end

    u = response.body
    u['name']
    # => "<NAME>"

Want to ditch the brackets and use dot notation? [Mashify](https://github.com/intridea/hashie) it!

    connection = Faraday.new(:url => 'http://api.twitter.com/1') do |builder|
      builder.use Faraday::Response::Mashify
      builder.use Faraday::Response::ParseJson
      builder.adapter Faraday.default_adapter
    end

    response = connection.get do |request|
      request.url '/users/show.json', :screen_name => 'pengwynn'
    end

    u = response.body
    u.name
    # => "<NAME>"
{'fraction_non_alphanumeric': 0.15515048749470114, 'fraction_numerical': 0.001695633743111488, 'mean_word_length': 3.2446043165467624, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5743544', 'n_tokens_mistral': 760, 'n_tokens_neox': 704, 'n_words': 164}