Fomo Ruby SDK is the official SDK wrapper for the Fomo API service
API docs: https://docs.fomo.com
Add this line to your application's Gemfile:
gem'fomo'And then execute:
$ bundle
Or install it yourself as:
$ gem install fomo
Check out test/test_fomo.rb, or get started below:
Initialize Fomo client:
require'fomo'client=Fomo.new('<auth-token>')# // auth token can be found in Fomo application admin dashboard (App -> API Access)Create a new event:
event=FomoEvent.newevent.event_type_id='183'# Template ID is found inside Fomo > Templates -> Template IDevent.email_address='ryan.kulp@fomo.com',# used for creating Avatars in notificationsevent.ip_address='128.177.108.102',# used for extracting location parametersevent.first_name='Ryan'event.url='https://www.fomo.com'event.title='Test event'# you can also create events with event.event_type_tag# this is useful for multiple environments with different template IDs# Add event custom attributesevent.add_custom_event_field('variable_name','value')created_event=client.create_event(event)Fetch an event:
event=client.get_event('<event-id>')Get a collection of events:
list=client.get_events(30,1)Get events with metadata:
data=client.get_events_with_meta(30,1)events=data.eventsputsdata.meta.per_pageputsdata.meta.pageputsdata.meta.total_countputsdata.meta.total_pagesDelete an event:
client.delete_event('<event-id>')Update an event:
event=client.get_event('<event-id>')event.first_name='John'updated_event=client.update_event(event)If you have questions, email us at hello@fomo.com.