Eventbrite

Eventbrite rubygem for API v3.

Installation

Add this line to your application's Gemfile:

gem 'eventbrite'

And then execute:

$ bundle

Or install it yourself as:

$ gem install eventbrite

Usage

Access Token

Each method requires you have to a valid access_token that you obtain via Eventbrite OAuth 2.0 protocol.

There are two ways to use your access_token with this gem.

# This token will be used globally each time you used the gem API.
Eventbrite.token = `your_access_token`
Eventbrite::Event.search({q: 'Dogecoin'})

# This is to specific the token you want to use for each API call.
Eventbrite::Event.search({q: 'Dogecoin'}, 'your_access_token')

Pagination

Please not that not all APIs have pagination.

events = Eventbrite::Event.search({q: 'Dogecoin'})
events.paginated? # => true

# Get all events
all_events = events.events
while events.next?
  events = Eventbrite::Event.search({q: 'Dogecoin', page: events.next_page})
  all_events.concat(events.events)
end
# For supported parameters, check out the link above.
Eventbrite::Event.search({q: 'Dogecoin'})

Event Categories

Eventbrite::Category.all

Event Subcategories

Eventbrite::Subcategory.all

Event Formats

Eventbrite::Format.all

Event Details

Eventbrite::Event.retrieve('event_id')

Event Attendees

# For supported parameters, check out the link above.
# Also, the parameter `event_id` is required.
Eventbrite::Attendee.all({ event_id: 'event_id' })

Event Attendees’ Details

Eventbrite::Attendee.retrieve('event_id', 'attendee_id')

Event Orders

# For supported parameters, check out the link above.
# Also, the parameter `event_id` is required.
Eventbrite::Order.all({ event_id: 'event_id' })

Event Discounts

# For supported parameters, check out the link above.
# Also, the parameter `event_id` is required.
Eventbrite::Discount.all({ event_id: 'event_id' })

Event Access Codes

# For supported parameters, check out the link above.
# Also, the parameter `event_id` is required.
Eventbrite::AccessCode.all({ event_id: 'event_id' })

Event Ticket Classes

# The parameter `event_id` is required.
Eventbrite::TicketClass.all({ event_id: 'event_id' })

Event Transfers

# The parameter `event_id` is required.
Eventbrite::Transfer.all({ event_id: 'event_id' })

Event Teams

# The parameter `event_id` is required.
Eventbrite::Team.all({ event_id: 'event_id' })

Event Teams Details

Eventbrite::Team.retrieve('event_id', 'team_id')

Event Teams’ Attendees

Eventbrite::Team.attendees('event_id', 'team_id')

User Details

Eventbrite::User.retrieve('user_id')

User Orders

# The parameter `user_id` is required.
Eventbrite::User.orders({ user_id: 'user_id' })

User Owned Events

# For supported parameters, check out the link above.
# Also, the parameter `user_id` is required.
Eventbrite::User.owned_events({ user_id: 'user_id' })

User Owned Events’ Orders

# For supported parameters, check out the link above.
# Also, the parameter `user_id` is required.
Eventbrite::User.owned_event_orders({ user_id: 'user_id' })

User Owned Event’s Attendees

# For supported parameters, check out the link above.
# Also, the parameter `user_id` is required.
Eventbrite::User.owned_event_attendees({ user_id: 'user_id' })

User Venues

# Retrieve a User’s Venues
# The parameter `user_id` is required.
Eventbrite::User.venues({ user_id: 'user_id' })
# Retrieve a Venue
Eventbrite::Venue.retrieve('venue_id')

User Organizers

# The parameter `user_id` is required.
Eventbrite::User.organizers({ user_id: 'user_id' })

Order Details

Eventbrite::Order.retrieve('order_id')

Contact Lists

# For supported parameters, check out the link above.
# Also, the parameter `user_id` is required.
Eventbrite::ContactList.all({ user_id: 'user_id' })

Contact List Details

Eventbrite::ContactList.retrieve('user_id', 'contact_list_id')

Webhooks

# Retrieve a Webhook.
Eventbrite::Webhook.retrieve('webhook_id')

# Create a Webhook.
# See above link for supported parameters.
Eventbrite::Webhook.create({endpoint_url: 'your_webhooks_endpoint_url'})

# Delete a Webhook.
Eventbrite::Webhook.delete('webhook_id')

Expansions

# For supported expansions, check out the link above.
# Required parameters dependent on method called, refer to methods covered above for required parameters

# Retrieve venue information with events
Eventbrite::User.owned_events({ user_id: 'user_id', expand: 'venue' })

# Retrieve organizer and venue information with events
Eventbrite::User.owned_events({ user_id: 'user_id', expand: 'organizer,venue' })

Todo

  • Event Attendees' Details API should support parameters
  • POST/UPDATE/DELETE request for the API
  • Support for chained method

Thanks

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request