No commit activity in last 3 years
No release in over 3 years
A Ruby gem to facilitate gathering contribution information from multiple ActBlue campaigns.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
~> 0.10
~> 0.2
~> 10.0
~> 3.0
~> 1.18

Runtime

 Project Readme

Code Climate Test Coverage Build Status Gem Version

ActBlueReporter

This is a Ruby gem designed to simplify getting contribution information from ActBlue. It is designed to work across multiple ActBlue campaigns.

It is not a full-fledged wrapper for the ActBlue API; it doesn't do much more than retrieve data.

Extracted from DonorStack.

Installation

Add this line to your application's Gemfile:

gem 'act_blue_reporter'

And then execute:

$ bundle

Or install it yourself as:

$ gem install act_blue_reporter

Usage

Create a campaign object. The login and password are the same as you use for the web interface. The entity ID can be obtained from the web interface. It is usually visible in the url. All three arguments are required.

campaign = ActBlueReporter::Campaign.new(act_blue_login: my_login, 
                                         act_blue_password: my_password, 
                                         act_blue_entity_id: my_id)

You can use the campaign object to get data.

# returns a hash of campaign details. Useful for checking credentials.
campaign.details

# returns a hash of all the campaign's contributions. Use with care. 
campaign.all_contributions

# returns the contributions in the previous day (24 hours)
campaign.contributions_in_last_24_hours

# returns contributions in a certain time range. Arguments must be
# ISO 8601 formatted strings. Defaults to the previous 24 hours if no 
# arguments are supplied
campaign.contributions_in_time_range(start_time: "2014-10-10T14:00:00-07:00", 
                                     end_time: "2014-10-12T14:00:00-07:00")

The structure of the response from ActBlue is different if there is one contribution, or more than one. In particular, responses containing multiple contributions are nested one level more than single contributions. This class abstracts that away and returns a predictable structure.

payload = campaign.all_contributions
formatter = ActBlueReporter::ContributionReport.new(payload: my_payload)
report = formatter.report

# you can also get the count of contributions from the formatter object
formatter.count

Contributing

  1. Fork it ( https://github.com/cdale77/act_blue_reporter/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request