Skip to content

mateuszzawisza/sunnytrail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 => "[email protected]", 
                      :id => "123"
                     })

Or you can build event with Event class.

event = Sunnytrail::Event.new
event.id = 123
event.email = "[email protected]"
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)

About

Ruby Wrapper for Sunnytrail API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages