Project

fb-support

0.01
No release in over 3 years
Low commit activity in last 3 years
Fb::Support provides common functionality to Fb, Fb::Auth. It is considered suitable for internal use only at this time.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.14
~> 0.8.20
~> 0.2.4
~> 12.0
~> 3.5
~> 0.9.12
 Project Readme

Common code needed by the other Fb gems

Fb::Support provides common functionality to all Fb gems. It is considered suitable for internal use only at this time.

The source code is available on GitHub and the documentation on RubyDoc.

Build Status Coverage Status Dependency Status Code Climate Online docs Gem Version

Fb::Support provides:

Response callback

Fb::HTTPRequest has an on_response callback which is invoked with the request object and the HTTP response object on a successful response. This can be used for introspecting responses, performing some action when rate limit is near, etc.

Fb::HTTPRequest.on_response = lambda do |request, response|
  usage = request.rate_limiting_header
  Librato.measure 'fb.call_count', usage['call_count']
  Librato.measure 'fb.total_cputime', usage['total_cputime']
  Librato.measure 'fb.total_time', usage['total_time']
  if usage.values.any? {|value| value > 85 }
    sleep 180
  end
end

How to test

In order to run the tests you need to have one Facebook access token and set it as an environment variable:

export FB_TEST_ACCESS_TOKEN="5040|67b895"

There are many documented ways to generate a test access token. The easiest way is probably to:

  • create a Facebook app
  • copy its app Id and app Secret
  • join them as "app-id|app-secret"… that is a valid access token!

How to contribute

Contribute to the code by forking the project, adding the missing code, writing the appropriate tests and submitting a pull request.

In order for a PR to be approved, all the tests need to pass and all the public methods need to be documented and listed in the guides. Remember:

  • to run all tests locally: bundle exec rspec
  • to generate the docs locally: bundle exec yard
  • to list undocumented methods: bundle exec yard stats --list-undoc

Thanks 🎉