Last active
March 19, 2016 16:14
-
-
Save whereisciao/eea15e8a4c4b796e5e46 to your computer and use it in GitHub Desktop.
Example code for Eventbrite Gem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'eventbrite' | |
require 'pry' | |
# Authenticate the Client | |
eventbrite = Eventbrite::REST::Client.new(oauth_token:"OAUTH_TOKEN") | |
# Example calls to fetch events, attendees, and orders | |
events = eventbrite.user_owned_events("me") | |
events = eventbrite.user_owned_events("me", status:"all") | |
attendees = eventbrite.event_attendees(8416549125) # Uses the Event Id | |
orders = eventbrite.event_orders(8416549125) # Uses the Event Id | |
# Example code to fetch event information for all events owned by the user | |
require 'csv' | |
eventbrite.user_owned_events("me", status:"live").each do |event| | |
CSV do |csv_out| | |
csv_out << [ | |
"www.eventbrite.com/myevent?eid=#{event.id}", | |
event.name.text, | |
Time.parse(event.start.utc).strftime("%F"), | |
Time.parse(event.end.utc).strftime("%F"), | |
event.status, | |
event.venue.address.city, | |
event.venue.address.region, | |
event.venue.address.country_name, | |
event.tickets_sold, | |
] | |
end | |
end | |
events.first.tickets_sold |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment