Project

sunnytrail

0.0
No commit activity in last 3 years
No release in over 3 years
Wrapper for SunnyTrail API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0
>= 0
 Project Readme

Sunnytrail¶ ↑

This is wrapper for Sunnytrail API - www.thesunnytrail.com

You can find API documentation here: beta.thesunnytrail.com/developers

Installation¶ ↑

Sunnytrail gem is hosted on rubygems.org

To install type in you terminal:

gem install sunnytrail

Usage¶ ↑

First you need to setup you token.

You can do it globally:

Sunnytrail.configure :api_key => "YOURTOKENHERE"

or per instance:

sunnytrail = Sunnytrail.new :api_key => "YOURTOKENHERE"

To add event to Sunnytrail use add_event function.

You can pass all arguments in hash.

Sunnytrail.add_event({:action => {:name =>"signup", :created =>Time.now.to_i}, 
                      :plan => {:name => "Basic", :price => 29, :recurring => 31}, 
                      :name => "User1", 
                      :email => "user1@example.com", 
                      :id => "123"
                     })

Or you can build event with Event class.

event = Sunnytrail::Event.new
event.id = 123
event.email = "user1@example.com"
event.name = "User1"
event.plan.name = "Basic"
event.plan.price = 29
event.plan.recurring = 31
event.action.name = "signup"
event.created = Time.now.to_i

Sunnytrail.add_event(event)

add_event works also as an instance method.

sunnytrail = Sunnytrail.new
sunnytrail.add_event(event)