No commit activity in last 3 years
No release in over 3 years
Client library for pulling data from a Pwnalytics server
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0.0
~> 1.5.2
>= 0
~> 2.5.0

Runtime

>= 1.0.0
>= 1.0.0
 Project Readme

pwnalytics_client¶ ↑

Ruby gem providing a client for the Pwnalytics REST API.

Usage¶ ↑

First, create a PwnalyticsClient pointing to your Pwnalytics instance:

client = PwnalyticsClient.new :host => 'localhost', :port => 3000,
                              :user => 'config', :password => 'vars'

Or, if you’re using SSL:

client = PwnalyticsClient.new :host => 'localhost', :port => 3000,
                              :user => 'config', :password => 'vars',
                              :ssl => true,
                              :net_http => { :ca_path => '/etc/ssl/certs' }

Get the site that you want data for:

site = client.site('AA123456')

Or, if you don’t know the site’s UID, you can list all of them.

sites = client.sites

Finally, get the logged events for that site:

# Get everything.
events = site.events

# Restrict query to events with certain names.
events = site.events :names => ['page', 'unload']

# Avoid a data flood.
events = site.events :limit => 200

Events have the same data as in the JSON output.

event.name        # "page"
event.visitor     # "12f49459540.11faa9b963f5c4f0"
event.ip          # "127.0.0.1"
event.browser_ua  # "Mozilla/5.0 ..."
event.url         # <URI::HTTP:0x7f6750505078 URL:http://localhost>
event.ref         # <URI::HTTP:0x7f6750505078 URL:http://www.google.com>
event.data.your_property  # "your_value"
event.pixels.document.width  # 1680

The RSpec tests cover the entire API.

Testing¶ ↑

Clone the Pwnalytics repository and run the Rails server locally.

git clone git://github.com/pwnall/pwnalytics.git
cd pwnalytics
bundle
rake db:create db:migrate db:seed
rails s

The specs assume a local server for integration testing.

Contributing to pwnalytics_client¶ ↑

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2011 Victor Costan. See LICENSE.txt for further details.